/* ashineko.com — editorial, typographic, one reading measure.
   Sections: tokens · reset · typography · layout · components · footer · narrow. */

/* ── tokens ──────────────────────────────────────────────────────────────── */

:root {
  color-scheme: light dark;

  /* Paper is celadon-tinted rather than warm cream; ink is sumi, not black. */
  --paper:    #f3f5f1;
  --paper-2:  #e8ece5;   /* recessed: notes, code, tag ground */
  --ink:      #1a1f1c;
  --ink-2:    #56605a;   /* summaries, meta, muted chrome */
  --rule:     #d2d9cd;   /* hairlines — the only structural device on the page */
  --accent:   #1b5a4c;   /* one accent: links, the pressed filter, focus */

  /* One gothic face for Latin; a Mincho webfont for Japanese (owner's call, 2026-09-09). */
  --font-text: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ja: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", "MS PMincho", serif;
  --font-ja-display: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", "MS PMincho", serif;

  /* Type scale, ~1.3 between display steps. */
  --step--1: 0.9375rem;
  --step-0:  1.125rem;
  --step-1:  1.25rem;
  --step-2:  clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-3:  clamp(1.5rem, 1.35rem + 0.7vw, 1.85rem);
  --step-4:  clamp(1.75rem, 1.45rem + 1.4vw, 2.4rem);   /* titles fit 2–3 lines in the 68ch column */

  /* Space, loosely golden — the page is mostly margin. */
  --s-1: 0.375rem;
  --s-2: 0.75rem;
  --s-3: 1.25rem;
  --s-4: 2rem;
  --s-5: 3.25rem;
  --s-6: 5.25rem;

  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:   #151a17;
    --paper-2: #1e2420;
    --ink:     #dfe5de;
    --ink-2:   #9aa49c;
    --rule:    #2c332e;
    --accent:  #7fbca6;
  }
}

/* ── reset ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote, pre { margin: 0; }
ul, ol { padding-left: 1.25em; }
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 1px; }
::selection { background: var(--accent); color: var(--paper); }

/* ── typography ──────────────────────────────────────────────────────────── */

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 {
  font-size: var(--step-4);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p, ul, ol, blockquote, pre, figure, table { margin-block: var(--s-3); }
main h2 { margin-top: var(--s-5); }
main h3, main h4 { margin-top: var(--s-4); }

/* Prose links carry the accent and a real underline; nothing else does. */
main a, footer a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
main a:hover, footer a:hover { text-decoration-thickness: 2px; }

blockquote {
  border-left: 2px solid var(--rule);
  padding-left: var(--s-3);
  color: var(--ink-2);
}
hr { border: 0; border-top: 1px solid var(--rule); margin-block: var(--s-5); }
code, kbd, samp {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
}
:not(pre) > code { background: var(--paper-2); padding: 0.1em 0.35em; border-radius: 2px; }
pre {
  overflow-x: auto;
  background: var(--paper-2);
  padding: var(--s-2) var(--s-3);
  border-radius: 2px;
  line-height: 1.5;
}
pre code { font-size: 0.9375rem; }

/* Japanese: Noto Serif JP (Mincho) everywhere, looser leading, proportional kana. */
:lang(ja) {
  font-family: var(--font-ja);
  line-height: 1.9;
  font-feature-settings: "palt" 1;
}
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3, :lang(ja) h4 {
  font-family: var(--font-ja-display);
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.01em;
}
/* Japanese display type sits a full step below Latin: a kanji at 2.4rem reads as
   shouting, and Mincho needs air. These win over the Latin sizes by specificity. */
:lang(ja) h1,
:lang(ja) .intro > h1:first-child,
:lang(ja) .intro > p:first-child {
  font-size: clamp(1.35rem, 1.2rem + 0.75vw, 1.75rem);
  line-height: 1.6;
  letter-spacing: 0.02em;
}
:lang(ja) h2 { font-size: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem); line-height: 1.55; }
:lang(ja) h3 { font-size: 1.125rem; }
:lang(ja) h4 { font-size: 1.0625rem; }

/* ── layout ──────────────────────────────────────────────────────────────── */

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
@supports (min-height: 100dvh) { body { min-height: 100dvh; } }

/* One measure for the whole page: header rule, text column and footer align. */
body > header,
main,
body > footer {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--s-3);
}
main {
  flex: 1;
  padding-block: var(--s-5) var(--s-6);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(22rem, 100%), 1fr));
  gap: var(--s-4);
  margin-top: var(--s-4);
}

/* ── components ──────────────────────────────────────────────────────────── */

/* header / nav */
body > header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2) var(--s-3);
  padding-block: var(--s-4) var(--s-2);
  border-bottom: 1px solid var(--rule);
}
.brand {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand:hover { color: var(--accent); }
body > header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-2) var(--s-3);
  font-size: var(--step--1);
}
body > header nav a {
  color: var(--ink-2);
  text-decoration: none;
  padding-block: 0.15rem;
  border-bottom: 1px solid transparent;
}
body > header nav a:hover { color: var(--ink); border-bottom-color: var(--rule); }
/* The language switch is a control, not a destination — so it is drawn as one. */
body > header nav a.lang {
  color: var(--accent);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.1rem 0.5rem;
}
body > header nav a.lang:hover { border-color: var(--accent); }

/* home */
.intro { margin-bottom: var(--s-6); }
/* The opening line is the page: set it as display type when content leads with a
   paragraph, and let a real <h1> take over when content leads with a heading. */
.intro > h1:first-child,
.intro > p:first-child {
  font-family: var(--font-display);
  font-size: var(--step-4);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-top: 0;
}
:lang(ja) .intro > h1:first-child,
:lang(ja) .intro > p:first-child {
  font-family: var(--font-ja-display);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0;
}
/* A contents-page label, not a second headline: the identity line above it and
   the entries below it both outrank it. */
.featured > h2 {
  margin-top: 0;
  margin-bottom: var(--s-3);
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-2);
}
.featured > .card:first-of-type { margin-top: 0; }
.featured > p:last-child { margin-top: var(--s-4); }

/* cards — a register of entries, ruled off, not boxed */
.card {
  border-top: 1px solid var(--rule);
  padding-top: var(--s-2);
}
.featured .card { margin-top: var(--s-4); }
.card > a {
  display: block;
  color: inherit;
  text-decoration: none;
}
.card h2, .card h3 {
  margin: 0;
  font-size: var(--step-2);
  font-weight: 600;
}
.card > a:hover h2, .card > a:hover h3 { color: var(--accent); }
.card p { margin-block: var(--s-1) 0; color: var(--ink-2); }
.card .meta { margin-top: var(--s-2); }

/* meta line and tags */
.meta {
  font-size: var(--step--1);
  color: var(--ink-2);
}
.tag {
  display: inline-block;
  margin-left: 0.15em;
  padding: 0.05em 0.4em;
  background: var(--paper-2);
  border-radius: 2px;
  line-height: 1.35;
}
.tag + .tag { margin-left: 0.5em; }

/* tag filter — the same index-term treatment as .tag, made pressable */
.tag-filter:not(:empty) {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-3);
  margin-top: var(--s-4);
}
.tag-filter button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.1rem 0;
  font-size: var(--step--1);
  color: var(--ink-2);
  cursor: pointer;
}
.tag-filter button:hover { color: var(--ink); border-bottom-color: var(--rule); }
.tag-filter button[aria-pressed="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* language-fallback note */
.note {
  margin-block: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--paper-2);
  border-left: 3px solid var(--accent);
  font-size: var(--step--1);
  color: var(--ink-2);
}

/* case study */
.case-study > header { margin-bottom: var(--s-5); }
.case-study > header h1 { margin-bottom: var(--s-3); }
.case-study .summary {
  font-size: var(--step-1);
  color: var(--ink-2);
  margin-block: 0 var(--s-2);
  max-width: 54ch;
}
.case-study .meta { margin-block: 0; }
.case-study img { max-width: 100%; height: auto; border-radius: 2px; }
.hero {
  width: 100%;
  margin-top: var(--s-4);
  border-radius: 2px;
  background: var(--paper-2);
}
.case-study table,
.about table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--step--1);
}
.case-study th, .case-study td,
.about th, .about td {
  text-align: left;
  padding: 0.4rem 0.9rem 0.4rem 0;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.case-study .links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-3);
  margin-top: var(--s-5);
  padding-top: var(--s-3);
  border-top: 1px solid var(--rule);
  font-size: var(--step--1);
}

/* about */
.about > h1:first-child { margin-bottom: var(--s-3); }
/* The skills table holds prose, not data: let it wrap rather than clip on a phone,
   where the case-study tables (short cells) scroll sideways instead. */
.about td { white-space: normal; }

/* ── footer ──────────────────────────────────────────────────────────────── */

body > footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-3);
  padding-block: var(--s-3) var(--s-5);
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
}
body > footer a {
  font-size: var(--step--1);
  color: var(--ink-2);
  text-decoration-color: var(--rule);
}
body > footer a:hover { color: var(--accent); }

/* ── narrow ──────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  :root {
    --step-0: 1.0625rem;
    --s-3: 1rem;
    --s-5: 2.5rem;
    --s-6: 3.5rem;
  }
  body { font-size: var(--step-0); }
  body > header { padding-block: var(--s-3) var(--s-2); }
  .cards { gap: var(--s-3); }
  .case-study .links, body > footer { gap: var(--s-1) var(--s-3); }
}

/* ── images & frames ────────────────────────────────────────────────────── */

figure[data-frame] { margin-inline: 0; }
figure[data-frame] img { display: block; width: 100%; height: auto; border-radius: 0; }
figure[data-frame="browser"] {
  border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; background: var(--paper-2);
  box-shadow: 0 1px 2px rgb(0 0 0 / .06), 0 12px 32px -18px rgb(0 0 0 / .35);
}
figure[data-frame="browser"]::before {
  content: ""; display: block; height: 28px; background: var(--paper-2); border-bottom: 1px solid var(--rule);
  background-image:
    radial-gradient(circle at 14px 14px, var(--rule) 4px, transparent 4.5px),
    radial-gradient(circle at 32px 14px, var(--rule) 4px, transparent 4.5px),
    radial-gradient(circle at 50px 14px, var(--rule) 4px, transparent 4.5px);
  background-repeat: no-repeat;
}
figure[data-frame="phone"] {
  max-width: 360px; margin-inline: auto; padding: 14px 10px; border-radius: 34px;
  background: var(--ink); box-shadow: 0 20px 40px -24px rgb(0 0 0 / .5);
}
figure[data-frame="phone"] img { border-radius: 22px; }
figure[data-frame="phone"]::before { content: ""; display: block; width: 90px; height: 6px; margin: 0 auto 8px; border-radius: 3px; background: rgb(255 255 255 / .18); }
figure[data-frame] figcaption, .mood figcaption, .tile .caption { margin-top: var(--s-2); font-size: var(--step--1); color: var(--ink-2); }
.moods { margin-block: var(--s-5); }
.mood { margin-block: var(--s-3); overflow: hidden; border-radius: 4px; }
.mood img { display: block; width: 100%; height: auto; will-change: transform; }
.gallery { columns: 3; column-gap: var(--s-3); }
@media (max-width: 900px) { .gallery { columns: 2; } }
@media (max-width: 520px) { .gallery { columns: 1; } }
.tile { display: block; break-inside: avoid; margin-bottom: var(--s-3); text-decoration: none; color: inherit; }
.tile img { display: block; width: 100%; height: auto; border-radius: 4px; }
/* lift */
.tile, figure[data-frame] { transition: transform .18s ease-out, box-shadow .18s ease-out, opacity .5s ease-out; }
.mood { transition: opacity .5s ease-out, transform .5s ease-out; }
@media (hover: hover) {
  .tile:hover, figure[data-frame]:not([data-frame="plain"]):hover { transform: translateY(-4px); box-shadow: 0 18px 36px -20px rgb(0 0 0 / .45); }
}
/* reveal (JS adds .is-visible; without JS nothing is hidden). Do not pin `transform: none`
   on the visible state — that would out-specificity the hover lift above. */
.js [data-reveal]:not(.is-visible) { opacity: 0; transform: translateY(12px); }

/* ── infographics ───────────────────────────────────────────────────────── */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s-3);
  margin-block: var(--s-5); padding-block: var(--s-3); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.stat { margin: 0; }
.stat dt { font-size: var(--step--1); color: var(--ink-2); letter-spacing: .04em; text-transform: uppercase; }
.stat dd { margin: var(--s-1) 0 0; font-size: var(--step-0); color: var(--ink); }
/* (0,2,0) already beats :lang(ja)'s (0,1,0), so numerals stay in Inter on JA
   pages without a :lang(ja) override — do not re-add one. */
.stat .num { font-family: var(--font-display); font-size: var(--step-4); font-weight: 600; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat .note { margin: var(--s-1) 0 0; font-size: var(--step--1); color: var(--ink-2); background: none; padding: 0; border-left: 0; }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr 1fr; } }

.steps { list-style: none; counter-reset: step; margin: var(--s-5) 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-3); }
.steps li { counter-increment: step; position: relative; padding-left: 44px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 14px;
  background: var(--accent); color: var(--paper); font-size: var(--step--1); font-weight: 600; display: grid; place-items: center;
}
.steps .step-name { display: block; font-size: var(--step-0); font-weight: 600; line-height: 28px; }
.steps .step-note { display: block; font-size: var(--step--1); color: var(--ink-2); margin-top: var(--s-1); }
@media (min-width: 768px) {
  .steps { flex-direction: row; align-items: flex-start; gap: 0; }
  .steps li { flex: 1 1 0; padding: 40px 12px 0 0; }
  .steps li::before { top: 0; left: 0; }
  .steps li:not(:last-child)::after {
    content: ""; position: absolute; top: 14px; left: 36px; right: 4px; height: 1px; background: var(--rule);
  }
  .steps li:not(:last-child) .step-name::before { content: ""; position: absolute; top: 10px; right: 4px; width: 0; height: 0;
    border-style: solid; border-width: 4.5px 0 4.5px 7px; border-color: transparent transparent transparent var(--accent); }
  .steps .step-name { line-height: 1.3; }
}
/* steps reveal in sequence (effects.js adds .is-visible per item; CSS backstops cover no-JS, reduced motion and print) */
.js .steps li { opacity: 0; transform: translateX(-6px); transition: opacity .35s ease-out, transform .35s ease-out; }
.js .steps li.is-visible { opacity: 1; transform: none; }

.diagram { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.diagram svg { display: block; width: 100%; height: auto; color: var(--ink); font-family: inherit; min-width: 540px; }
.diagram .edge { fill: none; stroke: var(--ink-2); stroke-width: 1.5; }
.diagram .eplate { fill: var(--paper); }
.diagram .elabel { fill: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal]:not(.is-visible) { opacity: 1; transform: none; }
  .tile, figure[data-frame], .mood img { transition: none !important; transform: none !important; }
  .js .steps li { opacity: 1; transform: none; transition: none; }
}
/* A full-page capture or a printed page must not show not-yet-intersected figures blank. */
@media print {
  .js [data-reveal]:not(.is-visible) { opacity: 1; transform: none; }
  .js .steps li { opacity: 1; transform: none; }
}
/* lightbox */
dialog.lightbox { border: 0; padding: 0; background: rgb(0 0 0 / .92); max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
dialog.lightbox::backdrop { background: transparent; }
dialog.lightbox img { position: absolute; inset: 0; margin: auto; max-width: min(96vw, 1600px); max-height: 88vh; object-fit: contain; transform-origin: top left; }
dialog.lightbox .lb-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: var(--s-3); color: #ddd; text-align: center; font-size: var(--step--1); }
dialog.lightbox .lb-close, dialog.lightbox .lb-prev, dialog.lightbox .lb-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgb(255 255 255 / .12); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 22px; cursor: pointer; font-size: 20px; }
dialog.lightbox .lb-close { top: var(--s-3); right: var(--s-3); transform: none; }
dialog.lightbox .lb-prev { left: var(--s-3); } dialog.lightbox .lb-next { right: var(--s-3); }
