/* Useful info: compact type band with a turning word card and topic chips, Flip-filtered glossary,
   onward links. Tokens from _work/design-plan.md (site.css). */

/* ---------- opener ---------- */
.u-open { position: relative; background: var(--mist) url('../img/map-grid.svg') 0 0 / 64px 64px; padding: clamp(36px, 5.5vh, 60px) 0 clamp(52px, 7vh, 76px); overflow: clip; }
.u-open__route { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.u-open__road { fill: none; stroke: #fff; stroke-width: 26; stroke-linecap: round; opacity: .85; }
.u-open__ink { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 12; animation: uDash 1.6s linear infinite; }
@keyframes uDash { to { stroke-dashoffset: -28; } }
.u-open__grid { position: relative; display: grid; grid-template-columns: minmax(0, 9fr) minmax(0, 3fr); gap: clamp(32px, 4vw, 64px); align-items: center; min-height: min(40vh, 380px); }
.u-open__title { font-size: clamp(2.4rem, 4.3vw, 4.2rem); line-height: 1.04; letter-spacing: -0.03em; display: flow-root; }
.u-open__line { margin: 18px 0 0; font-size: 1.2rem; line-height: 1.55; color: var(--slate); }

/* chips */
.u-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.u-chips--open { margin-top: 26px; }
.u-chip { display: inline-flex; align-items: center; gap: 9px; min-height: 50px; padding: 8px 10px 8px 16px; border: 2px solid var(--ink); border-radius: var(--r-btn); background: #fff; color: var(--ink); font-family: var(--f-display); font-weight: 700; font-size: 1.02rem; cursor: pointer; transition: background .3s, color .3s, transform .3s var(--ease); }
.u-chip:hover { background: var(--paper); }
.u-chip:active { transform: translateY(1px); }
.u-chip__ico { width: 20px; height: 20px; flex: none; color: var(--steel-deep); transition: color .3s; }
.u-chip__n { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; background: var(--mist); font-size: .9rem; font-weight: 800; transition: background .3s, color .3s; }
.u-chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.u-chip[aria-pressed="true"] .u-chip__ico { color: var(--sky); }
.u-chip[aria-pressed="true"] .u-chip__n { background: var(--sky); color: var(--ink); }
.u-chip[data-chip="all"] { padding-left: 18px; }
.u-jump { display: none; }
.no-js .u-chips { display: none; }
.no-js .u-jump { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 24px; }
.u-jump a { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--f-display); font-weight: 700; color: var(--ink); text-decoration-color: var(--sky); text-decoration-thickness: 2px; }

/* the word card, tilting in 3D and turning over to the next word */
.u-cover { position: relative; justify-self: center; width: clamp(220px, 18.5vw, 280px); perspective: 1100px; margin-right: 24px; }
.u-cover__link { position: relative; display: block; aspect-ratio: 5 / 6; text-decoration: none; transform-style: preserve-3d; transform: rotateY(-14deg) rotateX(4deg); color: var(--ink); }
.u-cover__card { position: absolute; inset: 0; border-radius: var(--r); overflow: hidden; background: #fff; border-top: 4px solid var(--sky); box-shadow: 0 30px 60px rgba(38,44,48,.22), 0 6px 14px rgba(38,44,48,.12); }
.u-word { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 16px; }
.u-word[hidden] { display: none; }
.u-word::before { content: attr(data-letter); position: absolute; right: -4px; bottom: -.3em; font-family: var(--f-display); font-weight: 800; font-size: 9rem; line-height: 1; color: transparent; -webkit-text-stroke: 2px var(--mist); pointer-events: none; }
.u-word > * { position: relative; }
.u-word__tag { display: inline-flex; align-items: center; gap: 8px; padding-right: 54px; font-size: .9rem; font-weight: 600; color: var(--steel-deep); }
.u-word__ico { width: 26px; height: 26px; padding: 3px; flex: none; background: var(--sky); color: var(--ink); border-radius: var(--r); }
.u-word__term { margin-top: 4px; font-family: var(--f-display); font-weight: 800; font-size: 1.55rem; line-height: 1.1; letter-spacing: -0.01em; }
.u-word__text { font-size: .98rem; line-height: 1.5; color: var(--slate); }
.u-word__more { margin-top: auto; display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 700; color: var(--steel-deep); }
.u-word__more svg { width: 20px; height: 12px; transition: transform .4s var(--ease); }
.u-cover__link:hover .u-word__more { color: var(--ink); }
.u-cover__link:hover .u-word__more svg { transform: translateX(5px); }
.u-word__count { position: absolute; top: 22px; right: 20px; z-index: 1; font-family: var(--f-display); font-weight: 800; font-size: .85rem; color: var(--slate); }
.u-cover__glare { position: absolute; inset: 0; background: radial-gradient(260px circle at var(--gx, 28%) var(--gy, 18%), rgba(255,255,255,.55), transparent 60%); mix-blend-mode: soft-light; pointer-events: none; }
.u-cover__page { position: absolute; inset: 0; background: #fff; border: 1px solid #cfe0e8; border-radius: var(--r); }
.u-cover__page--1 { transform: translate3d(7px, 5px, -14px); }
.u-cover__page--2 { transform: translate3d(14px, 10px, -28px); background: #f7fbfc; }
.u-cover__page--3 { transform: translate3d(21px, 15px, -42px); background: #eef5f8; }
.u-cover__link:focus-visible { outline-offset: 8px; }
.u-cover__tag { position: absolute; left: -38px; bottom: -20px; z-index: 2; display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px 6px 10px; background: #fff; border-radius: var(--r); box-shadow: 0 10px 30px rgba(38,44,48,.14); pointer-events: none; }
.u-cover__tag .hand { font-size: 1.55rem; line-height: 1; }
.u-cover__tag .pin-ico { color: var(--ink); --pin-house: #fff; }

/* ---------- glossary ---------- */
.u-gloss { position: relative; padding: clamp(48px, 7vh, 80px) 0 var(--sec); background: var(--mist); overflow: clip; }
.u-gloss__route { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--sky); pointer-events: none; }
.u-gloss__dash { stroke-dasharray: 8 12; animation: uDash 2.2s linear infinite; opacity: .8; }
.u-gloss > .wrap { position: relative; }
.u-gloss__head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px 40px; margin-bottom: clamp(24px, 3.4vh, 34px); }
.u-find { display: grid; gap: 6px; }
.u-find__label { font-weight: 600; font-size: 1rem; }
.u-find__box { position: relative; }
.u-find__ico { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--steel-deep); pointer-events: none; }
.u-find input { width: min(340px, 80vw); height: 52px; padding: 0 16px 0 44px; border: 2px solid var(--ink); border-radius: var(--r); background: #fff; font: inherit; font-size: 1.05rem; color: var(--ink); }
.u-find input::placeholder { color: #707a80; }
.u-find input:focus-visible { outline: 3px solid var(--steel-deep); outline-offset: 2px; }
.u-count { grid-column: 1 / -1; margin: 0; font-family: var(--f-display); font-weight: 700; color: var(--slate); }

.g-grid { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: start; gap: 18px; }
.g-card { position: relative; perspective: 900px; scroll-margin-top: 150px; }
.g-card.is-out { display: none; }
.g-card__in { position: relative; display: flex; flex-direction: column; height: 100%; padding: 20px 22px 20px; background: #fff; border-radius: var(--r); box-shadow: 0 1px 0 rgba(38,44,48,.06); border-top: 3px solid var(--mist); overflow: hidden; transition: box-shadow .45s var(--ease), border-color .45s; }
.g-card__in::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 25%, rgba(135,192,215,.42) 48%, transparent 70%); transform: translateX(-120%); }
.g-card__in::before { content: attr(data-letter); position: absolute; right: -4px; bottom: -.32em; font-family: var(--f-display); font-weight: 800; font-size: 8.5rem; line-height: 1; color: transparent; -webkit-text-stroke: 2px var(--mist); pointer-events: none; transition: -webkit-text-stroke-color .5s, transform .7s var(--ease); }
.g-card__in > * { position: relative; }
.g-card__in:hover::before, .g-card.is-glint .g-card__in::before { -webkit-text-stroke-color: #b5d8e7; transform: translate(-6px, -6px); }
.g-card.is-glint .g-card__in { border-top-color: var(--sky); box-shadow: 0 22px 44px rgba(38,44,48,.12); }
.g-card.is-glint .g-card__in::after { animation: uGlint 1.3s var(--ease) both; }
@keyframes uGlint { to { transform: translateX(120%); } }
.g-card__in:hover { box-shadow: 0 24px 50px rgba(38,44,48,.12); border-top-color: var(--steel); }
.g-card__tag { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--steel-deep); }
.g-card__ico { width: 26px; height: 26px; padding: 3px; flex: none; background: var(--mist); color: var(--ink); border-radius: var(--r); transition: background .4s; }
.g-card__in:hover .g-card__ico, .g-card.is-glint .g-card__ico { background: var(--sky); }
.g-card__term { margin: 12px 0 8px; font-size: 1.32rem; line-height: 1.15; }
.g-card__text { margin: 0; font-size: .98rem; line-height: 1.52; color: var(--slate); }
.g-card__more { margin-top: auto; padding-top: 10px; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; align-self: flex-start; font-family: var(--f-display); font-weight: 700; color: var(--steel-deep); text-decoration: none; }
.g-card__more svg { width: 20px; height: 12px; transition: transform .4s var(--ease); }
.g-card__more:hover { color: var(--ink); }
.g-card__more:hover svg { transform: translateX(5px); }
.g-card:target .g-card__in { border-top-color: var(--steel); box-shadow: 0 0 0 3px var(--sky); }
.g-empty { margin: 8px 0 0; padding: 26px 28px; background: #fff; border-left: 4px solid var(--sky); font-size: 1.1rem; border-radius: var(--r); }

/* rail: the chips follow you down the glossary */
.u-rail { position: fixed; left: 0; right: 0; top: 84px; z-index: 80; background: rgba(243,248,250,.95); box-shadow: 0 10px 24px rgba(38,44,48,.08); border-top: 1px solid var(--mist); transform: translateY(-120%); visibility: hidden; transition: transform .5s var(--ease), visibility 0s .5s; }
.u-rail.is-on { transform: none; visibility: visible; transition: transform .5s var(--ease), visibility 0s; }
.u-rail[hidden] { display: none; }
.u-rail__in { display: flex; align-items: center; gap: 16px; padding-block: 8px; }
.u-rail__label { flex: none; font-size: 1.5rem; color: var(--steel-deep); }
.u-chips--rail { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 8px; }
.u-chips--rail::-webkit-scrollbar { display: none; }
.u-chips--rail .u-chip { flex: none; min-height: 44px; font-size: .96rem; padding: 6px 8px 6px 14px; }
.u-chips--rail .u-chip__n { min-width: 26px; height: 26px; }

/* ---------- onward: calculator and situations ---------- */
.u-next { position: relative; padding: var(--sec) 0; background: var(--sky); overflow: clip; }
.u-next__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px); align-items: center; }
.u-calc { display: flex; flex-direction: column; background: #fff; border-radius: var(--r); color: var(--ink); text-decoration: none; overflow: hidden; box-shadow: 0 30px 60px rgba(38,44,48,.14); transition: box-shadow .5s var(--ease); }
.u-calc:hover { color: var(--ink); box-shadow: 0 40px 80px rgba(38,44,48,.22); }
.u-calc__art { position: relative; display: block; background: var(--mist) url('../img/map-grid.svg') 0 0 / 48px 48px; padding: 18px 22px 22px; }
.u-calc__art svg { width: 100%; height: auto; max-height: 32vh; }
.u-calc__ground { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.u-calc__wall, .u-calc__door { fill: #fff; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.u-calc__roof, .u-calc__chim { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.u-calc__win { fill: var(--mist); stroke: var(--ink); stroke-width: 3; transition: fill .5s; }
.u-calc__win.is-lit { fill: var(--sky); }
.u-calc__string { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.u-calc__card { fill: var(--sky); stroke: var(--ink); stroke-width: 3; }
.u-calc__val { font-family: var(--f-display); font-weight: 800; font-size: 24px; fill: var(--ink); }
.u-calc__bar { position: relative; display: block; height: 8px; margin-top: 10px; background: #fff; border-radius: 4px; overflow: hidden; }
.u-calc__bar span { position: absolute; inset: 0; background: var(--ink); transform-origin: left; transform: scaleX(.45); }
.u-calc__body { display: flex; flex-direction: column; gap: 8px; padding: 22px 26px 24px; }
.u-calc__title { font-family: var(--f-display); font-weight: 800; font-size: 1.7rem; line-height: 1.1; }
.u-calc__text { color: var(--slate); }
.u-calc__more { display: inline-flex; align-items: center; gap: 10px; margin-top: 4px; font-family: var(--f-display); font-weight: 700; color: var(--steel-deep); }
.u-calc__more svg { width: 20px; height: 12px; transition: transform .4s var(--ease); }
.u-calc:hover .u-calc__more svg { transform: translateX(6px); }

.u-sits__title { margin-bottom: clamp(18px, 3vh, 28px); }
.u-sits__wrap { position: relative; padding-left: 52px; }
.u-sits__line { position: absolute; left: 0; top: 10px; bottom: 10px; width: 40px; height: calc(100% - 20px); overflow: visible; pointer-events: none; }
.u-sits__line line { stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 3 9; stroke-linecap: round; animation: uDash 1.8s linear infinite; }
.u-sits__pin { position: absolute; left: 4px; top: 0; z-index: 2; width: 32px; height: 43px; margin-top: -40px; pointer-events: none; }
.u-sits__pin .pin-ico { width: 32px; height: 43px; color: var(--ink); --pin-house: #fff; filter: drop-shadow(0 6px 8px rgba(38,44,48,.3)); }
.u-sits__list { display: grid; gap: 8px; }
.u-sits__list a { position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr) 22px; align-items: center; gap: 18px; padding: 8px 18px 8px 8px; background: rgba(255,255,255,.55); border-radius: var(--r); color: var(--ink); text-decoration: none; transition: background .35s, transform .45s var(--ease); }
.u-sits__list a:hover, .u-sits__list a:focus-visible, .u-sits__list li.is-on a { background: #fff; transform: translateX(6px); }
.u-sits__dot { position: absolute; left: -38px; top: 50%; width: 14px; height: 14px; margin-top: -7px; background: #fff; border: 3px solid var(--ink); border-radius: 50%; transition: background .3s; }
.u-sits__list li.is-on .u-sits__dot { background: var(--ink); }
.u-sits__img { width: 76px; height: 50px; border-radius: var(--r); }
.u-sits__img img { transition: transform .8s var(--ease); }
.u-sits__list a:hover .u-sits__img img { transform: scale(1.12); }
.u-sits__name { font-family: var(--f-display); font-weight: 800; font-size: 1.25rem; }
.u-sits__list svg:not(.pin-ico) { width: 20px; height: 12px; color: var(--steel-deep); transition: transform .4s var(--ease); }
.u-sits__list a:hover svg { transform: translateX(4px); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .g-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .u-open__grid { grid-template-columns: minmax(0, 1fr) auto; min-height: 0; }
  .u-open__copy { grid-column: 1 / -1; }
  .u-cover { grid-column: 1 / -1; justify-self: start; margin: 8px 0 18px; width: min(calc(100% - 30px), 380px); }
  .u-cover__link { aspect-ratio: auto; height: 250px; }
  .u-word::before { font-size: 7rem; }
  .u-next__grid { grid-template-columns: minmax(0, 1fr); }
  .g-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .u-rail { top: 72px; }
}
@media (max-width: 700px) {
  .u-open__title { font-size: clamp(2.1rem, 9.4vw, 2.6rem); }
  .u-open__line { font-size: 1.06rem; }
  .u-chips--open { gap: 8px; }
  .u-chips--open .u-chip { min-height: 46px; font-size: .96rem; padding: 6px 8px 6px 12px; }
  .u-gloss__head { grid-template-columns: minmax(0, 1fr); }
  .u-find input { width: 100%; }
  .g-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .g-card__term { font-size: 1.25rem; }
  .u-sits__wrap { padding-left: 40px; }
  .u-sits__dot { left: -30px; }
  .u-sits__pin { left: -4px; }
  .u-sits__list a { grid-template-columns: 60px minmax(0, 1fr) 20px; gap: 12px; }
  .u-sits__img { width: 60px; height: 42px; }
  .u-sits__name { font-size: 1.1rem; }
  .u-rail__label { display: none; }
  .g-card__in::before { font-size: 6.5rem; }
  .u-cover { margin: 4px 0 22px; }
  .u-cover__tag { left: auto; right: -14px; bottom: -22px; white-space: nowrap; }
  .u-cover__tag .hand { font-size: 1.35rem; }
  .u-word { padding: 16px 18px 12px; gap: 8px; }
  .u-word__term { font-size: 1.4rem; }
  .u-word__text { font-size: .95rem; }
}
