/* egatari.org — variant A「藍」. One stylesheet, no third-party requests.
   The logo's indigo (#4A488E) carries headings, buttons and links; the sun
   red (#D3381C) appears only in the logo and as the play-head dot under the
   hero slide. Light ground, like a lesson in the default 藍 theme.
   Contrast (WCAG 2.x), light: ink/white 16.4, muted/white 7.9, indigo/white 8.05,
   indigo/alt 7.4, white on indigo 8.05. Dark: ink 15.3, muted 9.2,
   indigo-light/ground 8.8, ground on indigo-light 8.8. */

@font-face {
  font-family: "Shippori Mincho B1";
  src: url("/assets/fonts/shippori-mincho-b1-800.woff2") format("woff2");
  font-weight: 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "BIZ UDPGothic";
  src: url("/assets/fonts/biz-udpgothic-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "BIZ UDPGothic";
  src: url("/assets/fonts/biz-udpgothic-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  color-scheme: light dark;
  --ground: #FFFFFF;
  --ground-alt: #F4F5FA;
  --ink: #1E1E2C;
  --muted: #4F5060;
  --line: #DCDDE8;
  --brand: #4A488E;
  --brand-strong: #3B3976;
  --on-brand: #FFFFFF;
  --brand-wash: #EDEDF6;
  --sun: #D3381C;
  --screen: #2A2A3A;
  --screen-edge: #3A3A4E;
  --card: #F4F5FA;
  --code: #F4F5FA;
  --code-ink: #1E1E2C;
  --focus: #4A488E;
  --shadow: 0 1px 2px rgb(30 30 60 / .08), 0 10px 30px rgb(30 30 60 / .10);
  --shadow-screen: 0 2px 4px rgb(30 30 60 / .12), 0 28px 60px rgb(30 30 60 / .20);
  --font-display: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --font-body: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --gutter: clamp(1rem, 5vw, 4rem);
  --measure: 38em;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #12121A;
    --ground-alt: #1A1A25;
    --ink: #E8E8F0;
    --muted: #B4B5C4;
    --line: #34344A;
    --brand: #A9ABFA;
    --brand-strong: #C3C4FF;
    --on-brand: #12121A;
    --brand-wash: #1E1E33;
    --sun: #F2573B;
    --screen: #2C2C40;
    --screen-edge: #44445E;
    --card: #1A1A25;
    --code: #0B0B12;
    --code-ink: #E8E8F0;
    --focus: #A9ABFA;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 30px rgb(0 0 0 / .45);
    --shadow-screen: 0 2px 4px rgb(0 0 0 / .4), 0 28px 60px rgb(0 0 0 / .55);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.85;
  overflow-wrap: anywhere; line-break: strict;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: 1rem; top: -4rem; z-index: 10; background: var(--brand); color: var(--on-brand); padding: .5rem 1rem; }
.skip:focus { top: 1rem; }
.wrap { max-width: 76rem; margin: 0 auto; padding: 0 var(--gutter); }

/* Notice band: a quiet indigo wash, not a coloured strip */
.notice {
  background: var(--brand-wash); color: var(--ink);
  font-size: 1rem; line-height: 1.6; text-align: center;
  padding: .55rem var(--gutter); margin: 0;
}
.notice a { font-weight: 700; margin-left: .5em; white-space: nowrap; }
.notice-lang { border-bottom: 1px solid var(--line); }
.notice-close { font: inherit; font-size: 1.25rem; line-height: 1; margin-left: .75em; padding: .1em .45em; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.notice-close:hover, .notice-close:focus-visible { color: var(--ink); background: var(--line); }

/* Header */
.site-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 700; font-size: 1.25rem; letter-spacing: .02em; color: var(--brand); }
.brand img { width: 44px; height: 44px; }
.site-nav { display: flex; gap: 1.5rem; font-size: 1rem; }
.site-nav a { text-decoration: none; color: var(--ink); font-weight: 700; }
.site-nav a:hover { color: var(--brand); text-decoration: underline; }
/* Narrow phones: names never break inside a word; the nav moves under the brand if it must */
.site-head { flex-wrap: wrap; }
.brand, .site-nav a { white-space: nowrap; }
.site-nav { flex-wrap: wrap; row-gap: .25rem; }
@media (max-width: 30rem) { .site-nav { column-gap: 1.1rem; } }

/* Hero: light. The lesson sits large on a "screen" with a player bar. */
.hero { background: var(--ground-alt); border-bottom: 1px solid var(--line); }
.hero .wrap { padding-bottom: clamp(3rem, 7vw, 5.5rem); }
.hero-grid { display: grid; gap: clamp(2.25rem, 4vw, 3.5rem); align-items: center; padding-top: clamp(1.5rem, 4vw, 3.5rem); }
@media (min-width: 64rem) { .hero-grid { grid-template-columns: minmax(0, .8fr) minmax(0, 1.55fr); } }
.headline {
  font-family: var(--font-display); font-weight: 700; color: var(--brand);
  font-size: clamp(2.5rem, 4.2vw, 4rem); line-height: 1.3; letter-spacing: .01em; margin: 0;
}
.headline span { display: block; white-space: nowrap; }
/* /en/: the English phrases are longer than the Japanese ones. They may wrap on
   phones, and on desktop the text column is wider and the headline a little smaller. */
.headline:lang(en) span { white-space: normal; }
@media (min-width: 64rem) {
  .hero-grid:lang(en) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
  .headline:lang(en) { font-size: clamp(2.5rem, 3.3vw, 3.5rem); }
}
.headline .accent { color: var(--ink); }
.lead { font-size: clamp(1.125rem, 1.4vw, 1.25rem); color: var(--muted); margin: 1.25rem 0 0; }

.hero-visual {
  margin: 0; position: relative;
  background: var(--screen); border: 1px solid var(--screen-edge);
  border-radius: 14px; padding: clamp(8px, 1vw, 14px) clamp(8px, 1vw, 14px) 2.4rem;
  box-shadow: var(--shadow-screen);
}
.hero-visual img { border-radius: 4px; }
/* player bar: track, played part in indigo-light, sun-red play head */
.hero-visual::before {
  content: ""; position: absolute; left: 1.25rem; right: 1.25rem; bottom: 1.05rem; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, #A9ABFA 0 34%, rgb(255 255 255 / .22) 34%);
}
.hero-visual::after {
  content: ""; position: absolute; bottom: calc(1.05rem - 5px); left: calc(1.25rem + (100% - 2.5rem) * .34 - 7px);
  width: 14px; height: 14px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 0 3px rgb(211 56 28 / .25);
}

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3.25rem; padding: .7rem 1.6rem; border-radius: 8px;
  font-weight: 700; font-size: 1.0625rem; text-decoration: none; line-height: 1.3;
  border: 2px solid transparent;
}
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-secondary { border-color: var(--brand); color: var(--brand); background: var(--ground); }
.btn-secondary:hover { background: var(--brand-wash); }

/* Sections: a small label above the heading, like a lesson's heading band */
.sec { padding-block: clamp(3rem, 6vw, 5rem); }
.sec:nth-of-type(even) { background: var(--ground-alt); }
.sec-grid { display: block; }
.num {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--font-body); font-weight: 700; font-size: 1rem; line-height: 1;
  color: var(--brand); letter-spacing: .08em; margin: 0 0 1rem;
}
.num::before { content: ""; width: 1.75rem; height: 4px; border-radius: 2px; background: var(--brand); }
.sec h2, .page-title {
  font-family: var(--font-display); font-weight: 700; color: var(--brand);
  font-size: clamp(1.625rem, 3.4vw, 2.5rem); line-height: 1.45; letter-spacing: .01em;
  margin: 0 0 1.25rem;
}
.sec p { max-width: var(--measure); margin: 0 0 1rem; }
.sec-body > :last-child { margin-bottom: 0; }

/* Sections 01–04: the text beside a real screenshot of the software.
   Desktop: two columns, the text on the left in 01 and 03, on the right in
   02 and 04 (.flip). Phones: stacked, text first. The screenshot sits in a
   light frame, the daylight sibling of the hero's player frame. Every <img>
   carries width and height, so nothing shifts while it loads. */
.sec-media { display: grid; gap: clamp(2rem, 4vw, 3.5rem); align-items: center; }
.sec-text { min-width: 0; }
.shot {
  margin: 0; min-width: 0;
  background: var(--ground); border: 1px solid var(--line);
  border-radius: 14px; padding: clamp(6px, .8vw, 12px);
  box-shadow: var(--shadow);
}
.shot img { width: 100%; border-radius: 6px; }
.shot figcaption { font-size: 1rem; line-height: 1.6; color: var(--muted); margin: .7rem .25rem .1rem; }
@media (min-width: 64rem) {
  .sec-media { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
  .sec-media.flip { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
  .sec-media.flip .sec-text { order: 2; }
  .sec-media.flip.phone { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  /* 02: three frames in a row are too small beside the text, so the strip
     takes the full width under it; the text keeps its place on the right. */
  .sec-media.wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .sec-media.wide .sec-text { grid-column: 2; order: 0; }
  .sec-media.wide .shot { grid-column: 1 / -1; }
}
.sec-media.phone .shot { max-width: 34rem; width: 100%; justify-self: center; }

/* areas */
.areas { list-style: none; padding: 0; margin: 2.25rem 0 0; display: grid; gap: 1.5rem; }
@media (min-width: 48rem) { .areas { grid-template-columns: repeat(3, 1fr); } }
.area a { display: block; text-decoration: none; color: var(--ink); background: var(--ground); border: 1px solid var(--line); border-radius: 12px; padding: .75rem .75rem 1.1rem; height: 100%; }
.area a:hover { border-color: var(--brand); }
.area img { border-radius: 6px; aspect-ratio: 16 / 9; object-fit: cover; width: 100%; border: 1px solid var(--line); }
.area-name { font-family: var(--font-display); font-weight: 700; font-size: 1.375rem; display: block; margin-top: .9rem; color: var(--brand); }
.area-name::after { content: " →"; }
.area-desc { color: var(--muted); display: block; }
.area a:hover .area-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em; }

.links { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; gap: .75rem 2rem; }
.links a { font-weight: 700; }

/* routes */
.routes { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 1.5rem; }
@media (min-width: 48rem) { .routes { grid-template-columns: 1fr 1fr; } .routes li:last-child { grid-column: 1 / -1; } }
.routes li { background: var(--ground); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: 10px; padding: 1.1rem 1.25rem 1.25rem; min-width: 0; }
.routes h3 { font-size: 1.1875rem; margin: 0 0 .5rem; line-height: 1.5; }
.routes p { margin: 0 0 .75rem; }
.routes p:last-child { margin-bottom: 0; }
.code {
  background: var(--code); color: var(--code-ink); border: 1px solid var(--line); border-radius: 8px;
  padding: 1rem 1.1rem; margin: 0; overflow-x: auto;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1rem; line-height: 1.8;
}
.code code { white-space: pre; }

.closing { background: var(--brand-wash); padding-block: clamp(3.5rem, 8vw, 5.5rem); text-align: center; }
.closing .actions { justify-content: center; margin-top: 0; }

.site-foot { border-top: 1px solid var(--line); padding-block: 2.5rem 3rem; font-size: 1rem; color: var(--muted); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; justify-content: space-between; align-items: center; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.site-foot p { margin: 0; }

/* Gallery */
.page-head { padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(1rem, 3vw, 2rem); }
.page-title { font-size: clamp(2.25rem, 5vw, 3.75rem); margin-bottom: 1rem; }
.page-lead { max-width: var(--measure); margin: 0; font-size: 1.125rem; }
.toc { list-style: none; padding: 0; margin: 1.75rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; }
.toc a { font-weight: 700; }
.gsec { padding-block: clamp(3rem, 7vw, 5.5rem); scroll-margin-top: 1rem; }
.gsec:nth-of-type(even) { background: var(--ground-alt); }
.gsec h2 { font-family: var(--font-display); font-weight: 700; color: var(--brand); font-size: clamp(1.75rem, 3.6vw, 2.5rem); line-height: 1.35; margin: 0; }
.gsec .sub { color: var(--muted); margin: .25rem 0 2rem; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 2.5rem 2rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.card { display: flex; flex-direction: column; min-width: 0; }
.card img { border-radius: 8px; box-shadow: var(--shadow); aspect-ratio: 16 / 9; width: 100%; object-fit: cover; background: var(--card); }
.card h3, .card h4 { font-size: 1.1875rem; line-height: 1.5; margin: 1rem 0 .4rem; }
.lang { display: inline-block; font-size: 1rem; font-weight: 700; line-height: 1.4; border: 1.5px solid currentColor; border-radius: 4px; padding: 0 .4em; margin-left: .4em; vertical-align: .12em; color: var(--muted); }
.card ul { list-style: none; padding: 0; margin: .25rem 0 0; display: grid; gap: .3rem; font-size: 1rem; }
.card .soon { color: var(--muted); }
.note { max-width: var(--measure); color: var(--muted); font-size: 1rem; margin: 0; }
.gsec h2 + .cards { margin-top: 2rem; }
.gsec .ggroup { font-size: 1.25rem; line-height: 1.5; color: var(--brand); margin: 2.5rem 0 1.25rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line); }
.gsec .sub + .ggroup { margin-top: 1rem; }

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
h1, h2, h3, .area-name { word-break: auto-phrase; text-wrap: balance; }
.lead { word-break: auto-phrase; }
@media (min-width: 80rem) { .lead { font-size: 1.125rem; white-space: nowrap; } }
.lead:lang(en) { white-space: normal; }  /* longer in English: it wraps instead */

/* 落款: the 絵語 seal closes the page, like the seal at the end of a picture scroll.
   It is not a second logo: it appears once, at the end, never in the header. */
.closing .wrap { position: relative; }
.seal {
  position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); bottom: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 3.25rem; height: 3.25rem;
  background: var(--sun); color: #FFFFFF; border-radius: 6px;
  font-family: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-weight: 800; font-size: 1.125rem; line-height: 1.05;
  writing-mode: vertical-rl; letter-spacing: .05em;
  box-shadow: inset 0 0 0 2px var(--sun), inset 0 0 0 3.5px #FFFFFF;
  transform: rotate(-3deg);
}
@media (prefers-color-scheme: dark) { .seal { color: #12121A; box-shadow: inset 0 0 0 2px var(--sun), inset 0 0 0 3.5px #12121A; } }
@media (max-width: 600px) { .seal { position: static; margin-top: 2rem; } }

/* Top page (2026-11-20): one file at the top, three readers below it
   (教育者 | 表現者 | 技術者, the centre one marked), then how a file is made,
   how the parts library grows, the open format and how to use it. */
.top-hero { text-align: center; padding-top: clamp(1.5rem, 5vw, 3.5rem); }
.top-hero .eyebrow { color: var(--muted); letter-spacing: .06em; font-size: 1rem; margin: 0; }
.top-hero .headline { font-size: clamp(1.875rem, 4.4vw, 3.25rem); margin-top: .5rem; }
.top-hero .lead { max-width: 36em; margin: 1.25rem auto 0; white-space: normal; }
.top-hero .actions { justify-content: center; }

.tree { padding-block: clamp(2.5rem, 6vw, 4rem) clamp(3rem, 6vw, 5rem); }
.file { display: flex; justify-content: center; margin: 0; }
.file span {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1rem; line-height: 1.5;
  background: var(--brand-wash); color: var(--brand-strong); border: 1.5px solid var(--brand);
  border-radius: 999px; padding: .35rem 1rem; overflow-wrap: normal;
}
.file span::before { content: ""; display: inline-block; width: .55em; height: .55em; border-radius: 50%; background: var(--sun); margin-right: .5em; vertical-align: .1em; }
.bus { display: none; }
.three { display: grid; gap: 2.5rem; margin-top: 2rem; }
@media (min-width: 56rem) {
  .bus { display: block; height: 2.6rem; position: relative; }
  .bus::before { content: ""; position: absolute; left: 50%; top: 0; height: 1.3rem; border-left: 2px solid var(--line); }
  .bus::after { content: ""; position: absolute; left: calc(100% / 6); right: calc(100% / 6); top: 1.3rem; height: 1.3rem; border: 2px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; }
  .three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.25rem, 2.5vw, 2rem); margin-top: 0; }
}
.col { min-width: 0; display: flex; flex-direction: column; gap: .75rem; }
.col .view { order: -1; }
.who { margin: .5rem 0 0; font-size: 1rem; font-weight: 700; color: var(--brand); letter-spacing: .04em; }
.col h3 { font-size: 1.3125rem; line-height: 1.45; margin: 0; }
.col p { margin: 0; color: var(--muted); }
.view {
  position: relative; margin: 0; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 10px; border: 1px solid var(--line); background: var(--ground-alt);
}
.view img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.col.center .view { box-shadow: var(--shadow); outline: 2px solid var(--brand); outline-offset: 4px; }

/* 教育者: the same lesson as slide → book → 暗記 (Egatari Viewer), a slow crossfade.
   The slide is always underneath; the book and the 暗記 view fade in over it
   (about 4 s each, 12 s a cycle). With reduced motion only the slide is shown. */
.fade > * { position: absolute; inset: 0; }
.fade > :first-child { position: relative; }
.fade-tag {
  position: absolute; left: .5rem; bottom: .5rem;
  font-size: .875rem; font-weight: 700; line-height: 1.4; padding: .15rem .55rem; border-radius: 4px;
  background: var(--brand); color: var(--on-brand);
}
.fade .f2, .fade .f3 { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .fade .f2 { animation: fade-book 12s linear infinite; }
  .fade .f3 { animation: fade-recall 12s linear infinite; }
}
@media (prefers-reduced-motion: reduce) { .fade .f2, .fade .f3 { display: none; } }
@keyframes fade-recall { 0%, 63.5% { opacity: 0; } 71.5%, 92% { opacity: 1; } 100% { opacity: 0; } }
/* the book layer stays opaque under 暗記 and drops out with it at the end of the cycle */
@keyframes fade-book { 0%, 30% { opacity: 0; } 38%, 92% { opacity: 1; } 100% { opacity: 0; } }

/* 技術者: the source and the two commands, on a dark screen in both themes */
.view.code {
  background: #1E1E2C; color: #E8E8F0; border-color: var(--screen-edge);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(.625rem, .9vw, .75rem); line-height: 1.55; aspect-ratio: auto;
  padding: .8rem 1rem; white-space: pre; overflow-x: auto; overflow-wrap: normal;
}
.code .d { color: #9A9BB0; }
.code .p { color: #A9ABFA; }
.code .ok { color: #6FCF97; }
@media (max-width: 30rem) { .view.code { font-size: .625rem; padding: .7rem .8rem; } }

/* how a file is made: text beside the quality check screenshot */
.split { display: grid; gap: clamp(2rem, 4vw, 3.5rem); align-items: center; }
@media (min-width: 64rem) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); } }
.stat { display: flex; gap: 2rem; flex-wrap: wrap; margin: 1.5rem 0 0; }
.stat div { font-variant-numeric: tabular-nums; }
.stat b { display: block; font-size: 2.5rem; color: var(--brand); line-height: 1.2; }
.stat span { font-size: 1rem; color: var(--muted); }
.learners { margin-top: 1.5rem; background: var(--ground); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 10px; padding: 1.1rem 1.25rem 1.25rem; }
.learners h3 { font-size: 1.1875rem; margin: 0 0 .5rem; line-height: 1.5; }
.learners p { margin: 0 0 .75rem; }
.learners .links { margin-top: .5rem; }
.view video { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }

/* 紹介動画（トップ） */
.intro-video { margin: 2.25rem auto 0; max-width: 52rem; }
.intro-video video { display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: .5rem; border: 1px solid var(--line, rgba(0,0,0,.12)); background: #000; }
.intro-video figcaption { margin-top: .5rem; font-size: .875rem; color: var(--muted); }
.start-guide { margin: 1rem 0 0; font-size: .9375rem; color: var(--muted); }
