/* =====================================================================
   Shokunin Lab — stylesheet
   Theme: 畳・和 (tatami / wa), decided by reina 2026-11-24. The room is
   a quiet tatami space: washi-white walls, igusa (rush) surfaces, and
   tatami-beri (the cloth edge of a mat, deep green) as the divider
   grammar. Gold keeps its five functional roles only and yields the
   stage to the tatami colours. The structure, information design and
   token scales of the redesign spec (§2) are unchanged — this is a
   theme layer over them.

   Theme mapping:
     Colour   : THREE colours only (reina rule, 2026-11-24) — black,
                green, gold. NO red anywhere: no vermillion, no
                reddish brown, no pink hues in the UI chrome (the
                works' own images keep their own colours; the rule
                governs the site's design colours). Black = sumi ink
                for text and tightening edges. Green = heri deep green
                + igusa greens, the lead for surfaces and dividers.
                Gold = link / kicker / free badge / action button /
                selected state — nothing else. Kinari / washi white
                is allowed as the ground colour.
     Texture  : the weave of a tatami-omote, drawn with repeating
                gradients (--weave), laid thinly on structural faces
                only: shelf bands, the masthead mat, tiles, panels.
     Motif    : the masthead is one mat (heri strip on its right edge
                carries the vertical signature); a shelf band is a mat
                laid across the room (heri on its long edges); header
                and footer close the room with a stitched heri band.
     Type     : Mincho (system serif) for headings and for the item
                introduction prose on detail pages; UI text, chips,
                buttons and meta stay sans. The logotype alone is set
                in a brush stack (system faces only, no webfonts) in
                sumi black. Round 2 (anti-"AI look" pass) also broke
                the weave's single period, squared the corners, and
                gave the masthead uneven, editorial spacing.

   Round 4 — 和モダン (reina, 2026-11-24): the tatami room is kept but
   modernised — flat paper surfaces instead of woven bands, hairline
   heri rules, ink-black action buttons with a gold seat line (gold is
   no longer a button fill), heavy Mincho lettering for the logotype and the
   home headline (SVG, tools/lettering.py), and the works with their
   verified traction lines brought up to the first screen.

   Design tokens (spec §2) — do not introduce sizes outside these scales:
     Type scale : 28 / 20 / 15 / 14 / 13 / 11.5 / 11 (kicker)
     Spacing    : 4 / 8 / 12 / 16 / 24 / 32 / 48 (4-8px system)

   Layout is responsive in 3 forms:
     - Smartphone : base styles below            (1 column)
     - Tablet     : @media (min-width: 640px)    (2 columns)
     - PC         : @media (min-width: 1024px)   (3-4 columns, filter sidebar)
   Class names are semantic: .shelf / .card / .chip / .filter-* / .detail-*
   ===================================================================== */

:root {
  /* Colour roles — tatami theme (spec §2.3 structure, wa palette) */
  --color-bg: #faf8f1;          /* washi white */
  --color-surface: #efece0;     /* pale igusa (rush) */
  --color-tatami: #e5dfc2;      /* deeper igusa, for mat tiles */
  --color-heri: #2e4b3a;        /* tatami-beri deep green (dividers) */
  --color-heri-dark: #1f3527;   /* heri, darkened for text on light */
  --color-text: #232620;        /* sumi ink (green-leaning black) */
  --color-ink: #191b16;         /* deepest sumi: buttons, logotype */
  --color-text-sub: #646553;    /* green-leaning grey */
  --color-gold: #b8860b;
  --color-gold-dark: #7a5a07;   /* gold for TEXT: links, kickers (5.4:1+ on every paper) */
  --color-gold-light: #f6efdb;  /* free badge surface */
  --color-border: #dcd4b8;      /* straw-tinted hairline */

  /* Tatami-omote weave, round 2 (2026-11-24): a single perfectly
     periodic repeat read as a screen / graph paper — a machine
     texture, not a material. Real rush matting is irregular: strand
     density drifts, and the colour of the grass is blotchy. So the
     weave is now two interfering periods per axis (2px + 3px across,
     7px + 13px along, at different strengths) under two large, soft
     tonal blotches. No single period survives to the eye. Kept very
     light; laid on structural faces only. */
  --weave:
    radial-gradient(120% 90% at 18% 0%, rgba(122, 116, 66, 0.05), transparent 55%),
    radial-gradient(100% 100% at 85% 100%, rgba(84, 96, 52, 0.045), transparent 52%),
    repeating-linear-gradient(0deg, rgba(110, 104, 60, 0.042) 0, rgba(110, 104, 60, 0.042) 1px, transparent 1px, transparent 2px),
    repeating-linear-gradient(0deg, rgba(110, 104, 60, 0.02) 0, rgba(110, 104, 60, 0.02) 1px, transparent 1px, transparent 3px),
    repeating-linear-gradient(90deg, rgba(110, 104, 60, 0.026) 0, rgba(110, 104, 60, 0.026) 1px, transparent 1px, transparent 7px),
    repeating-linear-gradient(90deg, rgba(110, 104, 60, 0.015) 0, rgba(110, 104, 60, 0.015) 1px, transparent 1px, transparent 13px);

  /* Coarser weave for the masthead mat: at display size the fine
     repeat turned into a halftone screen, so the entrance mat uses
     wider strands at lower contrast, plus stronger colour drift. */
  --weave-coarse:
    radial-gradient(130% 100% at 12% 0%, rgba(122, 116, 66, 0.065), transparent 55%),
    radial-gradient(110% 110% at 88% 110%, rgba(84, 96, 52, 0.055), transparent 55%),
    repeating-linear-gradient(0deg, rgba(110, 104, 60, 0.026) 0, rgba(110, 104, 60, 0.026) 1px, transparent 1px, transparent 4px),
    repeating-linear-gradient(90deg, rgba(110, 104, 60, 0.015) 0, rgba(110, 104, 60, 0.015) 1px, transparent 1px, transparent 11px),
    repeating-linear-gradient(90deg, rgba(110, 104, 60, 0.008) 0, rgba(110, 104, 60, 0.008) 1px, transparent 1px, transparent 17px);

  /* Heri band with its stitched centre line (header / footer) */
  --heri-band:
    linear-gradient(to bottom, rgba(244, 241, 228, 0) 2px, rgba(244, 241, 228, 0.45) 2px, rgba(244, 241, 228, 0.45) 3px, rgba(244, 241, 228, 0) 3px),
    linear-gradient(var(--color-heri), var(--color-heri));

  /* Typefaces: Mincho for headings (display), sans for body */
  --font-display: "Hiragino Mincho ProN", "Hiragino Mincho Pro",
                  "Yu Mincho", "YuMincho", "Noto Serif JP",
                  "Noto Serif CJK JP", serif;
  --font-body: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP",
               "Helvetica Neue", Arial, sans-serif;

  /* Brush stack for the logotype ONLY (reina, 2026-11-24): the word
     mark should carry a hand, not a typesetter. No webfonts may be
     loaded (CSP / no third-party resources), so this walks the
     brush & handwriting faces that ship with real systems — Yuji /
     gyoshotai where installed, YuKyokasho and Hannotate on Apple
     systems, Kaiti on Apple / Windows — and lands on Mincho where
     none exist, so the mark never breaks, it just speaks plainer.
     Weight stays 400: brush faces are single-weight, and synthetic
     bold would smear the strokes. */
  --font-brush: "Yuji Syuku", "Yuji Boku", "Yuji Mai",
                "HGGyoshotai", "HGPGyoshotai", "HGSGyoshotai",
                "YuKyokasho Yoko", "YuKyokasho", "HGKyokashotai",
                "Hannotate SC", "Hannotate TC",
                "HanziPen SC", "HanziPen TC",
                "Kaiti SC", "STKaiti", "KaiTi", "DFKai-SB",
                "Hiragino Mincho ProN", "Yu Mincho", serif;

  /* Type scale (spec §2.1) */
  --fs-h1: 28px;
  --fs-h2: 20px;
  --fs-card-name: 15px;
  --fs-body: 14px;
  --fs-tagline: 13px;
  --fs-meta: 12px;      /* round 5: 11.5 -> 12 (mobile legibility) */
  --fs-kicker: 12px;    /* round 5: 11 -> 12 */

  /* Spacing scale (spec §2.2) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  /* Near-square corners (round 2): a uniform 8px radius on every
     surface was UI-kit grammar. Tatami is a right-angled material;
     3px is just enough to take the digital edge off. */
  --radius-img: 3px;
  --page-pad: 16px;

  /* Display size for the home masthead only — an art-direction addition
     on top of the spec type scale (headlines as expression, not data). */
  --fs-display: clamp(34px, 5.2vw, 58px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* Washi is never evenly white (round 2): two faint, off-centre
     tonal drifts sit under everything, so the ground itself has the
     slight unevenness of a handmade sheet. */
  background:
    radial-gradient(900px 620px at 88% -40px, rgba(122, 116, 66, 0.045), transparent 62%),
    radial-gradient(760px 560px at -120px 34%, rgba(84, 96, 52, 0.032), transparent 58%),
    var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.7;
  overflow-x: hidden; /* full-bleed shelf bands use the 100vw technique */
}

::selection { background: #ddd5ae; } /* igusa tint when text is chosen */

/* Headings speak Mincho — the wa voice of the room. Chips, buttons
   and meta text never do. The logotype left this list in round 2:
   it is set in the brush stack (.brand-name below). The item
   introduction texts on the detail page joined it: an introduction
   is read, not scanned, so it takes the Mincho voice too (reina,
   2026-11-24) — see the detail section rules. */
.masthead-title, .page h1, .shelf-title, .hero-name, .detail-title,
.detail-section h2, .card-name, .category-tile-name, .text-tile-name {
  font-family: var(--font-display);
}
/* Mincho breathes with a touch of air between characters */
.page h1, .shelf-title, .hero-name, .detail-title, .detail-section h2 {
  letter-spacing: 0.03em;
}

/* Round 5 (a11y): text links use the deep gold — the bright gold failed
   WCAG contrast on washi (2.6–3.3:1). Bright gold stays for lines,
   edges and the button seat only. */
a { color: var(--color-gold-dark); text-underline-offset: 3px; }
a:hover { text-decoration: underline; }

/* Keyboard focus: gold outline on every interactive element (spec §5) */
a:focus-visible, button:focus-visible, select:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

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

/* Kicker: small English label that opens a section (gold role #2).
   Round 2: the bare all-caps label was landing-page template
   grammar, so each kicker now opens with a short heri stitch — a
   dash of the mat's cloth edge — the mark of a hand at work. */
.kicker {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-kicker);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-gold-dark);
  margin: 0 0 var(--space-1);
}
.kicker::before {
  content: "";
  flex: none;
  width: 24px;
  height: 2px;
  background: var(--color-heri);
}

/* ---------- Header ---------- */
/* The room opens with a heri band: the stitched cloth edge of a mat,
   run across the very top of the page. */
.site-header { border-bottom: 1px solid var(--color-border); }
.site-header::before {
  content: ""; display: block; height: 6px;
  background: var(--heri-band);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); padding: var(--space-3) var(--page-pad);
  max-width: 1200px; margin: 0 auto;
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--color-text); }
.brand:hover { text-decoration: none; }
/* Logo (round 4): a seal and a wordmark in Zen Old Mincho Black, both
   SVG drawn by tools/lettering.py — the seal carries 職 in washi white on
   heri green, the wordmark is calligraphic Latin in sumi. */
.brand-seal { flex: none; display: block; width: 36px; height: 36px; }
.brand-name { display: block; height: 19px; width: auto; margin-bottom: 4px; }
.brand-sub { display: block; font-size: 12px; color: var(--color-text-sub); line-height: 1.4; }
.lang-switch select {
  padding: 6px 8px; border: 1px solid var(--color-border); border-radius: 6px;
  background: #fff; font-size: var(--fs-tagline);
}

/* Round 3: the row of rounded pills was an app's filter bar. The axes
   are now set as a line of words divided by short rules, like the
   index line of a printed catalogue; the current page is underlined
   in gold (gold role #5, spec §4.5). */
.main-nav {
  display: flex; gap: 0; overflow-x: auto;
  padding: 0 var(--page-pad) var(--space-2);
  max-width: 1200px; margin: 0 auto; white-space: nowrap;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  position: relative;
  padding: 6px 14px;
  color: var(--color-text); text-decoration: none; font-size: var(--fs-tagline);
  border-bottom: 2px solid transparent;
}
.main-nav a:first-child { padding-inline-start: 0; }
.main-nav a + a::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 50%;
  width: 1px; height: 11px; margin-top: -5px;
  background: var(--color-border);
}
.main-nav a:hover { color: var(--color-heri-dark); text-decoration: none; border-bottom-color: var(--color-border); }
.main-nav a.is-current { border-bottom-color: var(--color-gold); color: var(--color-gold-dark); font-weight: 700; }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  max-width: 1200px; margin: 0 auto; padding: 10px var(--page-pad) 0;
  font-size: var(--fs-tagline); color: var(--color-text-sub);
}
.breadcrumb a { color: var(--color-text-sub); display: inline-block; padding: 6px 0; }
.breadcrumb .crumb-sep { margin: 0 6px; }
.breadcrumb:empty { display: none; }

/* ---------- Masthead (home only): the editorial opening ----------
   A display headline in Mincho, the shelf's real counts as a meta
   line, and a vertical Japanese signature — the one visual element
   that could only belong to Shokunin Lab (職人 × AI の棚). */
/* The masthead is one tatami mat laid at the entrance: woven igusa
   face, a hairline frame, a heri-green foot edge, and the vertical
   signature woven into the heri strip on its right edge. */
.masthead {
  /* 和モダン (round 4): no boxed mat any more — the headline is written
     straight onto the paper, with the works it introduces beside it. */
  display: grid; grid-template-columns: 1fr; gap: var(--space-8);
  padding: var(--space-8) 0 var(--space-8);
  border-bottom: 1px solid var(--color-heri);
  margin-bottom: var(--space-8);
}
.masthead-main { min-width: 0; }
.page .masthead-title { margin: var(--space-3) 0 var(--space-6); font-size: inherit; line-height: 1; }
.masthead-lettering { display: block; }
.masthead-lettering img { display: block; height: auto; max-width: 100%; }
.masthead-lettering img + img { margin-top: clamp(6px, 1vw, 14px); }
/* The lead is a set-in note behind a thin heri rule, in Mincho */
.masthead-note {
  max-width: 520px;
  padding-inline-start: var(--space-4);
  border-inline-start: 1px solid var(--color-heri);
}
.masthead .page-lead {
  font-family: var(--font-display); line-height: 1.9; letter-spacing: 0.02em;
  color: var(--color-text); margin-bottom: var(--space-3);
}
.masthead-meta {
  font-size: var(--fs-meta); font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--color-gold-dark); margin: 0 0 var(--space-4);
}
/* Works already in people's hands, each with its traction line */
/* The masthead kicker carries the site name — 「職人Lab」 / "Shokunin Lab" —
   which must keep its own spelling, so it is not upper-cased. */
.masthead-main > .kicker { text-transform: none; letter-spacing: 0.06em; }
.masthead-works { min-width: 0; }
.masthead-works .kicker { margin-bottom: var(--space-3); }
.masthead-works-list { display: grid; gap: var(--space-3); }
.masthead-work {
  display: grid; grid-template-columns: 128px 1fr; gap: var(--space-3); align-items: center;
  text-decoration: none; color: var(--color-text);
  padding-bottom: var(--space-3); border-bottom: 1px solid var(--color-border);
}
.masthead-work:last-child { border-bottom: none; padding-bottom: 0; }
.masthead-work:hover { text-decoration: none; }
.masthead-work:hover .masthead-work-name { color: var(--color-gold-dark); }
.masthead-work-media {
  aspect-ratio: 16 / 9; overflow: hidden; border-radius: 2px;
  border: 1px solid var(--color-border); background: var(--color-surface);
}
.masthead-work-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.masthead-work-cap { display: block; min-width: 0; }
.masthead-work-name {
  display: block; font-family: var(--font-display); font-weight: 700;
  font-size: var(--fs-card-name); line-height: 1.4; margin-bottom: 2px;
}
@media (min-width: 1024px) {
  .masthead { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: var(--space-12); align-items: center; padding-top: var(--space-12); }
  .masthead-note { margin-inline-start: 18%; }
  .masthead-work { grid-template-columns: 152px 1fr; }
}

/* Traction line (round 4): what the work has already reached, in heri
   green with a small diamond — a fact set like a label, never a badge
   that shouts. Only verified, sourced figures exist in the data. */
.traction {
  display: flex; align-items: baseline; gap: 6px;
  font-size: var(--fs-meta); font-weight: 700; line-height: 1.5;
  color: var(--color-heri-dark); margin: 0 0 4px;
}
.traction::before {
  content: ""; flex: none; width: 6px; height: 6px;
  background: var(--color-heri); transform: translateY(-1px) rotate(45deg);
}
.hero-traction, .detail-traction { font-size: var(--fs-tagline); margin-bottom: var(--space-3); }

/* Japanese headings break at phrase boundaries where the browser can
   (Chrome's BudouX-based auto-phrase), never mid-word like "AI / ツール". */
.hero-name, .detail-title, .shelf-title, .card-name, .index-name, .page h1 {
  word-break: auto-phrase;
}

@media (max-width: 639px) {
  .masthead { padding-top: var(--space-6); gap: var(--space-6); }
  /* Phones (round 3): a home shelf is two works abreast with the lead
     across the full width — a shelf you glance along, not a feed. */
  .page .card-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4) var(--space-3); }
  .card-grid .card-lead { grid-column: span 2; }
  .card-grid .card:not(.card-lead) .card-name { font-size: var(--fs-body); }
  .card-grid .card:not(.card-lead) .card-tagline { font-size: var(--fs-meta); }
  .card-grid .card:not(.card-lead) .chip-specs { display: none; }
  .card-grid .card:not(.card-lead) .card-traction {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .card-grid .card:not(.card-lead) .card-traction::before { display: none; }
  /* the tagline repeats the headline; on a phone it only crowded the logo */
  .brand-sub { display: none; }
  /* the nav scrolls sideways: a soft fade on its right edge says so */
  .main-nav { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}

/* ---------- Scroll reveal (motion: show the next information) ---------- */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity 480ms ease, transform 480ms ease; }
.reveal.is-in { opacity: 1; transform: none; }
/* Round 5: cards on a shelf arrive one after another, like works being
   laid out by hand — a short stagger, never theatrical. */
.reveal .card-grid > .card { opacity: 0; transform: translateY(8px); transition: opacity 420ms ease, transform 420ms ease; }
.reveal.is-in .card-grid > .card { opacity: 1; transform: none; }
.reveal.is-in .card-grid > .card:nth-child(2) { transition-delay: 60ms; }
.reveal.is-in .card-grid > .card:nth-child(3) { transition-delay: 120ms; }
.reveal.is-in .card-grid > .card:nth-child(4) { transition-delay: 180ms; }
.reveal.is-in .card-grid > .card:nth-child(n+5) { transition-delay: 240ms; }
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal .card-grid > .card { opacity: 1; transform: none; transition: none; }
  .card-media img { transition: none; }
}

/* ---------- Page / shelves ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: var(--space-4) var(--page-pad) 0; min-height: 100vh; /* keeps the footer out of view while data loads (CLS) */ }
.page h1 { font-size: 30px; line-height: 1.25; margin: var(--space-2) 0 var(--space-3); font-weight: 900; }
.page-lead { color: var(--color-text-sub); margin: 0 0 var(--space-4); font-size: var(--fs-body); max-width: 720px; }

/* A shelf = kicker + heading + grid. Bands alternate plain / surface so
   shelves are separated by surface and space, never by rules (spec §4.1). */
.shelf { margin: 0 0 var(--space-12); }
/* A band shelf is a tatami mat laid across the room: woven igusa
   face, and the heri cloth on its two long edges (top and bottom). */
.shelf-band {
  /* The first two layers are the stitching: a dashed thread line
     running just inside each heri edge, the way the cloth is sewn
     onto the mat (round 2 — a sewn seam, not a printed stripe). */
  /* 和モダン (round 4): a flat sheet of pale igusa paper between two
     hairline heri rules — the stitched, woven band was too costume-like. */
  background: var(--weave), var(--color-surface);
  border-top: 1px solid var(--color-heri);
  border-bottom: 1px solid var(--color-heri);
  margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
  padding-left: calc(50vw - 50%); padding-right: calc(50vw - 50%);
  padding-top: var(--space-8); padding-bottom: var(--space-2);
  margin-bottom: var(--space-12);
}
.shelf-band .shelf { margin-bottom: var(--space-8); }
.shelf-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--space-3); margin-bottom: var(--space-4);
}
.shelf-title { font-size: var(--fs-h2); line-height: 1.3; margin: 0; }
.shelf-more { font-size: var(--fs-tagline); white-space: nowrap; padding: 6px 0; }

/* ---------- Cards (spec §3.1: image first, fixed order, no box) ---------- */
.card-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-4) var(--space-3); }

.card { display: block; text-decoration: none; color: var(--color-text); }
.card:hover { text-decoration: none; }
.card-media {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-img);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-2);
  transition: box-shadow 160ms ease;
}
.card-media img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform 160ms ease;
}
/* Hover (PC): the image itself responds — slight zoom + shadow (spec §5).
   The shadow sits on the frame, not the img, so overflow never clips it. */
.card:hover .card-media { box-shadow: 0 8px 24px rgba(62, 58, 32, 0.16); }
.card:hover .card-media img { transform: scale(1.02); }
.card:hover .card-name { color: var(--color-gold-dark); }
.card-name {
  font-weight: 700; font-size: var(--fs-card-name); line-height: 1.4;
  margin: 0 0 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-tagline {
  font-size: var(--fs-tagline); color: var(--color-text-sub); line-height: 1.5;
  margin: 0 0 var(--space-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Text tile: the intentional fallback when an item has no image yet
   (spec §3.2/§3.3) — a designed surface, never a broken placeholder. */
/* A text tile is a small mat of its own: deeper igusa, woven, with
   the heri edge on its left side. */
.text-tile {
  display: flex; flex-direction: column; justify-content: center;
  width: 100%; height: 100%;
  padding: var(--space-4);
  background: var(--weave), var(--color-tatami);
  border-inline-start: 4px solid var(--color-heri);
}
.text-tile .kicker { margin-bottom: var(--space-2); }
.text-tile-name { font-weight: 700; font-size: var(--fs-card-name); line-height: 1.4; }

/* Lead card (round 3): the first work on a featured shelf takes a
   double cell — the shelf gets a voice that leads and works that follow. */
.card-lead .card-name { font-size: var(--fs-h2); line-height: 1.35; margin-bottom: var(--space-1); }
.card-lead .card-tagline {
  font-family: var(--font-display); font-size: var(--fs-body);
  line-height: 1.9; letter-spacing: 0.02em; color: var(--color-text);
}

/* ---------- お品書き index (round 3): All items on the top page ---------- */
.index-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--color-text); }
.index-row { border-bottom: 1px solid var(--color-border); }
.index-link {
  display: grid; grid-template-columns: 112px 1fr; gap: var(--space-1) var(--space-3);
  align-items: center;
  padding: var(--space-3) 0;
  text-decoration: none; color: var(--color-text);
}
.index-link:hover { text-decoration: none; }
.index-link:hover .index-name { color: var(--color-gold-dark); }
.index-media {
  grid-row: span 2;
  aspect-ratio: 16 / 9; overflow: hidden;
  border: 1px solid var(--color-border); border-radius: 2px;
  background: var(--color-surface);
}
.index-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.index-media .text-tile { padding: var(--space-2); }
.index-media .text-tile .kicker { display: none; }
.index-text { min-width: 0; display: block; }
.index-name {
  display: block; font-family: var(--font-display); font-weight: 700;
  font-size: var(--fs-card-name); line-height: 1.4; letter-spacing: 0.02em;
}
.index-tagline {
  display: block; font-size: var(--fs-tagline); color: var(--color-text-sub); line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.index-side { display: flex; align-items: baseline; gap: var(--space-2); grid-column: 2; }
.index-cat { font-size: var(--fs-meta); color: var(--color-text-sub); }

/* Chips (language / device / price / hosting) — order is fixed by app.js:
   the price chip always comes first (spec §3.1, the "free" grammar). */
.chip-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--space-2); }
.chip {
  font-size: var(--fs-meta); font-weight: 500; line-height: 1.5;
  padding: 1px 6px; border-radius: 1px;
  border: 1px solid var(--color-border); background: #fff; color: var(--color-text-sub);
}
/* The price is a 札 (a shop's paper tag): square, gold-edged, and the
   only mark on the card (gold role #3). */
.chip-price-free, .chip-price-freemium {
  background: var(--color-gold-light); border-color: var(--color-gold);
  color: var(--color-text); font-weight: 700;
}
/* Languages and devices: one line of plain text, no boxes */
.chip-specs { font-size: var(--fs-meta); color: var(--color-text-sub); line-height: 1.5; }

/* ---------- Hero: today's featured item (spec §4.1) ---------- */
.hero { margin-bottom: var(--space-12); }
.hero-info .kicker { margin-bottom: var(--space-2); }
.hero-media-link { display: block; text-decoration: none; }
.hero-media {
  aspect-ratio: 16 / 9; border-radius: var(--radius-img);
  overflow: hidden; background: var(--color-surface); margin-bottom: var(--space-4);
  border: 1px solid var(--color-border);
}
.hero-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero-media .text-tile-name { font-size: var(--fs-h2); }
.hero-name { font-size: 24px; line-height: 1.3; margin: 0 0 var(--space-1); }
.hero-name a { color: var(--color-text); text-decoration: none; }
.hero-name a:hover { color: var(--color-gold-dark); text-decoration: none; }
.hero-tagline { color: var(--color-text-sub); margin: 0 0 var(--space-3); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-3); }

/* Action button: gold surface (gold role #4). Round 2: the flat
   SaaS pill is gone — near-square corners and a darker gold seat
   along the bottom edge give it the weight of a pressed seal. */
/* Action button, round 4 (reina: gold buttons felt off): sumi ink with
   washi lettering, and a 2px gold seat line along the foot — gold is
   now the accent of the button, not its body. Hover deepens to heri. */
.official-link-button {
  display: inline-block; background: var(--color-ink); color: #f4f1e4; font-weight: 700;
  font-size: var(--fs-body); letter-spacing: 0.04em;
  padding: var(--space-3) 24px; border: none; border-radius: 2px; text-decoration: none;
  box-shadow: inset 0 -2px 0 var(--color-gold);
  cursor: pointer; font-family: inherit;
  transition: background-color 160ms ease;
}
.official-link-button:hover { background: var(--color-heri); text-decoration: none; }

/* ---------- Category entrances (spec §3.3), round 3: 目次 ----------
   A table of contents set in type: a kanji numeral in heri green, the
   name in Mincho with its count, the subcategories underneath. Rows
   are ruled like a ledger; no item pictures are reused here. */
.category-index {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr;
  border-top: 1px solid var(--color-heri);
}
.category-index li { border-bottom: 1px solid var(--color-border); }
.category-tile {
  display: grid; grid-template-columns: 40px 1fr; gap: var(--space-3);
  align-items: baseline;
  padding: var(--space-3) 0 var(--space-4);
  text-decoration: none; color: var(--color-text);
}
.category-tile:hover { text-decoration: none; }
.category-num {
  font-family: var(--font-display); font-size: var(--fs-h2); font-weight: 700;
  color: var(--color-heri); line-height: 1; text-align: center;
}
.category-name-row { display: flex; align-items: baseline; gap: var(--space-3); }
.category-tile-name {
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--fs-h2); line-height: 1.35; letter-spacing: 0.04em;
}
.category-tile:hover .category-tile-name { color: var(--color-gold-dark); }
.category-tile-count { font-size: var(--fs-meta); color: var(--color-text-sub); white-space: nowrap; }
.subcategory-links { font-size: var(--fs-meta); margin-top: var(--space-1); color: var(--color-text-sub); display: block; line-height: 1.6; }

/* ---------- Listing layout: sticky filter sidebar (spec §4.2) ---------- */
.listing-layout { display: block; }
.listing-main { min-width: 0; } /* keep long chips/URLs from blowing out the grid */
.detail-hero-info { min-width: 0; }
/* Round 5: the boxed grey form panel was SaaS-admin grammar. Filters
   are now a plain column of labelled fields — label in small caps sumi,
   the field a single ink underline — set straight on the paper. */
.filter-toggle {
  display: inline-block; margin-bottom: var(--space-3);
  padding: 10px 18px; border: 1px solid var(--color-ink); border-radius: 2px;
  background: transparent; color: var(--color-ink); font-size: var(--fs-tagline); font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.filter-panel {
  border-top: 2px solid var(--color-ink);
  padding: var(--space-3) 0 var(--space-2); margin-bottom: var(--space-4);
}
.filter-panel.is-collapsed { display: none; }
.filter-panel-title {
  font-size: var(--fs-kicker); font-weight: 700; letter-spacing: 0.1em;
  color: var(--color-gold-dark); margin: 0 0 var(--space-3);
}
.filter-group { margin-bottom: var(--space-4); }
.filter-group:last-child { margin-bottom: 0; }
.filter-group label { display: block; font-size: var(--fs-meta); font-weight: 700; color: var(--color-text-sub); margin-bottom: 2px; }
.filter-group select {
  width: 100%; padding: 8px 24px 8px 0; min-height: 40px;
  border: none; border-bottom: 1px solid var(--color-ink); border-radius: 0;
  background: transparent; color: var(--color-text);
  font-size: var(--fs-body); font-family: inherit;
}
.filter-group select:hover { border-bottom-color: var(--color-heri); }

/* Applied-filter chips sit above the results at all times (spec §4.2) */
.applied-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--space-3); }
.applied-row:empty { display: none; }
.applied-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-meta); font-weight: 700;
  padding: 3px 4px 3px 10px; border-radius: 2px;
  background: var(--color-gold-light); color: var(--color-text); border: 1px solid var(--color-gold);
}
.applied-chip button {
  border: none; background: transparent; color: var(--color-text); cursor: pointer;
  font-size: 15px; line-height: 1; min-width: 28px; min-height: 28px;
}
.result-count { font-size: var(--fs-tagline); color: var(--color-text-sub); margin: 0 0 var(--space-3); }

/* Subcategory axis: the same ruled text tabs as the main nav (round 5),
   current = deep-gold text on a gold underline (gold role #5). */
.subcategory-pills {
  display: flex; gap: 0; overflow-x: auto; white-space: nowrap;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-6); scrollbar-width: none;
}
.subcategory-pills::-webkit-scrollbar { display: none; }
.subcategory-pills a {
  position: relative; padding: 10px 14px;
  color: var(--color-text); text-decoration: none; font-size: var(--fs-tagline);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subcategory-pills a:first-child { padding-inline-start: 0; }
.subcategory-pills a + a::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 50%;
  width: 1px; height: 11px; margin-top: -5px; background: var(--color-border);
}
.subcategory-pills a:hover { color: var(--color-heri-dark); text-decoration: none; }
.subcategory-pills a.is-current { border-bottom-color: var(--color-gold); color: var(--color-gold-dark); font-weight: 700; }

/* Empty state (spec §5): a designed surface with a way out */
.empty-state {
  background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-img);
  padding: var(--space-6) var(--space-4); text-align: center;
}
.empty-state p { color: var(--color-text-sub); margin: 0 0 var(--space-3); }
.empty-state .reset-button {
  border: 1px solid var(--color-ink); background: transparent; color: var(--color-ink);
  font-weight: 700; font-size: var(--fs-tagline);
  padding: 8px 18px; border-radius: 2px; cursor: pointer;
}
.empty-message { color: var(--color-text-sub); padding: var(--space-6) 0; }

/* "Show more" for the All items shelf (spec §4.1) */
.show-more-row { text-align: center; margin-top: var(--space-4); }
.show-more-button {
  border: 1px solid var(--color-ink); background: transparent; color: var(--color-ink);
  font-weight: 700; font-size: var(--fs-tagline);
  padding: 10px 28px; border-radius: 2px; cursor: pointer;
}

/* Loading skeleton: shelf-shaped empty boxes, no theatrics (spec §5) */
.skeleton-media {
  aspect-ratio: 16 / 9; border-radius: var(--radius-img);
  background: var(--color-surface); margin-bottom: var(--space-2);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
.skeleton-line { height: 14px; border-radius: 4px; background: var(--color-surface); margin-bottom: var(--space-2); animation: skeleton-pulse 1.4s ease-in-out infinite; }
@keyframes skeleton-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---------- Item detail (spec §4.3 order) ---------- */
.detail-hero { margin-bottom: var(--space-6); }
.detail-hero-media {
  aspect-ratio: 16 / 9; border-radius: var(--radius-img); overflow: hidden;
  background: var(--color-surface); margin-bottom: var(--space-4);
  border: 1px solid var(--color-border);
}
.detail-hero-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.detail-hero-media .text-tile-name { font-size: var(--fs-h2); }
.detail-title { font-size: 24px; line-height: 1.3; margin: 0 0 var(--space-1); }
/* The tagline is the work's one-line introduction: set as a lede */
.detail-tagline { color: var(--color-text); font-size: var(--fs-card-name); margin: 0 0 var(--space-3); }
.detail-meta-summary { font-size: var(--fs-tagline); color: var(--color-text-sub); margin: var(--space-3) 0 0; }

.detail-section { margin: 0 0 var(--space-8); max-width: 720px; }
.detail-section h2 { font-size: var(--fs-h2); line-height: 1.3; margin: 0 0 var(--space-2); }
.detail-section p, .detail-section li { font-size: var(--fs-body); }

/* Item introduction texts speak Mincho (reina, 2026-11-24): the
   tagline under the title, the free-scope note, the overview and
   the how-to steps are the item's 紹介文 — prose to be read, so it
   takes the serif voice with the wider line height and a touch of
   letter air that Mincho needs to stay easy on the eye. The meta
   table (dt/dd) and the chips stay sans: they are data, not prose. */
.detail-tagline, .hero-tagline,
.detail-section p, .detail-section li,
.free-scope-box {
  font-family: var(--font-display);
  line-height: 1.9;
  letter-spacing: 0.02em;
}
/* The kicker inside the free-scope box keeps its label voice */
.free-scope-box .kicker { font-family: var(--font-body); line-height: 1.5; letter-spacing: 0.1em; }

/* Numbered how-to steps (spec §4.3 #4) */
.howto-list { margin: 0; padding: 0; list-style: none; counter-reset: howto-step; }
.howto-list li {
  counter-increment: howto-step;
  position: relative; padding-inline-start: 40px; margin-bottom: var(--space-3);
}
.howto-list li::before {
  content: counter(howto-step);
  position: absolute; inset-inline-start: 0; top: 1px;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--color-heri); background: var(--color-bg);
  color: var(--color-heri-dark);
  font-weight: 700; font-size: var(--fs-tagline); line-height: 26px; text-align: center;
}

/* Free scope sits directly under the hero (spec §4.3 #2) */
.free-scope-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border); border-inline-start: 3px solid var(--color-heri);
  border-radius: var(--radius-img); padding: var(--space-3) var(--space-4);
  font-size: var(--fs-body); max-width: 720px; margin-bottom: var(--space-8);
}
.free-scope-box .kicker { margin-bottom: var(--space-1); }

/* Meta table (spec §4.3 #6): one dl, labels quiet, values plain */
.detail-meta-table { margin: 0; max-width: 720px; }
.detail-meta-table .meta-row {
  display: grid; grid-template-columns: 128px 1fr; gap: var(--space-3);
  padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border);
  font-size: var(--fs-tagline);
}
.detail-meta-table dt { color: var(--color-text-sub); font-weight: 700; margin: 0; }
.detail-meta-table dd { margin: 0; overflow-wrap: anywhere; }
.meta-link { display: inline-block; padding: 2px 0; }
.detail-after-meta { margin: var(--space-4) 0 var(--space-8); }
/* The colophon (奥付) heading reads as a label, set small above a rule */
.detail-colophon .detail-section h2 {
  font-size: var(--fs-card-name); padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--color-text); margin-bottom: 0;
}

/* Problems page (round 5): each row is a question and its answer — the
   problem in Mincho beside a kanji numeral, then the work (image, name,
   traction) or the category it leads to. Ruled like the 目次. */
.problem-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--color-ink); }
.problem-list li { border-bottom: 1px solid var(--color-border); }
.problem-tile {
  display: grid; grid-template-columns: 32px 1fr; gap: var(--space-2) var(--space-3);
  padding: var(--space-4) 0; text-decoration: none; color: var(--color-text);
}
.problem-tile:hover { text-decoration: none; }
.problem-tile:hover .problem-target { color: var(--color-gold-dark); }
.problem-num { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-h2); color: var(--color-heri); line-height: 1.3; }
.problem-text { font-family: var(--font-display); font-weight: 700; font-size: 18px; line-height: 1.55; letter-spacing: 0.02em; }
.problem-answer {
  grid-column: 2; display: grid; grid-template-columns: 120px 1fr; gap: var(--space-3); align-items: center;
}
.problem-media { aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--color-border); border-radius: 2px; background: var(--color-surface); }
.problem-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.problem-cap { display: block; min-width: 0; }
.problem-go { display: block; font-size: var(--fs-kicker); font-weight: 700; letter-spacing: 0.08em; color: var(--color-gold-dark); }
.problem-target { display: block; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-card-name); line-height: 1.4; }
.problem-tagline { display: block; font-size: var(--fs-tagline); color: var(--color-text-sub); }

/* ---------- Footer ---------- */
/* The room closes the way it opened: a stitched heri band, then the
   woven igusa floor of the footer itself. */
.site-footer {
  background: var(--color-surface);
  margin-top: var(--space-12);
}
.site-footer::before {
  content: ""; display: block; height: 8px;
  background: var(--heri-band);
}
.footer-brand {
  max-width: 1200px; margin: 0 auto; padding: var(--space-8) var(--page-pad) 0;
  display: flex; align-items: baseline; gap: var(--space-3);
}
/* The footer signs the room with the same brush hand as the header */
.footer-brand-name { display: block; height: 26px; width: auto; }
.footer-brand { align-items: center; flex-wrap: wrap; row-gap: var(--space-1); }
.footer-brand .brand-seal { width: 44px; height: 44px; }
.footer-brand-note { font-size: var(--fs-meta); color: var(--color-text-sub); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.criteria, .footer-note { max-width: 1200px; margin: 0 auto; padding: var(--space-3) var(--page-pad); }
.criteria h2 { font-size: var(--fs-card-name); }
.criteria li { font-size: var(--fs-tagline); color: var(--color-text-sub); }
.footer-note { font-size: 12px; color: var(--color-text-sub); }

/* =====================================================================
   Tablet: 640px and up — 2-column cards & categories
   ===================================================================== */
@media (min-width: 640px) {
  .card-grid { grid-template-columns: 1fr 1fr; gap: var(--space-6) var(--space-4); }
  .card-grid-feature .card-lead { grid-column: span 2; }
  .category-index { grid-template-columns: 1fr 1fr; column-gap: var(--space-8); }
  .index-link { grid-template-columns: 160px 1fr auto; gap: var(--space-4); }
  .index-media { grid-row: auto; }
  .index-side { grid-column: auto; flex-direction: column; align-items: flex-end; gap: var(--space-1); }
  .problem-tile { grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
  .problem-answer { grid-column: 3; grid-template-columns: 136px 1fr; }
  .page h1 { font-size: 34px; }
  .page h1 { font-size: var(--fs-h1); }
  .detail-title { font-size: var(--fs-h1); }
  .hero-name { font-size: var(--fs-h1); }
}

/* =====================================================================
   PC: 1024px and up — 3-column cards (4 on wide shelves), sticky filter
   sidebar, detail hero in two columns, readable text width
   ===================================================================== */
@media (min-width: 1024px) {
  .card-grid { grid-template-columns: 1fr 1fr 1fr; }
  .card-grid-wide { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .card-grid-feature .card-lead { grid-row: span 2; }
  .card-grid-feature .card-lead .card-media { margin-bottom: var(--space-3); }
  .category-index { grid-template-columns: 1fr 1fr 1fr; }
  .brand-name { height: 22px; }

  /* Filters live in a 240px left column and stick while results scroll */
  .listing-layout { display: grid; grid-template-columns: 240px 1fr; gap: var(--space-6); align-items: start; }
  .filter-toggle { display: none; }
  .filter-panel { position: sticky; top: var(--space-4); margin-bottom: 0; }
  .filter-panel.is-collapsed { display: block; }

  /* Detail hero: media left, decision info right (Steam's fixed gaze end) */
  .detail-hero { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--space-6); align-items: start; }
  .detail-hero-media { margin-bottom: 0; }

  /* Home hero (round 3): the work beside its words. The image keeps
     its true 16:9 (the 21:9 banner crop cut the works' own art — the
     cat's ears, a title line), and the text sits low on the right,
     aligned to the image's foot like a caption card in an exhibition. */
  .hero { display: grid; grid-template-columns: 1.7fr 1fr; gap: var(--space-8); align-items: end; }
  .hero-media { margin-bottom: 0; }
  .hero-info { padding-bottom: var(--space-2); }
  .hero-tagline { font-size: var(--fs-card-name); color: var(--color-text); }

  /* Detail body: read column + colophon column (奥付), round 3 */
  .detail-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--space-12); align-items: start; }
  .detail-colophon { position: sticky; top: var(--space-4); }

  /* お品書き in two columns: a menu board, not a long spreadsheet */
  .index-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--space-12); }
  .detail-colophon .detail-meta-table .meta-row { grid-template-columns: 104px 1fr; }
}


/* =====================================================================
   World languages (reina, 2026-11-24): 16 UI languages, Arabic RTL.
   Layout uses logical properties (inline-start/end), so dir="rtl"
   mirrors it. Each script gets its own type stacks (system faces only):
   Japanese Mincho must not render Chinese, Korean, Thai, Arabic or
   Devanagari text.
   ===================================================================== */
:lang(zh-Hans) {
  --font-display: "Songti SC", "STSong", "Noto Serif SC", "Noto Serif CJK SC", "SimSun", serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
}
:lang(zh-Hant) {
  --font-display: "Songti TC", "Noto Serif TC", "Noto Serif CJK TC", "PMingLiU", serif;
  --font-body: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Noto Sans CJK TC", sans-serif;
}
:lang(ko) {
  --font-display: "AppleMyungjo", "Nanum Myeongjo", "Noto Serif KR", "Noto Serif CJK KR", "Batang", serif;
  --font-body: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans CJK KR", sans-serif;
}
:lang(en), :lang(es), :lang(pt), :lang(fr), :lang(de), :lang(id), :lang(vi), :lang(tr), :lang(ru) {
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Noto Serif", serif;
  --font-body: "Helvetica Neue", "Segoe UI", Arial, "Noto Sans", sans-serif;
}
:lang(th) {
  --font-display: "Noto Serif Thai", "Thonburi", "Leelawadee UI", serif;
  --font-body: "Noto Sans Thai", "Thonburi", "Leelawadee UI", "Tahoma", sans-serif;
}
:lang(hi) {
  --font-display: "Noto Serif Devanagari", "Kohinoor Devanagari", "Nirmala UI", serif;
  --font-body: "Noto Sans Devanagari", "Kohinoor Devanagari", "Nirmala UI", sans-serif;
}
:lang(ar) {
  --font-display: "Noto Naskh Arabic", "Geeza Pro", "Times New Roman", serif;
  --font-body: "Noto Sans Arabic", "Geeza Pro", "Segoe UI", "Tahoma", sans-serif;
}
/* Arabic letters join; any letter-spacing breaks the words apart */
[lang="ar"] * { letter-spacing: 0 !important; }
/* Kicker labels are upper-cased only where the script has case */
:lang(zh-Hans) .kicker, :lang(zh-Hant) .kicker, :lang(ko) .kicker,
:lang(th) .kicker, :lang(hi) .kicker, :lang(ar) .kicker { text-transform: none; }

/* Headline as live text (languages without a lettered SVG) */
.page .masthead-title-text {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(32px, 5vw, 64px); line-height: 1.15; letter-spacing: 0.01em;
  word-break: auto-phrase; max-width: 22ch;
}
/* A quiet note when an item text is shown in English */
.fallback-note {
  font-family: var(--font-body) !important; font-size: var(--fs-meta) !important;
  color: var(--color-text-sub); margin: 0 0 var(--space-2);
}


/* =====================================================================
   Round 6 — 四畳半の棚 (creativity / design pass, 2026-11-24)
   The tatami returns as the site's idea, not as a costume: works are
   laid on mats. Every work image sits in a mat frame (heri edge + woven
   margin), which also unifies the makers' very different official
   images; the home opens on a 4.5-mat room seen from above.
   ===================================================================== */

/* Mat frame for every work image: heri (deep green cloth edge) and a
   thin woven igusa margin between the cloth and the picture. */
.card-media, .hero-media, .detail-hero-media, .index-media, .problem-media, .mat-media {
  padding: 4px;
  background: var(--weave), var(--color-tatami);
  border: 2px solid var(--color-heri);
  border-radius: 2px;
}
.card-media img, .hero-media img, .detail-hero-media img, .index-media img,
.problem-media img, .mat-media img { border-radius: 1px; }
.index-media, .problem-media { padding: 3px; border-width: 1px; }
.hero-media, .detail-hero-media { padding: 6px; border-width: 3px; }

/* Lifting a mat: the card rises a little and casts a soft shadow */
.card .card-media { transition: transform 220ms ease, box-shadow 220ms ease; }
.card:hover .card-media, .card:focus-visible .card-media {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(31, 53, 39, 0.18);
}
.card:hover .card-media img { transform: none; }

/* Editorial kanji mark, one per shelf */
.shelf { position: relative; }
.shelf-mark {
  position: absolute; inset-inline-end: 0; top: -0.28em;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", "Noto Serif JP", serif;
  font-weight: 900; font-size: clamp(88px, 13vw, 188px); line-height: 1;
  color: var(--color-heri); opacity: 0.075;
  pointer-events: none; user-select: none; z-index: 0;
}
.shelf > :not(.shelf-mark) { position: relative; z-index: 1; }

/* ---------- The 4.5-mat room ----------
   3 x 3 half-mat units. Pinwheel: top (h), right (v), bottom (h),
   left (v), half mat in the middle. Heri runs along each mat's LONG
   sides, as on a real tatami; the room is framed in sumi. */
.tatami-room {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  aspect-ratio: 1 / 1;
  gap: 3px;
  padding: 3px;
  background: #b5ad86;               /* the seams between mats */
  border: 6px solid var(--color-ink); /* lacquered sumi frame of the room */
  border-radius: 2px;
  box-shadow: 0 18px 40px rgba(31, 53, 39, 0.16);
}
.mat {
  position: relative; display: flex; gap: 8px; min-width: 0; min-height: 0;
  padding: 10px;
  background: var(--weave-coarse), var(--color-tatami);
  text-decoration: none; color: var(--color-text);
  overflow: hidden;
}
.mat:hover { text-decoration: none; }
.mat-1 { grid-area: 1 / 1 / 2 / 3; }   /* top, horizontal */
.mat-2 { grid-area: 1 / 3 / 3 / 4; }   /* right, vertical */
.mat-3 { grid-area: 3 / 2 / 4 / 4; }   /* bottom, horizontal */
.mat-4 { grid-area: 2 / 1 / 4 / 2; }   /* left, vertical */
.mat-half { grid-area: 2 / 2 / 3 / 3; display: grid; place-items: center; padding: 0; }
.mat-h { flex-direction: row; align-items: center;
  border-top: 5px solid var(--color-heri); border-bottom: 5px solid var(--color-heri); }
.mat-v { flex-direction: column;
  border-inline-start: 5px solid var(--color-heri); border-inline-end: 5px solid var(--color-heri); }
/* the woven grain runs along the mat: rotate it on vertical mats */
.mat-v { background: var(--weave-coarse), var(--color-tatami); background-size: auto; }
.mat-media { flex: none; aspect-ratio: 16 / 9; overflow: hidden; padding: 2px; border-width: 1px; }
.mat-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mat-h .mat-media { width: 56%; }
.mat-v .mat-media { width: 100%; }
.mat-cap { display: block; min-width: 0; }
.mat-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-body); line-height: 1.35;
  margin-bottom: 2px;
}
.mat .traction {
  font-size: 11px; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.mat .traction::before { display: none; }
.mat:hover .mat-name { color: var(--color-gold-dark); }
.mat:hover { background-color: #ece5c6; }
.mat-seal { width: 46%; height: auto; transform: rotate(-4deg); filter: drop-shadow(0 3px 4px rgba(31, 53, 39, 0.25)); }

/* Mats are laid down one by one when the room appears */
@keyframes mat-lay {
  from { opacity: 0; transform: translateY(-10px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
.tatami-room .mat { animation: mat-lay 520ms cubic-bezier(.2,.7,.2,1) both; }
.tatami-room .mat-1 { animation-delay: 80ms; }
.tatami-room .mat-2 { animation-delay: 200ms; }
.tatami-room .mat-3 { animation-delay: 320ms; }
.tatami-room .mat-4 { animation-delay: 440ms; }
.tatami-room .mat-half { animation-delay: 620ms; }
@media (prefers-reduced-motion: reduce) {
  .tatami-room .mat, .card .card-media { animation: none; transition: none; }
  .card:hover .card-media { transform: none; }
}

/* Phones: the room spans the width; captions shrink, traction hides on
   the horizontal mats where there is no room for it. */
@media (max-width: 639px) {
  .mat { padding: 6px; gap: 6px; }
  .mat-h { border-top-width: 4px; border-bottom-width: 4px; }
  .mat-v { border-inline-start-width: 4px; border-inline-end-width: 4px; }
  .mat-name { font-size: 12px; }
  .mat-h .traction { display: none; }
  .mat .traction { font-size: 10.5px; }
  .shelf-mark { opacity: 0.06; }
}
@media (min-width: 1024px) {
  .masthead-works { align-self: center; }
}

/* The room is alive (round 6): daylight through a shoji drifts slowly
   across the mats, and a mat rises when you reach for it. */
.tatami-room { position: relative; }
.tatami-room::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(112deg, transparent 32%, rgba(255, 251, 232, 0.38) 46%, transparent 60%);
  background-size: 260% 100%;
  animation: shoji-light 14s ease-in-out infinite alternate;
}
@keyframes shoji-light { from { background-position: 100% 0; } to { background-position: 0 0; } }
.tatami-room a.mat { transition: transform 200ms ease, box-shadow 200ms ease; }
.tatami-room a.mat:hover, .tatami-room a.mat:focus-visible {
  transform: translateY(-3px); z-index: 2;
  box-shadow: 0 10px 18px rgba(25, 27, 22, 0.28);
}
@media (prefers-reduced-motion: reduce) {
  .tatami-room::after { animation: none; opacity: 0.5; }
  .tatami-room a.mat { transition: none; }
  .tatami-room a.mat:hover { transform: none; }
}

/* Round 7: works without an official image yet sit on a plain mat —
   the woven igusa, the category in small caps and the work's name set
   large in Mincho, centred — an intentional card, not a missing picture. */
.text-tile {
  align-items: center; text-align: center;
  border-inline-start: none;
  background: var(--weave-coarse), var(--color-tatami);
  padding: var(--space-3);
}
.text-tile .kicker { justify-content: center; margin-bottom: var(--space-2); }
.text-tile .kicker::before { display: none; }
.text-tile-name {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(15px, 1.6vw, 22px); line-height: 1.35; letter-spacing: 0.02em;
  color: var(--color-ink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-media .text-tile-name, .detail-hero-media .text-tile-name { font-size: clamp(22px, 3vw, 36px); }
.index-media .text-tile-name, .problem-media .text-tile-name, .mat-media .text-tile-name { font-size: 11px; -webkit-line-clamp: 2; }

/* =====================================================================
   Round 7 — the interactive room
   畳をめくる: a mat turns over on its own axis (horizontal mats flip
   top-over, vertical mats flip side-over) to show its back. 時間帯の光:
   the room is lit for the visitor's hour.
   ===================================================================== */
.mat:not(.mat-half) {
  display: block; padding: 0; gap: 0; border: none;
  background: none; overflow: visible; perspective: 1100px;
}
.mat-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 640ms cubic-bezier(.3,.7,.2,1);
}
.mat-face {
  position: absolute; inset: 0;
  display: flex; gap: 8px; padding: 10px; min-width: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--weave-coarse), var(--color-tatami);
  color: var(--color-text); text-align: start;
  font: inherit; border: none; margin: 0; cursor: pointer;
}
.mat-h .mat-face { flex-direction: row; align-items: center;
  border-top: 5px solid var(--color-heri); border-bottom: 5px solid var(--color-heri); }
.mat-v .mat-face { flex-direction: column;
  border-inline-start: 5px solid var(--color-heri); border-inline-end: 5px solid var(--color-heri); }
.mat-front:hover { background-color: #ece5c6; }
.mat-front:hover .mat-name { color: var(--color-gold-dark); }
.mat-front:focus-visible { outline: 2px solid var(--color-gold); outline-offset: -4px; }
/* lift on reach (front only) */
.mat:not(.is-turned) .mat-front:hover { box-shadow: 0 10px 18px rgba(25, 27, 22, 0.28); }

/* the back of the mat: a little paler, the facts and the ways on */
.mat-back {
  flex-direction: column !important; align-items: stretch !important; justify-content: center;
  gap: 6px; cursor: default;
  background: var(--weave), #f1ecd6;
}
.mat-h .mat-back { transform: rotateX(180deg); }
.mat-v .mat-back { transform: rotateY(180deg); }
.mat-h.is-turned .mat-inner { transform: rotateX(180deg); }
.mat-v.is-turned .mat-inner { transform: rotateY(180deg); }
.mat.is-turned { z-index: 3; }
.mat-back-name { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-body); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.mat-back-tagline { margin: 0; font-family: var(--font-display); font-size: 12.5px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mat-back-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: var(--fs-meta); }
.mat-back-link { font-weight: 700; padding: 4px 0; }
.mat-turnback {
  align-self: flex-start; margin-top: 2px; padding: 4px 8px;
  border: 1px solid var(--color-heri); background: transparent; color: var(--color-heri-dark);
  font: inherit; font-size: var(--fs-meta); font-weight: 700; border-radius: 2px; cursor: pointer;
}
.mat-turnback:hover { background: rgba(46, 75, 58, 0.08); }

.room-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.room-light { font-size: var(--fs-meta); color: var(--color-text-sub); letter-spacing: 0.04em; }
.room-light::before { content: "◐ "; color: var(--color-heri); }
.room-hint { margin: var(--space-2) 0 0; font-size: var(--fs-meta); color: var(--color-text-sub); text-align: center; }

/* ---- Light of the hour (applied over the drifting shoji light) ---- */
.tatami-room[data-light="morning"]::after {
  background: linear-gradient(100deg, rgba(255, 246, 220, 0.55) 0%, rgba(255, 246, 220, 0.18) 35%, transparent 62%),
              linear-gradient(112deg, transparent 32%, rgba(255, 251, 232, 0.32) 46%, transparent 60%);
  background-size: 100% 100%, 260% 100%;
}
.tatami-room[data-light="day"]::after {
  background: radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 246, 0.42), transparent 70%),
              linear-gradient(112deg, transparent 32%, rgba(255, 251, 232, 0.30) 46%, transparent 60%);
  background-size: 100% 100%, 260% 100%;
}
.tatami-room[data-light="evening"]::after {
  /* low, golden light from the other side (amber, never red) */
  background: linear-gradient(260deg, rgba(255, 214, 150, 0.50) 0%, rgba(255, 220, 160, 0.16) 40%, transparent 66%),
              linear-gradient(248deg, transparent 32%, rgba(255, 226, 170, 0.30) 46%, transparent 60%);
  background-size: 100% 100%, 260% 100%;
}
.tatami-room[data-light="night"] { background: #8f8a6a; }
.tatami-room[data-light="night"] .mat-face, .tatami-room[data-light="night"] .mat-half { filter: brightness(0.84) saturate(0.9); }
.tatami-room[data-light="night"]::after {
  /* a paper lamp on the half mat */
  background: radial-gradient(42% 42% at 50% 50%, rgba(255, 226, 168, 0.55), rgba(255, 226, 168, 0.12) 60%, transparent 75%);
  background-size: 100% 100%;
  animation: lamp-breathe 5s ease-in-out infinite alternate;
}
@keyframes lamp-breathe { from { opacity: 0.85; } to { opacity: 1; } }

@media (max-width: 639px) {
  .mat-face { padding: 6px; gap: 6px; }
  .mat-h .mat-face { border-top-width: 4px; border-bottom-width: 4px; }
  .mat-v .mat-face { border-inline-start-width: 4px; border-inline-end-width: 4px; }
  .mat-h .mat-front .traction { display: none; }
  .mat-back-tagline { -webkit-line-clamp: 2; font-size: 11.5px; }
  .mat-back { gap: 3px; }
  .mat-turnback { padding: 2px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .mat-inner { transition: none; }
  .tatami-room[data-light="night"]::after { animation: none; }
}

/* How-to-use tag (round 7): "play in the browser" is the easy path, so it
   gets the heri-green mark; app / LINE / setup stay quiet outlines. */
.chip-access { background: transparent; border-color: var(--color-border); color: var(--color-text-sub); }
.chip-access-browser { border-color: var(--color-heri); color: var(--color-heri-dark); font-weight: 700; }
.chip-access-browser::before { content: "▶ "; font-size: 0.85em; }

/* Contact page (round 7) */
.contact-list { display: grid; gap: var(--space-6); max-width: 760px; margin: var(--space-6) 0; }
.contact-block { padding-inline-start: var(--space-4); border-inline-start: 3px solid var(--color-heri); }
.contact-block h2 { font-family: var(--font-display); font-size: var(--fs-h2); margin: 0 0 var(--space-2); }
.contact-block p { font-family: var(--font-display); line-height: 1.9; margin: 0; }
.contact-action { max-width: 760px; margin-bottom: var(--space-12); }
.contact-pending { font-weight: 700; color: var(--color-heri-dark); margin: 0 0 var(--space-2); }
.contact-privacy { font-size: var(--fs-meta); color: var(--color-text-sub); margin: var(--space-3) 0 0; }
