/* FILE: /css/layout.css
   Purpose: Global page layout (topbar + sidebar + main), responsive behavior.
   Notes:
   - No component skinning (buttons/inputs/modals) here; only layout and structural styles.
*/

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar__left,
.topbar__center,
.topbar__right {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  padding: var(--s-3) var(--s-4);
}

.topbar__left {
  justify-content: flex-start;
  min-width: 0;
}

.topbar__center {
  justify-content: center;
}

.topbar__right {
  justify-content: flex-end;
}

/* Brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-2);
  border-radius: var(--radius-sm);
}

.brand__mark {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--text);
  opacity: 0.9;
}

.brand__name {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Day title */
.day-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.day-title__date {
  font-weight: 600;
}

.day-title__meta {
  font-size: 12px;
  color: var(--muted);
}

/* App grid */
.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: var(--s-4);
  padding: var(--s-4);
  max-width: var(--page-max);
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  min-width: 0;
}

/* Main */
.main {
  min-width: 0;
}

/* Stage (right main content wrapper) */
.stage {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stage__header {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: var(--s-4);
  align-items: center;
}

.stage__now,
.stage__active {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stage__now-label,
.stage__active-label {
  font-size: 12px;
  color: var(--muted);
}

.stage__now-time {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.stage__active-title {
  font-size: 14px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage__actions {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  justify-content: flex-end;
}

/* Clock area wrapper */
.clock-wrap {
  position: relative;
  display: grid;
  place-items: center;
  padding: var(--s-6) var(--s-4);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}

.clock {
  width: min(560px, 100%);
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
}

.clock__placeholder {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 0 var(--s-4);
}

/* Suggestion hint overlay */
.clock-hint {
  position: absolute;
  bottom: var(--s-4);
  left: var(--s-4);
  right: var(--s-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.clock-hint__text {
  font-size: 13px;
  color: var(--text-2);
  min-width: 0;
}

/* Reflection line */
.reflection {
  min-height: 20px;
}

.reflection__line {
  font-size: 13px;
  color: var(--text-2);
}

/* Panel blocks on sidebar */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.panel__title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
}

.panel__actions {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

/* Calendar layout (structure only) */
.calendar {
  padding: var(--s-3) var(--s-4) var(--s-4);
}

.calendar__month {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: var(--s-3);
}

.calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--s-2);
}

/* Task list structure */
.task-list {
  display: flex;
  flex-direction: column;
}

.task-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: var(--s-3);
  align-items: center;
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--line);
}

.task-row:first-child {
  border-top: 0;
}

.task-row__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-row__time {
  font-size: 12px;
  color: var(--muted);
}

.task-row__title {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-row__meta {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

.task-row__color {
  width: 10px;
  height: 34px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.12);
}

/* Rhythm summary structure */
.rhythm {
  padding: var(--s-3) var(--s-4) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.rhythm__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.rhythm__label {
  font-size: 13px;
  color: var(--muted);
}

.rhythm__value {
  font-size: 13px;
  color: var(--text-2);
}

/* Responsive */
@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .stage {
    padding: var(--s-4);
  }

  .clock {
    width: min(520px, 100%);
  }
}

@media (max-width: 560px) {
  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "left right"
      "center center";
    row-gap: var(--s-2);
  }

  .topbar__left { grid-area: left; }
  .topbar__right { grid-area: right; }
  .topbar__center { grid-area: center; justify-content: flex-start; }

  .day-title {
    align-items: flex-start;
  }

  .app {
    padding: var(--s-3);
    gap: var(--s-3);
  }

  .stage__header {
    grid-template-columns: 1fr;
    gap: var(--s-3);
  }

  .clock-wrap {
    padding: var(--s-4) var(--s-3);
  }

  .clock-hint {
    flex-direction: column;
    align-items: stretch;
  }
}
