/* Review polish after first local visual pass.
   Keeps the reference-informed structure while correcting alignment, hierarchy,
   control affordance and footer rhythm. */

:root {
  --ref-today-rail: 300px;
}

/* One geometry for the whole Today page. */
body[data-view="home"] main,
body[data-view="home"] .site-footer {
  width: min(1220px, calc(100% - 56px));
}

body[data-view="home"] .daily-panel,
body[data-view="home"] .today-companion {
  grid-template-columns: minmax(0, 1fr) minmax(260px, var(--ref-today-rail));
}

/* Typography should feel deliberate, not thin or floaty. */
body[data-view="home"] .home-heading h1,
body[data-view="home"] .daily-main h2,
body[data-view="home"] .circuit-name,
body[data-view="home"] .journey-finish strong,
body[data-view="home"] .arc-card h2,
body[data-view="home"] .browse-invitation strong {
  font-weight: 600;
}

body[data-view="home"] .daily-main > p,
body[data-view="home"] .circuit-caption,
body[data-view="home"] .journey-finish div > span,
body[data-view="home"] .arc-card p,
body[data-view="home"] .browse-invitation small {
  font-weight: 500;
}

body[data-view="home"] .daily-main h2 {
  letter-spacing: -0.06em;
}

/* The date works. Keep that quiet editorial cue. */
body[data-view="home"] .home-heading .eyebrow {
  color: #8d9994;
  font-weight: 600;
}

/* Streak is a destination, so make it read and behave like one. */
body[data-view="home"] .habit-pill {
  cursor: pointer;
  min-height: 42px;
  padding: 8px 10px;
  margin: 0 -10px 0 0;
  border-radius: 9px;
  transition: background .15s ease, color .15s ease;
}

body[data-view="home"] .habit-pill::after {
  content: "›";
  margin-left: 3px;
  color: #7f8c86;
  font-size: 1.15rem;
  line-height: 1;
}

body[data-view="home"] .habit-pill:hover,
body[data-view="home"] .habit-pill:focus-visible {
  background: rgba(255,255,255,.04);
}

body[data-view="home"] .habit-pill:focus-visible {
  outline: 2px solid var(--ref-accent);
  outline-offset: 3px;
}

/* These labels were explaining implementation rather than helping the choice. */
body[data-view="home"] .free-pill,
body[data-view="home"] .journey-footnote {
  display: none;
}

body[data-view="home"] .daily-topline {
  justify-content: flex-start;
  margin-bottom: 22px;
}

/* Rail spacing: each step has breathing room and the finish never collides. */
body[data-view="home"] .daily-side {
  justify-content: flex-start;
  padding: 48px 0 44px 32px;
}

body[data-view="home"] .daily-path .circuit-row {
  min-height: 108px;
  grid-template-columns: 34px minmax(0,1fr);
  gap: 15px;
}

body[data-view="home"] .daily-path .circuit-row::before {
  top: 38px;
  left: 16px;
}

body[data-view="home"] .journey-step-copy {
  padding-top: 1px;
}

body[data-view="home"] .journey-finish {
  margin: 12px 0 0;
  padding: 26px 10px 0 0;
}

/* Remove the mismatched gap so every horizontal rule shares an edge. */
body[data-view="home"] .today-companion {
  grid-template-columns: 1fr;
  margin-top: 0;
  border-bottom: 1px solid var(--ref-rule);
}

body[data-view="home"] .arc-card {
  min-height: 220px;
  padding: 32px 40px 32px 0;
}

/* Train is a clear secondary destination, not a floating lower-right card. */
body[data-view="home"] .browse-invitation {
  min-height: 220px;
  padding: 32px 20px 32px 32px;
  align-items: center;
  justify-content: flex-start;
  border-left: 1px solid var(--ref-rule);
  color: var(--ref-ink);
}

body[data-view="home"] .browse-mark {
  color: var(--ref-accent);
  font-size: 1.35rem;
}

body[data-view="home"] .browse-invitation > span:last-child {
  gap: 3px;
}

body[data-view="home"] .browse-invitation:hover {
  background: rgba(255,255,255,.025);
}

body[data-view="home"] .account-note {
  margin: 0;
  padding: 18px 0 24px;
}

/* Today keeps its editorial page width, but the footer itself uses the shared
   shell composition so account and information controls do not change by page. */
body[data-view="home"] .site-footer {
  margin-top: 0;
  padding: 24px 0 30px;
  border-top: 1px solid var(--ref-rule);
}

body[data-view="home"] .footer-copy {
  gap: 4px;
}

/* Account lives in the header (and in You on small screens); Play settings lives
   in You. Keep the footer as one stable information row on every main page. */
body:not([data-view="play"]) .site-footer {
  grid-template-columns: minmax(260px,1fr) auto;
  align-items: start;
}

body:not([data-view="play"]) .footer-links {
  justify-content: flex-end;
}

.footer-actions:empty {
  display: none;
}

@media (max-width: 900px) {
  body[data-view="home"] .daily-panel,
  body[data-view="home"] .today-companion {
    grid-template-columns: minmax(0,1fr) minmax(240px,270px);
  }

  body[data-view="home"] .arc-card {
    grid-template-columns: 180px minmax(0,1fr);
  }

}

@media (max-width: 700px) {
  body:not([data-view="play"]) .site-footer {
    display: grid;
  }

  body[data-view="home"] main,
  body[data-view="home"] .site-footer {
    width: calc(100% - 28px);
  }

  body[data-view="home"] .daily-panel,
  body[data-view="home"] .today-companion {
    grid-template-columns: 1fr;
  }

  body[data-view="home"] .daily-side,
  body[data-view="home"] .browse-invitation {
    border-left: 0;
    border-top: 1px solid var(--ref-rule);
  }

  body[data-view="home"] .daily-side {
    padding: 30px 0 28px;
  }

  body[data-view="home"] .daily-path .circuit-row {
    min-height: 92px;
  }

  body[data-view="home"] .arc-card {
    min-height: 0;
    padding: 28px 0;
  }

  body[data-view="home"] .browse-invitation {
    min-height: 0;
    padding: 22px 0;
  }

}

/* Move the five primary destinations to the compact bottom rail before the desktop
   header starts feeling squeezed. The header then only carries brand + utilities. */
@media (min-width: 701px) and (max-width: 850px) {
  body:not([data-view="play"]) {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .site-header {
    gap: 14px;
  }

  .top-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 100;
    width: 100%;
    margin: 0;
    padding: 7px 16px calc(7px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    border-top: 1px solid #45513f;
    background: #161e24f5;
    backdrop-filter: blur(18px);
  }

  .top-nav a {
    flex-direction: column;
    gap: 4px;
    min-height: 55px;
    padding: 7px 4px;
    font-size: .75rem;
  }

  .top-nav svg {
    width: 20px;
    height: 20px;
  }

  .header-actions {
    margin-left: auto;
    gap: 6px;
  }

  .account-header,
  .sound-toggle {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
  }
}

@media (min-width: 701px) and (max-width: 850px) and (max-height: 600px) {
  body:not([data-view="play"]) {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .site-header {
    height: 62px;
  }

  body[data-view="home"] .home-heading {
    padding: 12px 0 10px;
  }

  body[data-view="home"] .home-heading h1 {
    font-size: 2rem;
  }

  body[data-view="home"] .daily-main {
    min-height: 300px;
    padding: 18px 28px 18px 6px;
  }

  body[data-view="home"] .daily-topline {
    margin-bottom: 12px;
  }

  body[data-view="home"] .daily-main h2 {
    margin-bottom: 10px;
    font-size: clamp(2.4rem, 7.5vh, 3rem);
  }

  body[data-view="home"] .daily-main > p {
    margin-bottom: 12px;
    font-size: .9rem;
    line-height: 1.45;
  }

  body[data-view="home"] .daily-main .primary {
    min-height: 44px;
    padding-block: 10px;
  }

  body[data-view="home"] .journey-footnote {
    margin-top: 8px;
  }

  body[data-view="home"] .daily-side {
    padding: 16px 0 14px 20px;
  }

  body[data-view="home"] .daily-path .circuit-row {
    min-height: 66px;
  }

  .top-nav {
    padding: 4px 12px calc(4px + env(safe-area-inset-bottom));
    gap: 4px;
  }

  .top-nav a {
    min-height: 50px;
    gap: 2px;
    padding: 4px;
    font-size: .7rem;
  }

  .top-nav svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 430px) {
  body[data-view="home"] main,
  body[data-view="home"] .site-footer {
    width: calc(100% - 24px);
  }

  body[data-view="home"] .home-heading {
    display: grid;
    grid-template-columns: minmax(0,1fr);
    align-items: start;
    gap: 14px;
  }

  body[data-view="home"] .habit-pill {
    width: fit-content;
    margin: 0;
    align-self: start;
    justify-self: start;
  }

  /* The <=800 layout absolutely positions this object beside copy. Once the
     editorial card becomes a single mobile column, return the Arc to normal flow. */
  body[data-view="home"] .arc-card .mindarc-object {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    width: min(175px, 100%);
    margin: 0 auto -4px;
  }
}
