/* The site's home page (website/templates/home.html), over site.css. COPIED from the old app's
 * atmosphere.css "Home page" (its tokens in tokens.css): the vertical show title and its switcher, the
 * icon-stack actions, the caught-up box, the unavailable line, the box that says why no new
 * word is left and the per-tier ink. Changed: each glyph has its count beneath it (in the old
 * caption's type), the title, the glyphs and "Add a show" have focus rings, the caught-up box
 * has no bell, and no dot marks reviews due in another show: reviews are one pile across shows.
 */
body { background: #fff; }

/* ── Topbar: the brand (the gear is site-gear.css) ── */
.brand { color: var(--ink-faint); }

/* ── Title: the active show, native title down the right with the English beside it ── */
.home-title-area {
  display: flex; flex-direction: column; align-items: flex-end;
  opacity: 0; animation: fadeUp 0.8s ease 0.1s forwards;
  position: fixed;
  --home-title-top: 78px;
  top: var(--home-title-top);
  /* the strip's right edge never passes 100vw - 16px, whatever the title */
  --home-title-strip-max: 68px;
  max-width: var(--home-title-strip-max);
  left: min(calc(50% + 405.5px), calc(100vw - 16px - var(--home-title-strip-max)));
  z-index: 20;
}
@media (max-width: 799px) {
  .home-title-area {
    left: auto; right: 16px;
    --home-title-top: calc(28px + env(safe-area-inset-top));
  }
}
.title-comp {
  display: flex; align-items: flex-start; justify-content: flex-end;
  gap: 12px; padding: 0 0 10px;
  position: relative;
  --jp-title-size: 26px;
  background: none; border: none; color: inherit; font: inherit; text-align: inherit;
  transition: opacity 0.25s;
}
button.title-comp { cursor: pointer; }
:where(button).title-comp:hover { opacity: 0.7; }
:where(button).title-comp:hover .jp-title { color: #54687f; }
:where(button).title-comp:hover .title-side { color: var(--stone); }
.title-comp:focus-visible { outline: 2px solid var(--primary-soft); outline-offset: 4px; border-radius: 4px; }
.jp-title {
  writing-mode: vertical-rl;
  font-family: var(--font-jp); font-weight: 300;
  font-size: var(--jp-title-size); color: var(--stone);
  letter-spacing: 0.1em; line-height: 1.15;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.08), 0 0 20px rgba(96,94,148,0.08);
  max-height: 45vh;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  animation: glowDrift 16s ease-in-out 1s infinite;
  transition: color 0.25s;
}
@media (min-width: 800px) {
  .title-comp { --jp-title-size: 32px; }
  .jp-title { max-height: 50vh; }
}
.title-side {
  writing-mode: vertical-rl;
  font: var(--fw-light) var(--fs-caption)/1 var(--font-en);
  color: var(--stone-light); letter-spacing: 0.15em;
  text-transform: lowercase; margin-top: 2px; order: -1;
  max-height: 45vh;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 0.25s;
}
@media (min-width: 800px) { .title-side { max-height: 50vh; } }
/* a phone: the title runs down to the screen's bottom, or to the caught-up box (site-home.js) */
@media (max-width: 799px) {
  .home-title-area {
    --home-title-screen-room: calc(100vh - var(--home-title-top) - 32px - var(--safe-bottom));
  }
  @supports (height: 1svh) {
    .home-title-area {
      --home-title-screen-room: calc(100svh - var(--home-title-top) - 32px - var(--safe-bottom));
    }
  }
  .jp-title, .title-side { max-height: var(--home-title-room, var(--home-title-screen-room)); }
}
@keyframes glowDrift {
  0%,100% { text-shadow: 0 0 12px rgba(74,72,120,0.0), 0 0 40px rgba(74,72,120,0.0); }
  40% { text-shadow: 0 0 16px rgba(74,72,120,0.12), 0 0 50px rgba(74,72,120,0.06); }
  70% { text-shadow: 0 0 10px rgba(196,162,85,0.10), 0 0 35px rgba(196,162,85,0.04); }
}

/* ── The switcher: opens to the left of the title ── */
.show-switcher-menu {
  writing-mode: horizontal-tb;
  position: absolute; top: 0; right: calc(100% + 10px);
  background: rgba(255,255,255,0.92); backdrop-filter: blur(16px);
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 6px; min-width: 200px;
  box-shadow: 0 8px 32px rgba(42,36,64,0.12);
  opacity: 0; pointer-events: none; visibility: hidden; transform: translateX(8px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  max-height: calc(100dvh - var(--home-title-top) - 16px - var(--safe-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(74,72,120,0.28) transparent;
}
/* visible at once on opening, so its first item can take the focus */
.show-switcher-menu.is-open {
  opacity: 1; pointer-events: auto; visibility: visible; transform: none;
  transition: opacity 0.2s, transform 0.2s, visibility 0s;
}
.show-switcher-item {
  all: unset; display: flex; align-items: center; width: 100%; box-sizing: border-box;
  min-height: 44px; padding: 12px 14px; border-radius: var(--radius-sm);
  font: 300 14px/1.3 var(--font-en); color: var(--ink-soft); letter-spacing: 0.04em;
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.show-switcher-item:hover { background: var(--primary-tint); color: var(--ink); }
.show-switcher-item:focus-visible { outline: 2px solid var(--primary-soft); outline-offset: -2px; }
.show-switcher-item.is-active { color: var(--primary); font-weight: 500; }
.show-switcher-add { color: var(--ink-muted); border-top: 1px solid var(--rule); margin-top: 4px; }
.show-switcher-main { border-bottom: 1px solid var(--rule); margin-bottom: 4px; }

/* ── Actions: a line-art glyph per offer down the centre, its count beneath. Secondary glyphs
 * stay stone-slate; the one primary takes its own colour and is larger. ── */
.home-actions-area {
  display: flex; flex-direction: column; align-items: center;
  gap: 40px;
  opacity: 0; animation: fadeUp 0.8s ease 0.35s forwards;
  position: fixed; top: 50%; left: 50%;
  translate: -50% -50%;
  z-index: 10;
}
.act-id--review { --act-color: var(--act-review); }
.act-id--audio { --act-color: var(--act-audio); }
.act-id--reading { --act-color: var(--act-reading); }
.act-id--learn { --act-color: var(--act-learn); }
.act-id--deep { --act-color: var(--act-deep); }
.action {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 6px 18px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.action:focus-visible { outline: 2px solid var(--primary-soft); outline-offset: 3px; border-radius: 4px; }
.action svg {
  width: 38px; height: 38px;
  fill: none; stroke: var(--ink-soft); stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round; opacity: .9;
  transition: stroke .35s ease, transform .45s var(--ease-out-expo), opacity .35s ease;
}
.action:hover svg { transform: translateY(-3px); opacity: 1; }
.action--review svg { stroke: var(--act-color); width: 50px; height: 50px; opacity: 1; }
.action-count {
  font: var(--fw-medium) 13px/1 var(--font-display);
  letter-spacing: .02em; color: var(--ink-soft); opacity: .82;
  text-align: center;
}
@media (min-width: 800px) {
  .home-actions-area { gap: 52px; }
  .action svg { width: 48px; height: 48px; }
  .action--review svg { width: 62px; height: 62px; }
  .action-count { font-size: 15px; }
}
/* Deep review hides its size: a gold stone trail stands where the count would be. */
.deep-mark { display: inline-flex; align-items: center; gap: 5px; height: 13px; }
.deep-mark i { display: block; border-radius: 50%; background: var(--act-deep); }
.deep-mark i:nth-child(1) { width: 9px; height: 9px; opacity: .92; animation: stoneStep 4.5s ease-in-out infinite; }
.deep-mark i:nth-child(2) { width: 7px; height: 7px; opacity: .6; }
.deep-mark i:nth-child(3) { width: 5px; height: 5px; opacity: .32; }
.deep-mark i:nth-child(4) { width: 3.5px; height: 3.5px; opacity: .14; }
@keyframes stoneStep { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-2px); } }
/* The once-ever arrow at the Learn glyph (site-learn-hint.js), the old atmosphere.css
   `.learn-arrow`: the guess line's doodle mirrored, arcing in from the upper right, its tip just
   above the glyph. Absolute, so it never moves the layout; after the glyph rules it overrides. */
.action[data-first-lesson] { position: relative; }
.action svg.learn-arrow {
  position: absolute;
  left: 30px;
  bottom: calc(100% - 12px);
  width: 80px;
  height: 55px;
  overflow: visible;
  pointer-events: none;
  fill: none;
  stroke: var(--act-learn);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 1;
  transform: scaleX(-1);
  transition: none;
}
@media (prefers-reduced-motion: no-preference) {
  .action svg.learn-arrow { animation: learnArrowFade 3.4s 1 both; }
  .learn-arrow path { animation: learnArrowDraw 0.6s 0.35s 1 both cubic-bezier(0.45, 0, 0.3, 1); }
  .learn-arrow path + path { animation-duration: 0.22s; animation-delay: 0.95s; }
}
@keyframes learnArrowDraw {
  from { stroke-dasharray: 1 2; stroke-dashoffset: 1.05; }
  to   { stroke-dasharray: 1 2; stroke-dashoffset: 0; }
}
@keyframes learnArrowFade {
  0%, 59% { opacity: 1; transform: scaleX(-1);
            animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
  100%    { opacity: 0; transform: scaleX(-1) translateY(-2px); }
}

/* ── All caught up ── */
.done-message {
  position: fixed; bottom: calc(14% + 45px + var(--safe-bottom));
  left: calc(50% + 12px); right: 18px;
  padding: 10px 0;
  opacity: 0; animation: fadeUp 0.8s ease 0.3s forwards;
}
@media (min-width: 800px) {
  .done-message { left: calc(50% + 77px); right: auto; }
}
/* Phones short enough for the glyphs to reach the caught-up words: the glyphs step left. */
@media (max-width: 799px) and (max-height: 800px) {
  .home:has(.done-message:not([hidden])) .home-actions-area { left: 30%; }
}
@media (max-width: 799px) and (max-height: 950px) {
  .home:has(.done-message:not([hidden])) .home-actions-area:has(> .action:nth-of-type(3)) { left: 30%; }
}
.done-label-jp {
  font-family: var(--font-jp); font-weight: 300;
  font-size: 29px; line-height: 1.3; color: var(--ink-soft);
  letter-spacing: 0.05em; margin-bottom: 3px;
}
@media (min-width: 800px) { .done-label-jp { font-size: 36px; } }
.done-label-en {
  font: var(--fw-light) var(--fs-eyebrow)/1 var(--font-en);
  color: var(--ink-muted); letter-spacing: 0.15em;
  text-transform: lowercase; margin-bottom: 14px;
}
.done-sub {
  font: var(--fw-light) var(--fs-sm)/1.35 var(--font-en);
  color: var(--ink-muted); letter-spacing: 0.1em;
}
.nowrap { white-space: nowrap; }
.done-keep-going {
  display: inline-block; margin: 42px 0 0 -4px; padding: 12px 4px;  /* 18px + the old reminder note's line; text in line with the box */
  font: var(--fw-light) var(--fs-caption)/1 var(--font-en);
  color: rgba(255,255,255,0.55); letter-spacing: 0.05em;
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: rgba(255,255,255,0.25);
  background: none; border: none; cursor: pointer;
  transition: color 0.2s;
}
.done-keep-going:hover { color: rgba(255,255,255,0.80); }
.done-keep-going:focus-visible { outline: 2px solid var(--primary-soft); outline-offset: 2px; }
.done-message.is-dismissing {
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
/* the Learn button "I want to keep going" reveals once the box is gone (site-home.js) */
.extra-learn-area {
  display: flex; justify-content: center; margin-top: 6px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.extra-learn-area[hidden] { display: none; }
.extra-learn-area.is-entering { opacity: 0; transform: translateY(8px); }
/* the active show's deck cannot be read: a line in the actions' place; no new word is left
 * (_learn_end.html): a box in the Learn button's place, "Add a show" a pill */
.learn-status {
  text-align: center; padding: 6px 4px 2px;
  opacity: 0; animation: fadeUp 0.8s ease 0.2s forwards;
}
.learn-status .done-sub { max-width: 32ch; margin: 4px auto 0; }
.learn-status--finished .done-label-en { color: var(--ink-soft); }
.learn-status__action { margin-top: 16px; }
.learn-status__add {
  display: inline-block; padding: 7px 18px;
  font: var(--fw-light) var(--fs-caption)/1 var(--font-en);
  letter-spacing: 0.08em; color: var(--ink-soft);
  background: rgba(80,78,104,0.06);
  border: 1px solid rgba(80,78,104,0.28); border-radius: 999px;
  text-decoration: none; cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.learn-status__add:hover {
  background: rgba(80,78,104,0.12); border-color: rgba(80,78,104,0.45);
}
.learn-status__add:focus-visible { outline: 2px solid var(--primary-soft); outline-offset: 2px; }
.atmosphere.is-caught-up ~ * .learn-status__add,
.atmosphere.is-night ~ * .learn-status__add {
  color: rgba(235,232,245,0.82);
  background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.22);
}
.atmosphere.is-caught-up ~ * .learn-status__add:hover,
.atmosphere.is-night ~ * .learn-status__add:hover {
  color: #fff;
  background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.36);
}

/* ── Ink per landscape: dusk and night are dark skies ── */
.brand, .settings-btn svg, .jp-title, .title-side, .done-label-jp, .done-label-en, .done-sub,
.done-keep-going { transition: color 1.4s ease, stroke 1.4s ease, text-shadow 1.4s ease; }
.atmosphere.is-caught-up ~ * .brand { color: rgba(235,232,245,0.92); }
.atmosphere.is-caught-up ~ * .settings-btn svg { stroke: rgba(225,220,240,0.85); }
.atmosphere.is-caught-up ~ * .jp-title { color: rgba(235,232,245,0.88); text-shadow: none; }
.atmosphere.is-caught-up ~ * .title-side { color: rgba(225,220,240,0.70); }
.atmosphere.is-caught-up ~ * .done-label-jp { color: rgba(235,232,245,0.88); }
.atmosphere.is-caught-up ~ * .done-label-en { color: rgba(225,220,240,0.70); }
.atmosphere.is-caught-up ~ * .done-sub { color: rgba(215,210,235,0.65); }
.atmosphere.is-night ~ * .brand { color: rgba(210,205,230,0.88); }
.atmosphere.is-night ~ * .settings-btn svg { stroke: rgba(190,185,215,0.78); }
.atmosphere.is-night ~ * .jp-title { color: rgba(210,205,230,0.78); text-shadow: none; }
.atmosphere.is-night ~ * .title-side { color: rgba(190,185,215,0.55); }
.atmosphere.is-night ~ * .done-label-jp { color: rgba(210,205,230,0.78); }
.atmosphere.is-night ~ * .done-label-en { color: rgba(190,185,215,0.55); }
.atmosphere.is-night ~ * .done-sub { color: rgba(160,155,190,0.55); }

@media (prefers-reduced-motion: reduce) {
  .home-title-area, .home-actions-area, .done-message, .learn-status { opacity: 1; animation: none; }
  .extra-learn-area { transition: none; }
  .jp-title { animation: none; }
  .deep-mark i { animation: none; }
}
