/* Breaditorial: the site's shared look, taken from the app.
   Colours, fonts, the wordmark and the two rules (chosen = yolk, press to act =
   ink with a yolk label) are the app's own. Dark mode follows the device, as the
   app does. Every page links this file first. */

/* The app's own Fraunces cuts (SIL Open Font Licence), one per optical size. */
@font-face { font-family: "Fraunces 36"; src: url("/fonts/fraunces-36-semibold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces 36"; src: url("/fonts/fraunces-36-semibold-italic.woff2") format("woff2"); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: "Fraunces 72"; src: url("/fonts/fraunces-72-semibold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces 144"; src: url("/fonts/fraunces-144-semibold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces Text"; src: url("/fonts/fraunces-text-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  /* The icon's yellow. A whole ground, not a small accent. */
  --yolk: #FBC800;
  /* Type and rules on the page. */
  --ink: #111010;
  --ink-2: #4F4A43;
  --muted: #6A645A;
  --rule: rgba(17, 16, 16, 0.18);
  /* Reading ground: near-white, never cream. */
  --page: #FAF7F0;
  /* Black areas (bands, the action bar, solid buttons). */
  --ink-fill: #242321;
  --ink-fill-pressed: #302E2B;
  --on-ink: #FAF7F0;
  --muted-on-ink: #B5AEA1;
  --rule-on-ink: rgba(250, 247, 240, 0.2);
  /* The big yellow areas: yolk by day; at night the dark ground with the
     yellow moved into the type, as in the app. */
  --ground: #FBC800;
  --on-ground: #111010;
  --ground-muted: #4A3C00;
  --ground-rule: rgba(17, 16, 16, 0.3);
  --wordmark-on-ground: #202020;
  --wordmark-on-page: #202020;

  --serif-s: "Fraunces 36", Georgia, "Times New Roman", serif;
  --serif-m: "Fraunces 72", "Fraunces 36", Georgia, serif;
  --serif-l: "Fraunces 144", "Fraunces 72", Georgia, serif;
  --serif-text: "Fraunces Text", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  /* Japanese headings: the bold system face, as the app's Japanese page titles. */
  --ja-display: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;

  --gutter: 24px;
  --column: 1180px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F1ECE3;
    --ink-2: #CFC8BC;
    --muted: #A9A296;
    --rule: rgba(241, 236, 227, 0.18);
    --page: #242321;
    --ink-fill: #363431;
    --ink-fill-pressed: #423F3B;
    --ground: #2C2A27;
    --on-ground: #FBC800;
    --ground-muted: #A9A296;
    --ground-rule: rgba(241, 236, 227, 0.2);
    --wordmark-on-ground: #FBC800;
    --wordmark-on-page: #F1ECE3;
    color-scheme: dark;
  }
}
/* The same, when the visitor chooses dark on the site. */
:root[data-theme="dark"] {
  --ink: #F1ECE3;
  --ink-2: #CFC8BC;
  --muted: #A9A296;
  --rule: rgba(241, 236, 227, 0.18);
  --page: #242321;
  --ink-fill: #363431;
  --ink-fill-pressed: #423F3B;
  --ground: #2C2A27;
  --on-ground: #FBC800;
  --ground-muted: #A9A296;
  --ground-rule: rgba(241, 236, 227, 0.2);
  --wordmark-on-ground: #FBC800;
  --wordmark-on-page: #F1ECE3;
  color-scheme: dark;
}


*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, video, svg { display: block; max-width: 100%; }
p, h1, h2, h3, h4 { margin: 0; }
/* No one-word last lines, anywhere. */
p, li, h1, h2, h3, h4, .t, .d { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }

a { color: inherit; }
/* An action in running text: underlined, like the app's links. */
.link {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
.link:hover { text-decoration-thickness: 2.5px; }
:focus-visible { outline: 2.5px solid var(--yolk); outline-offset: 3px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* One column, the app's 24pt margin on phones. */
.wrap { width: 100%; max-width: calc(var(--column) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 900px) { :root { --gutter: 48px; } }

/* Japanese: the app's display face for headings, the system font for text. */
:lang(ja) .serif, :lang(ja) h1, :lang(ja) h2, :lang(ja) h3 { font-family: var(--ja-display); letter-spacing: 0.01em; font-weight: 700; }

/* Show the visitor's language only (set on <html lang>). */
html[lang="ja"] .l-en, html:not([lang="ja"]) .l-ja { display: none !important; }

/* The wordmark: the app's traced vector, coloured by CSS. */
.wordmark {
  display: block;
  aspect-ratio: 1474 / 319;
  background: currentColor;
  -webkit-mask: url("/images/brand/wordmark.svg") center / contain no-repeat;
  mask: url("/images/brand/wordmark.svg") center / contain no-repeat;
}

/* ── Top bar: language and the two reading sections ───────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; font-size: 15px; }
.topbar nav { display: flex; gap: 22px; flex-wrap: wrap; }
.topbar a { text-decoration: none; font-weight: 600; }
.topbar a:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.topbar .home { width: 132px; color: var(--wordmark-on-page); }
.lang { display: flex; align-items: center; gap: 4px; }
.lang button {
  font: inherit; font-weight: 600; color: inherit; background: none; border: 0;
  padding: 6px 8px; cursor: pointer; opacity: 0.55;
}
.lang button[aria-current="true"] { opacity: 1; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
/* Press to act: ink with a yolk label, the text centred, never touching an edge. */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 26px;
  background: var(--ink-fill); color: var(--yolk);
  font: 600 17px/1.2 var(--sans); text-decoration: none; text-align: center;
}
.btn:hover { background: var(--ink-fill-pressed); }
.badge { display: inline-block; line-height: 0; }
.badge img { height: 52px; width: auto; }

/* The round go button: the native back button's circle, pointing forward. */
.go {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--on-ink); color: #111010;
  display: grid; place-items: center; padding-left: 2px;
}
.go svg { width: 12px; height: 20px; }

/* ── The action bar (phones): the app's Make bread strip ─────────────── */
.strip {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: calc(64px + env(safe-area-inset-bottom));
  padding: 0 var(--gutter) env(safe-area-inset-bottom);
  background: var(--ink-fill); color: var(--yolk);
  font: 600 19px/1.2 var(--sans); letter-spacing: -0.2px; text-decoration: none;
  transform: translateY(110%); transition: transform 0.28s ease;
}
.strip:hover { background: var(--ink-fill-pressed); }
.strip.on { transform: none; }
@media (min-width: 900px) { .strip { display: none; } }
@media (prefers-reduced-motion: reduce) { .strip { transition: none; } }

/* ── Footer: the off-black band with the yolk wordmark ──────────────── */
.site-footer { background: var(--ink-fill); color: var(--on-ink); padding: 56px 0 calc(48px + env(safe-area-inset-bottom)); }
.site-footer .wordmark { width: 168px; color: var(--yolk); }
.site-footer .foot-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px; margin-top: 28px; padding-top: 20px; border-top: 1.5px solid var(--rule-on-ink); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 15px; font-weight: 600; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 4px; }
.site-footer .copy { font-size: 14px; color: var(--muted-on-ink); }
@media (max-width: 899px) { .site-footer { padding-bottom: calc(112px + env(safe-area-inset-bottom)); } }

/* Japanese headings break only between phrases (Safari has no auto-phrase).
   A phrase longer than a line still wraps inside itself. */
.p { display: inline-block; }
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3 { word-break: auto-phrase; }

/* ── Motion ──────────────────────────────────────────────────────────
   One easing curve everywhere: fast off the mark, a long soft landing.
   Only under html.motion (Reduce Motion leaves the page still). */
:root { --ease: cubic-bezier(0.16, 1, 0.3, 1); --ease-ios: cubic-bezier(0.32, 0.72, 0, 1); }

.motion [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  transition: opacity 0.9s var(--ease) var(--d, 0ms), transform 1.1s var(--ease) var(--d, 0ms), translate 0.5s var(--ease) 0s, box-shadow 0.5s var(--ease) 0s, background-size 0.55s var(--ease) 0s, color 0.3s ease 0s;
}
.motion [data-reveal].in { opacity: 1; transform: none; }

/* A ruled line that draws itself across, left to right. */
.motion [data-rule] { position: relative; border-top-color: transparent !important; }
.motion [data-rule]::after {
  content: ""; position: absolute; left: 0; right: 0; top: -1.5px;
  border-top: 1.5px solid var(--rule-color, var(--ink));
  transform: scaleX(0); transform-origin: left center;
  transition: transform 1.3s var(--ease) var(--d, 0ms);
  pointer-events: none;
}
.motion [data-rule].in::after { transform: none; }

/* If the script never runs, show everything after a moment. */
.motion:not(.motion-ready) [data-reveal], .motion:not(.motion-ready) [data-rule]::after { animation: show-anyway 0s linear 2.5s forwards; }
@keyframes show-anyway { to { opacity: 1; transform: none; } }

/* Fills that sweep across under the pointer, like a finger drawing a highlight. */
.sweep, .row, .cal-card, .related a {
  background-image: linear-gradient(var(--yolk), var(--yolk));
  background-repeat: no-repeat; background-position: left center;
  background-size: 0% 100%;
  transition: background-size 0.55s var(--ease), color 0.3s ease;
}
.sweep:hover, .row:hover, .cal-card:hover, .related a:hover { background-size: 100% 100%; }
@media (prefers-reduced-motion: reduce) {
  .sweep, .row, .cal-card, .related a { transition: none; }
}
