/* Home: hero with the translator, timing, the app stage, guides, questions. */
.hero { padding-block: clamp(20px, 5vw, 64px) 0; }
.hero .wrap { display: grid; gap: 20px; }
.hero .lede { max-width: 640px; }

/* The period of the headline is a yellow dot: it drops in, bounces, and stretches into a dash once. */
.period { position: relative; display: inline-block; width: 0.17em; height: 0.17em; margin-left: 0.05em; transform-origin: 50% 100%; animation: period-drop 1.1s 0.15s both; }
.period::after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; border-radius: 0.085em; background: var(--y); animation: period-dash 0.95s var(--ease) 1.45s both; }
@keyframes period-drop {
  0% { transform: translateY(-1.9em); opacity: 0; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  8% { opacity: 1; }
  42% { transform: translateY(0) scale(1.42, 0.6); animation-timing-function: cubic-bezier(0, 0.55, 0.45, 1); }
  64% { transform: translateY(-0.42em) scale(0.92, 1.1); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  82% { transform: translateY(0) scale(1.2, 0.82); animation-timing-function: var(--spring); }
  100% { transform: none; opacity: 1; }
}
@keyframes period-dash { 0%, 100% { width: 100%; } 40%, 62% { width: 300%; } }

/* Translator panel */
.tool { display: grid; gap: 16px; margin-top: 6px; padding: clamp(16px, 2.4vw, 26px); border-radius: var(--r-panel); background: var(--panel); box-shadow: var(--shadow); }
.tool-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.seg { display: inline-flex; padding: 4px; border-radius: 16px; background: var(--fill); }
.seg button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 12px; background: none; font-size: 15px; font-weight: 600; color: var(--sec); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); }
.alpha { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--sec); }
.alpha select { min-height: 40px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--fill); font-size: 15px; font-weight: 600; color: var(--ink); }
.source { position: relative; }
.source textarea {
  display: block; width: 100%; min-height: 64px; max-height: 240px; padding: 6px 52px 6px 2px;
  border: 0; outline: 0; resize: none; background: none; font-size: clamp(22px, 2.6vw, 28px); line-height: 1.3;
  field-sizing: content;
}
.source textarea::placeholder { color: var(--ter); }
.source:focus-within { box-shadow: 0 2px 0 var(--ink); }
.clear { position: absolute; right: 0; top: 6px; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--fill); cursor: pointer; }
.clear svg { width: 18px; height: 18px; }
.output { min-height: 92px; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 92px; margin: 0; color: var(--sec); font-size: 15px; }
.examples button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--fill); font-size: 15px; font-weight: 600; cursor: pointer; }
.notes { margin: 0; font-size: 15px; color: var(--sec); }
.notes:empty { display: none; }
.result { display: flex; align-items: center; gap: 12px; min-height: 40px; padding-top: 14px; border-top: 1px solid var(--line); }
.result-label { flex: none; font-size: 15px; font-weight: 600; }
.result-text { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 15px; color: var(--sec); overflow-wrap: anywhere; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.speed { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; color: var(--sec); }
.speed input { width: 120px; accent-color: var(--ink); }
.speed output { min-width: 62px; font-variant-numeric: tabular-nums; color: var(--ink); }
.controls .lamp { margin-left: auto; }

/* Sections */
.section { margin-top: clamp(88px, 12vw, 150px); }
.section-head { display: grid; gap: 14px; max-width: 760px; }
.reveal.pending { opacity: 0; transform: translateY(28px); }
.reveal.shown { opacity: 1; transform: none; transition: opacity 0.7s var(--ease), transform 0.9s var(--spring); }

/* Timing ruler: one unit is one cell */
.timing .wrap { display: grid; gap: 40px; align-items: start; }
.ruler { --cell: 22px; display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; }
.ruler li { display: grid; gap: 8px; }
.ruler .what { font-size: 17px; font-weight: 600; }
.ruler .what span { font-weight: 400; color: var(--sec); }
.track { position: relative; display: flex; align-items: center; height: 30px; padding-left: 0; background-image: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px var(--cell)); background-size: auto 8px; background-repeat: repeat-x; background-position: 0 100%; }
.track i { display: block; flex: none; height: 14px; border-radius: 7px; background: var(--ink); }
.track i.u1 { width: var(--cell); } .track i.u3 { width: calc(var(--cell) * 3); }
.track b { display: block; flex: none; height: 14px; border-radius: 4px; background: var(--fill); box-shadow: inset 0 0 0 1.5px var(--line); }
.track b.u1 { width: var(--cell); } .track b.u3 { width: calc(var(--cell) * 3); } .track b.u7 { width: calc(var(--cell) * 7); }
.ruler.shown i, .ruler.shown b { animation: mark-in 0.5s var(--ease) both; transform-origin: left center; }
.ruler li:nth-child(2) { --r: 1; } .ruler li:nth-child(3) { --r: 2; } .ruler li:nth-child(4) { --r: 3; } .ruler li:nth-child(5) { --r: 4; }
.ruler.shown i, .ruler.shown b { animation-delay: calc(var(--r, 0) * 140ms + var(--k, 0) * 90ms); }
.track > :nth-child(2) { --k: 1; } .track > :nth-child(3) { --k: 2; }
.timing .note { font-size: 15px; color: var(--sec); }

/* App stage: three phones on a tilted plane that straightens on scroll */
.app-head { display: grid; gap: 18px; justify-items: start; }
.stage { --p: 1; margin-top: 56px; perspective: 1800px; }
.plane { display: flex; justify-content: center; align-items: flex-end; gap: clamp(18px, 4vw, 56px); transform-origin: 50% 100%; transform: rotateX(calc((1 - var(--p)) * 30deg)) translateY(calc((1 - var(--p)) * 90px)) scale(calc(0.86 + var(--p) * 0.14)); }
.plane .side { transform: translateY(calc(36px + (1 - var(--p)) * 60px)); }

/* Guides and questions */
.guide-list { display: grid; margin: 32px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.guide-list a { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 20px; padding: 22px 4px; border-bottom: 1px solid var(--line); text-decoration: none; }
.guide-list b { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.guide-list span { grid-column: 1; color: var(--sec); }
.guide-list svg { grid-row: 1 / span 2; grid-column: 2; width: 24px; height: 24px; transition: transform 0.25s var(--spring); }
.guide-list a:hover svg { transform: translateX(6px); }
.faq { display: grid; gap: 28px; margin-top: 32px; }
.faq p { margin: 8px 0 0; color: var(--sec); }

@media (min-width: 761px) {
  .plane > :first-child { order: 2; }
  .plane > :nth-child(3) { order: 3; }
}
@media (min-width: 900px) {
  .timing .wrap { grid-template-columns: 5fr 6fr; gap: 64px; }
  .faq { grid-template-columns: 1fr 1fr; gap: 36px 56px; }
}
@media (max-width: 760px) {
  .plane { justify-content: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; padding: 12px var(--gutter) 40px; scrollbar-width: none; }
  .plane::-webkit-scrollbar { display: none; }
  .plane > * { scroll-snap-align: center; }
  .plane .side { transform: none; }
  .controls .lamp { margin-left: 0; }
  .ruler { --cell: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .period, .period::after { animation: none; }
  .reveal.pending { opacity: 1; transform: none; }
  .ruler.shown i, .ruler.shown b { animation: none; }
}
