/*
  The first screen: one recipe going from a screenshot, through Simu, into C1.

  Everything the animation shows is in the HTML from the start, finished: the
  caption, the fourteen settings and the written slot. Without script, or with
  Reduce Motion, the reader (and a search engine) gets that finished state.
  hero.js adds .js-hero to <html> and then plays the three steps; the classes
  it sets (.on, data-step, data-state) only ever hide things until their turn.

  The photograph and its recipe are the owner's: an X100VI frame from Tokyo,
  and the values its maker note recorded. Nothing here is somebody else's post.
*/

.intro { position: relative; padding: 2.6rem 0 3.2rem; overflow: hidden; }
.intro::before {
  content: ""; position: absolute; inset: -10% -10% auto; height: 90%; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 55% 50% at 50% 20%, var(--glow), transparent 70%);
}
.intro-head { text-align: center; }
.intro .eyebrow { color: var(--dim); font: 600 .9rem/1 var(--sans); letter-spacing: 0; text-transform: none; }
.intro .eyebrow .mark { width: 1.35rem; height: 1.35rem; }
.intro .display { font-size: clamp(1.9rem, 5.6vw, 3.4rem); margin-bottom: 0; }
/* The explanation and the buttons come after the stage: what Simu does is
   shown first and said second. */
.intro-foot { text-align: center; margin-top: 2.2rem; }
.intro .lede { margin-bottom: 1.6rem; }
.intro .actions { justify-content: center; }
@media (max-width: 899.98px) {
  /* The bar already names Simu; on a phone its line goes to the stage. */
  .intro { padding-top: 1rem; }
  .intro .eyebrow { display: none; }
}

/* ---------- The three steps, as buttons ---------- */
.steps { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin: 1.2rem 0 .9rem; padding: 0; list-style: none; }
.steps button {
  display: inline-flex; align-items: center; gap: .45rem; border: 0; cursor: pointer;
  font: 600 .88rem/1 var(--sans); color: var(--dim); background: var(--control);
  padding: .55rem .9rem; border-radius: 999px; min-height: 2.4rem;
  transition: background-color .2s ease-out, color .2s ease-out;
}
.steps button b { font: 800 .72rem/1 var(--mono); }
.steps button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
/* The steps only switch panes where the panes are stacked in one place. */
@media (min-width: 900px) { .steps { display: none; } }

/* ---------- The stage ---------- */
.stage {
  display: grid; gap: 1rem; justify-content: center; align-items: start;
  grid-template-columns: minmax(0, 20rem);
}
@media (min-width: 900px) {
  .stage { grid-template-columns: repeat(3, minmax(0, 19rem)); gap: 2.6rem; margin-top: 2.6rem; }
  /* An arrow between panes: the direction the recipe travels. */
  .pane:not(:last-child)::after {
    content: ""; position: absolute; top: 9rem; right: -1.75rem; width: .7rem; height: .7rem;
    border: solid var(--faint); border-width: 2px 2px 0 0; transform: rotate(45deg);
  }
}
.pane { position: relative; min-width: 0; margin: 0; }
.pane-label { margin: 0 0 .55rem .2rem; color: var(--dim); font-size: .82rem; font-weight: 600; }
.pane-label b { font: 800 .72rem/1 var(--mono); color: var(--accent-text); margin-right: .35rem; }

/* 1. The screenshot: a post, drawn as a phone would show it. Always light, as a
   screenshot is whatever the poster's phone was set to. */
.shot {
  position: relative; overflow: hidden; border-radius: 22px; background: #fff; color: #111;
  box-shadow: 0 0 0 .5px rgba(0,0,0,.14), 0 18px 48px rgba(0,0,0,.16); color-scheme: light;
}
.shot-head { display: flex; align-items: center; gap: .55rem; padding: .7rem .85rem; font-size: .85rem; }
.shot-head .avatar { width: 1.8rem; height: 1.8rem; border-radius: 50%; flex: none;
                     background: linear-gradient(135deg, #41626b, #c59a23); }
.shot-head strong { font-weight: 650; }
.shot-head span { color: #8a8a8e; margin-left: auto; font-size: .78rem; }
.shot picture, .shot img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; }
.shot-text { margin: 0; padding: .75rem .9rem 1rem; font-size: .86rem; line-height: 1.55; }
.shot-text .ln { display: block; }
.shot-text .ln.lead { margin-bottom: .2rem; }
.shot-text .ln:not(.lead) { font-variant-numeric: tabular-nums; }

/* Where each value was read, outlined as the app outlines it. At rest these
   are the boxes of "Where each value was read" (1.2 pt, 3 pt corners); while
   playing they are the import's (1.5 pt, 4 pt corners, 0.9 opacity), shown
   all at once, held, then let go as the values leave (DevelopingOverlay). */
.rd { white-space: nowrap; border-radius: 3px; outline: 1.2px solid var(--accent); outline-offset: 1.5px;
      transition: outline-color .7s ease-in-out; }
.js-hero .stage[data-playing] .rd { outline: 1.5px solid transparent; outline-offset: 3px; border-radius: 4px; }
.js-hero .stage[data-playing="exposed"] .rd { outline-color: rgba(255, 149, 0, .9); transition-duration: .25s; }

/* A value in flight: the row's own type on the surface, as the import's chip. */
.chip { position: absolute; left: 0; top: 0; z-index: 30; pointer-events: none; margin: 0;
        font: .88rem/1.35 var(--mono); color: var(--ink); white-space: nowrap;
        padding: 2px 6px; border-radius: 6px; background: var(--surface);
        box-shadow: 0 0 0 1px var(--hairline); transform-origin: 0 0; will-change: transform, opacity; }

/* 2. The recipe, as Simu shows it: the share card's paper. */
.recipe.paper { padding: 1.1rem 1.15rem 1.2rem; border-radius: 16px; }
.recipe h2 { font: 700 1.3rem/1.2 var(--sans); margin: 0 0 .15rem; }
.recipe .kind { margin-bottom: .9rem; }
.recipe .cells { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem .9rem; }
.recipe .cells dd { font-size: .88rem; }
.recipe .cells dd { transition: opacity .2s ease-out; }
.recipe .film { grid-column: 1 / -1; }
.recipe .film dd { font: 700 1.05rem/1.3 var(--sans); }
/* The rows are there from the start; each shows its value when the value lands. */
.js-hero .stage[data-playing] .recipe .cells > div:not(.on) dd { opacity: 0; }
.recipe .verified { display: flex; align-items: center; gap: .4rem; margin: 1rem 0 0; font-size: .8rem; color: var(--paper-muted); }
.recipe .verified::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: #008f7a; }

/* 3. The camera, as Simu's camera sheet lists it. The camera's own screen is
   dark while it is connected, and its lamp blinks green, so the drawing shows
   the phone's list rather than a menu on the camera. */
.camera { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow), 0 0 0 .5px var(--hairline); padding: .9rem 1rem 1rem; }
.camera-head { display: flex; align-items: center; gap: .55rem; margin-bottom: .7rem; }
.camera-head strong { font-size: 1.02rem; }
.camera-head span { margin-left: auto; color: var(--dim); font-size: .8rem; display: inline-flex; align-items: center; gap: .35rem; }
.lamp { width: .5rem; height: .5rem; border-radius: 50%; background: #30d158; }
.js-hero .lamp { animation: lamp 1.2s steps(2, jump-none) infinite; }
@keyframes lamp { 50% { opacity: .25; } }
.slots { list-style: none; margin: 0; padding: 0; }
.slots li { display: flex; align-items: center; gap: .6rem; padding: .48rem 0; font-size: .9rem; min-height: 2.4rem; }
.slots li + li { border-top: .5px solid var(--hairline); }
.slots li > span:nth-child(2) { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slots .c1 { position: relative; flex-wrap: wrap; }
.slots .c1 .name { color: var(--ink) !important; font-weight: 650; }
.slots .c1 .was { display: none; }
.progress { flex-basis: 100%; height: 3px; border-radius: 2px; background: var(--control); overflow: hidden; display: none; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 1s linear; }
.status { flex-basis: 100%; font-size: .8rem; color: var(--dim); }
.status .st { display: none; }
.status .st-done { display: inline; color: var(--success); font-weight: 600; }

/* The slot's states while playing; the default above is the finished write. */
.js-hero .stage[data-playing] .c1 .name { display: none; }
.js-hero .stage[data-playing] .c1 .was { display: inline; }
.js-hero .stage[data-playing] .c1[data-state="write"] .name,
.js-hero .stage[data-playing] .c1[data-state="verify"] .name,
.js-hero .stage[data-playing] .c1[data-state="done"] .name { display: inline; }
.js-hero .stage[data-playing] .c1[data-state="write"] .was,
.js-hero .stage[data-playing] .c1[data-state="verify"] .was,
.js-hero .stage[data-playing] .c1[data-state="done"] .was { display: none; }
.js-hero .stage[data-playing] .c1:not([data-state="done"]) .progress { display: block; }
.js-hero .stage[data-playing] .c1[data-state="write"] .progress i,
.js-hero .stage[data-playing] .c1[data-state="verify"] .progress i { width: 100%; }
.js-hero .stage[data-playing] .status .st-done { display: none; }
.js-hero .stage[data-playing] .c1[data-state="idle"] .st-idle,
.js-hero .stage[data-playing] .c1[data-state="backup"] .st-backup,
.js-hero .stage[data-playing] .c1[data-state="write"] .st-write,
.js-hero .stage[data-playing] .c1[data-state="verify"] .st-verify { display: inline; }
.js-hero .stage[data-playing] .c1[data-state="done"] .st-done { display: inline; }
.c1[data-state="done"] { animation: settle .5s ease-out; }
@keyframes settle { 0% { background: var(--glow); } 100% { background: transparent; } }

.replay { display: block; margin: 1.4rem auto 0; }
.stage-note { text-align: center; color: var(--dim); font-size: .85rem; margin: 1.6rem auto 0; max-width: 40rem; text-wrap: balance; }

/* ---------- Narrow: the three panes take turns in one place ---------- */
@media (max-width: 899.98px) {
  /* Every pane takes the height of the tallest, so the page does not move
     under the reader's thumb as the steps change. The photograph is squared
     to keep the screenshot, and so the stage, within a phone's first screen. */
  .js-hero .stage { grid-template-columns: minmax(0, 20rem); align-items: stretch; }
  .js-hero .stage > .pane { display: flex; flex-direction: column; }
  .js-hero .stage > .pane > :last-child:not(figcaption), .js-hero .shot { flex: 1; }
  .js-hero .shot picture { aspect-ratio: auto; }
  .js-hero .shot img { aspect-ratio: 1; object-position: 50% 30%; }
  .js-hero .shot-head { padding: .55rem .8rem; }
  .js-hero .shot-text { font-size: .8rem; line-height: 1.5; padding: .6rem .85rem .8rem; }
  /* Panes fade as the import fades its screenshot: 0.7 s, ease-in-out. */
  .js-hero .stage > .pane { grid-area: 1 / 1; transition: opacity .7s ease-in-out, visibility 0s; }
  .js-hero .stage > .pane:not(.active) { opacity: 0; pointer-events: none; visibility: hidden; transition: opacity .7s ease-in-out, visibility 0s .7s; }
  .js-hero .pane-label { display: none; }
}
/* Wide: all three stay in view; the one not yet reached waits faintly. */
@media (min-width: 900px) {
  .js-hero .stage[data-playing] > .pane { transition: opacity .4s ease-out; }
  .js-hero .stage[data-playing] > .pane:not(.reached) { opacity: .28; }
}

@media (prefers-reduced-motion: reduce) {
  .js-hero .stage > .pane, .recipe .cells dd, .progress i, .rd { transition: none !important; }
  .js-hero .lamp, .c1[data-state="done"] { animation: none; }
}

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* Japanese and Korean headlines run longer in characters than the Chinese
   ones; on a phone they take a size that keeps them to two lines. */
@media (max-width: 480px) {
  :lang(ja) .intro .display, :lang(ko) .intro .display { font-size: 1.62rem; }
}
