/*
  kami (紙 / 纸): faithful spec for the design bank component library.
  Source: source/claude-design-systems/kami/project/README.md (the guide) and tokens.json.
  Where the guide and tokens.json disagree, the README guide wins (it is the written spec).
  "SILENT" marks a value the guide does not give, with the reason for the choice.
*/

:root {
  /* Named kami palette (guide section 2) */
  --kami-parchment: #f5f4ed;
  --kami-ivory: #faf9f5;
  --kami-warm-sand: #e8e6dc;
  --kami-dark-surface: #30302e;
  --kami-deep-dark: #141413;
  --kami-near-black: #141413;
  --kami-dark-warm: #3d3d3a;
  --kami-olive: #504e49;
  --kami-stone: #6b6a64;
  --kami-border: #e8e6dc;
  --kami-border-soft: #e5e3d8;
  --kami-brand: #1B365D;
  --kami-brand-light: #2D5A8A;
  --kami-brand-active: #142a48;        /* tokens.json accent-active */
  --kami-tag-faint: #EEF2F7;           /* 0.08 */
  --kami-tag-soft: #E4ECF5;            /* 0.14 and 0.18 default tag */
  --kami-tag-strong: #D0DCE9;          /* 0.22 */
  --kami-tag-base: #D6E1EE;            /* 0.30 */
  --kami-whisper: 0 4px 24px rgba(0, 0, 0, 0.05);

  /* Font stacks (guide section 3). Charter is the spec face; Charis SIL (Google Fonts,
     a free revival of Bitstream Charter) is the stand-in when Charter is not installed. */
  --serif: Charter, "Charis SIL", Georgia, Palatino, "Times New Roman", serif;
  --serif-ja: "YuMincho", "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", "Noto Serif CJK JP", "Source Han Serif JP", "TsangerJinKai02", Georgia, serif;
  --mono: "JetBrains Mono", "SF Mono", "Fira Code", Consolas, Monaco, "TsangerJinKai02", "Source Han Serif SC", monospace;
  --sans: var(--serif);                /* guide: sans always equals serif */

  /* Colour roles */
  --c-bg: var(--kami-parchment);
  --c-surface: var(--kami-ivory);
  --c-surface-2: var(--kami-warm-sand);
  --c-inverse: var(--kami-deep-dark);  /* SILENT for web: guide's dark-theme page background */
  --c-on-inverse: var(--kami-ivory);   /* SILENT: ivory text, as on ink-blue cover slides */
  --c-fg: var(--kami-near-black);
  --c-fg-2: var(--kami-dark-warm);
  --c-muted: var(--kami-olive);
  --c-border: var(--kami-border);
  --c-accent: var(--kami-brand);
  --c-on-accent: var(--kami-ivory);
  --c-accent-hover: var(--kami-brand); /* tokens.json: accent-hover = {accent}, no hover shift */
  --c-link: var(--kami-brand);         /* "link text on light surfaces" */
  --c-focus: 0 0 0 2px #142a48;        /* tokens.json focus-ring */

  /* Type families */
  --f-display: var(--serif);
  --f-body: var(--serif);
  --f-mono: var(--mono);
  --f-features: normal;                /* tabular-nums only on stacks and tables, never prose */

  /* Type roles (guide hierarchy table, screen px) */
  --t-display-size: 96px; --t-display-weight: 500; --t-display-lh: 1.05; --t-display-track: -1.2px;
  /* Section title: 28 to 32px, 500, 1.20, 0.4px. c-h2 carries the section title. */
  --t-h2-size: 32px; --t-h2-weight: 500; --t-h2-lh: 1.2; --t-h2-track: 0.4px;
  /* H3 17 to 18px: 17px chosen, it matches tokens.json text-lg */
  --t-h3-size: 17px; --t-h3-weight: 500; --t-h3-lh: 1.3; --t-h3-track: 0px;
  /* Lede 15 to 16px: 16px chosen, it matches the section header prompt */
  --t-lead-size: 16px; --t-lead-weight: 500; --t-lead-lh: 1.55;
  --t-body-size: 14px; --t-body-weight: 400; --t-body-lh: 1.55;
  /* Caption */
  --t-small-size: 12px; --t-small-weight: 500; --t-small-lh: 1.45;
  /* Eyebrow / overline: sans (= serif) 12px 500, 1.2px, uppercase */
  --t-label-size: 12px; --t-label-weight: 500; --t-label-track: 1.2px; --t-label-case: uppercase; --t-label-font: var(--sans);
  /* Button: font 500 12px/1, tracking 0.4px, no case change */
  --t-button-size: 12px; --t-button-weight: 500; --t-button-track: 0.4px; --t-button-case: none;
  /* SILENT: nav links are the "meta header", so they take eyebrow size and weight */
  --t-nav-size: 12px; --t-nav-weight: 500;

  /* Layout and spacing (guide section 5, tokens.json spacing) */
  --s-container: 1120px;
  --s-gutter: 64px;                    /* desktop; 32px tablet, 16px phone below */
  /* Section gap is 72px between sections, so each section pads half of it top and bottom */
  --s-section: 36px;
  /* Used only by the hero top: the page top padding of 88px */
  --s-section-sm: 88px;
  --s-stack: 16px;                     /* SILENT: space-4, between heading and body in a block */
  --s-grid-gap: 24px;                  /* SILENT: space-6 between cards */
  --s-list-gap: 6px;                   /* SILENT: dense list rhythm, keeps items reading as one list */

  /* Shape and depth (guide section 6) */
  --r-sm: 4px; --r-md: 8px; --r-lg: 12px; --r-pill: 9999px;
  --shadow-1: 0 0 0 1px var(--kami-border);   /* Ring */
  --shadow-2: var(--kami-whisper);            /* Whisper */
  --border-w: 1px;

  /* Components */
  --nav-height: 56px;                  /* SILENT: no nav height in the guide, a quiet meta header */
  --nav-bg: var(--kami-parchment); --nav-border: var(--kami-border); --nav-radius: 0; --nav-inset: 0px;
  /* Button padding 8px 14px, 12px/1 text, 1px ring: 8 + 12 + 8 + 2 = 30px */
  --btn-height: 30px; --btn-pad-x: 14px; --btn-radius: 8px;
  --btn-primary-bg: var(--kami-brand); --btn-primary-fg: var(--kami-ivory); --btn-primary-border: var(--kami-brand); --btn-primary-hover-bg: var(--kami-brand);
  --btn-secondary-bg: var(--kami-warm-sand); --btn-secondary-fg: var(--kami-dark-warm); --btn-secondary-border: var(--kami-border);
  --btn-secondary-hover-bg: var(--kami-warm-sand); /* SILENT: no hover shift, matching accent-hover */
  --btn-hover-transform: none; --btn-active-transform: none; --btn-transition: 0.2s ease;
  --card-bg: var(--kami-ivory); --card-border: var(--kami-border); --card-radius: 8px; --card-pad: 28px; --card-shadow: none; --card-media-radius: 0;
  --tag-bg: var(--kami-tag-faint); --tag-fg: var(--kami-brand); --tag-radius: 2px; --tag-pad: 2px 7px;
  /* SILENT: field height matches the button; radius from tokens.json radius-sm "inputs" */
  --field-bg: var(--kami-ivory); --field-border: var(--kami-border); --field-radius: 4px; --field-height: 30px;
  --list-marker-colour: var(--kami-brand); --list-divider: 1px solid var(--kami-border-soft);
  /* Manifesto / pull quote: serif 20px 400, 1.65, 0.05em (tracking added in .x-manifesto) */
  --quote-size: 20px; --quote-font: var(--serif); --quote-weight: 400; --quote-lh: 1.65;
  /* Metric value: serif 500 24px ink-blue */
  --stat-size: 24px; --stat-weight: 500; --stat-colour: var(--kami-brand); --stat-font: var(--serif);
  /* SILENT: a closing call to action sits in a lifted ivory container, never an ink-blue wash (5% rule) */
  --cta-bg: var(--kami-ivory); --cta-fg: var(--kami-near-black); --cta-radius: 12px;
  --footer-bg: var(--kami-parchment); --footer-fg: var(--kami-olive); --footer-border: var(--kami-border);
  --media-radius: 12px; --media-shadow: var(--kami-whisper);
}

/* Container side gutter: 64 desktop, 32 tablet, 16 phone. Section gap: 72, 48, 32. */
@media (max-width: 979px) { :root { --s-gutter: 32px; --s-section: 24px; } }
@media (max-width: 767px) {
  :root {
    --s-gutter: 16px; --s-section: 16px; --s-section-sm: 48px;
    --t-display-size: 46px; --t-display-lh: 1.1;   /* phone hero 46px */
    --t-h2-size: 24px;                             /* phone section title 24px */
    --quote-size: 17px;                            /* phone manifesto 17px */
  }
}

/* Base: guide weight and style rules */
body { color: var(--c-fg); }           /* primary reading text is Near Black */
strong, b { font-weight: 500; }        /* never synthesise bold */
em, i, cite { font-style: normal; }    /* no italic anywhere */
html { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
a:hover { color: var(--kami-brand-active); }

/* ---------- x- components ---------- */

/* Meta header nav: eyebrow style links */
.x-meta .c-nav__links a { text-transform: uppercase; letter-spacing: 1.2px; color: var(--kami-stone); line-height: 1; }
.x-meta .c-nav__links a:hover { color: var(--kami-brand); }
.x-meta .c-nav__brand { font-size: 17px; letter-spacing: 0; }
.x-meta .c-nav__brand span { color: var(--kami-stone); }

/* Switcher: eyebrow type, active item ink-blue */
.x-switcher { display: inline-flex; gap: 4px; align-items: center; font: 500 12px/1 var(--sans); letter-spacing: 1.2px; text-transform: uppercase; }
.x-switcher a { display: inline-flex; align-items: center; min-height: 30px; padding: 0 8px; border-radius: 4px; color: var(--kami-stone); text-decoration: none; }
.x-switcher a[aria-current="true"] { color: var(--kami-brand); background: var(--kami-tag-faint); }
.x-switcher a:hover { color: var(--kami-brand); }

/* Buttons: ring shadow edge, ghost variant, active state from tokens.json */
.x-btn { line-height: 1; transition: background 0.2s, box-shadow 0.2s; }
.x-btn.c-btn--primary:active { background: var(--kami-brand-active); border-color: var(--kami-brand-active); }
.x-btn--ghost { background: transparent; color: var(--kami-brand); border-color: var(--kami-brand); }
.x-btn--ghost:hover { color: var(--kami-brand); }

/* Hero: eyebrow row, tagline, hero tokens row */
.x-eyebrow-row { display: flex; flex-wrap: wrap; gap: 6px 16px; font: 500 12px/1 var(--sans); letter-spacing: 1.2px; text-transform: uppercase; color: var(--kami-stone); font-variant-numeric: tabular-nums; }
.x-tagline { font: 500 21px/1.4 var(--serif); color: var(--kami-olive); max-width: 30em; }
.x-hero-tokens { display: flex; flex-wrap: wrap; gap: 8px 28px; padding-top: 20px; border-top: 1px solid var(--kami-border); font: 400 12px/1.55 var(--mono); letter-spacing: 0.4px; color: var(--kami-stone); font-variant-numeric: tabular-nums; }
.x-hero-tokens dt { color: var(--kami-dark-warm); }
.x-hero-tokens div { display: flex; gap: 8px; }
.x-hero-tokens dd { margin: 0; }
@media (max-width: 767px) { .x-tagline { font-size: 17px; } .x-hero-tokens { display: none; } }

/* Cover art: the block composition from kami's own Cover preview, minus the green signal block */
.x-cover-art { width: 100%; max-width: 480px; justify-self: end; }
.x-cover-art svg { width: 100%; height: auto; }
.x-cover-art .brand { fill: var(--kami-brand); }
.x-cover-art .deep { fill: var(--kami-near-black); }
.x-cover-art .tint { fill: var(--kami-warm-sand); }
.x-cover-art .rule { stroke: var(--kami-border); stroke-width: 1; }
.x-cover-art .blk { rx: 8px; }
@media (max-width: 959px) { .x-cover-art { justify-self: start; max-width: 360px; } }

/* Section head: number in ink-blue serif, then the title, then an olive lede. No eyebrow, no bar. */
.x-section-head { display: grid; gap: 8px; margin-bottom: 32px; max-width: 46em; }
.x-section-num { font: 500 14px/1.2 var(--serif); letter-spacing: 0.4px; color: var(--kami-brand); font-variant-numeric: tabular-nums; }
.x-section-lede { font: 500 16px/1.55 var(--serif); color: var(--kami-olive); margin-top: 4px; }
@media (max-width: 767px) { .x-section-head { margin-bottom: 24px; } }

/* Reading column: long-form body at a print measure */
.x-prose { max-width: 40em; display: grid; gap: 12px; }
.x-prose p { font-size: 14px; line-height: 1.55; }
.x-dense { line-height: 1.45; }

/* Cards: ivory, ring border, 28 28 24 padding, whisper on hover only */
.x-card { padding: 28px 28px 24px; transition: box-shadow 0.2s; }
.x-card:hover { box-shadow: var(--kami-whisper); }
.x-card p { color: var(--kami-dark-warm); }
.x-card .x-hint { font: 400 12px/1.55 var(--mono); letter-spacing: 0.4px; color: var(--kami-stone); }
.x-card--featured { border-radius: 12px; }
@media (max-width: 767px) { .x-card { padding: 20px 16px; } }

/* Card grid: two columns at desktop, one below 768px */
.x-grid { padding: 0; }
@media (max-width: 767px) { .x-grid.c-grid { grid-template-columns: 1fr; } }

/* Tags: solid fills only, never rgba */
.x-tag { font: 500 12px/1 var(--sans); letter-spacing: 0.4px; }
.x-tag--standard { background: var(--kami-tag-soft); padding: 2px 8px; border-radius: 4px; }
.x-tag--brush { background: linear-gradient(to right, #D6E1EE, #E4ECF5 70%, #EEF2F7); }   /* once per page */
.x-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Metrics: value serif 500 24px ink-blue, tabular-nums; label 12px olive; 28px gap */
.x-metrics { display: flex; flex-wrap: wrap; gap: 24px 28px; list-style: none; padding: 0; }
.x-metric .c-stat__n { font-variant-numeric: tabular-nums; letter-spacing: 0; line-height: 1.25; }
.x-metric .c-stat__l { margin-top: 4px; font: 400 12px/1.45 var(--serif); color: var(--kami-olive); }

/* Dash list: ink-blue en-dash, 14px indent */
.x-dash > li { padding-left: 14px; }

/* Quote: 2px ink-blue left rule, 15px 500 olive */
.x-quote { border-left: 2px solid var(--kami-brand); padding: 4px 0 4px 14px; }
.x-quote p { font: 500 15px/1.55 var(--serif); color: var(--kami-olive); }
.x-quote figcaption { margin-top: 8px; font: 500 12px/1.45 var(--serif); color: var(--kami-stone); }

/* Manifesto: the one place tracking earns its keep */
.x-manifesto { max-width: 34em; }
.x-manifesto blockquote p { letter-spacing: 0.05em; color: var(--kami-dark-warm); }
.x-manifesto figcaption { font: 500 12px/1.45 var(--serif); color: var(--kami-stone); }

/* Table: absolute px columns, warm borders, tabular-nums on every number */
.x-table-wrap { overflow-x: auto; }
.x-table { width: 500px; border-collapse: collapse; table-layout: fixed; font-size: 13px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.x-table caption { text-align: left; caption-side: bottom; padding-top: 10px; font: 500 12px/1.45 var(--serif); color: var(--kami-olive); }
.x-table th { text-align: left; font: 500 12px/1.35 var(--sans); letter-spacing: 0.4px; text-transform: uppercase; color: var(--kami-dark-warm); padding: 0 16px 10px 0; border-bottom: 1px solid var(--kami-border); }
.x-table td { padding: 10px 16px 10px 0; border-bottom: 1px solid var(--kami-border-soft); color: var(--kami-near-black); vertical-align: top; }
.x-table .num { text-align: right; }
.x-table col.w-item { width: 260px; } .x-table col.w-num { width: 120px; } .x-table col.w-note { width: 220px; }

/* Code block: ivory, ring, 6px radius, mono 12px */
.x-code { background: var(--kami-ivory); border: 1px solid var(--kami-border); border-radius: 6px; padding: 12px 14px; font: 400 12px/1.55 var(--mono); color: var(--kami-near-black); white-space: pre; overflow-x: auto; margin: 0; }
.x-code .k { color: var(--kami-brand); }
.x-code .c { color: var(--kami-stone); }

/* Two-column block: reading column beside a side column */
.x-split { display: grid; gap: 40px; }
@media (min-width: 980px) { .x-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; } }

/* Japanese section: stack swapped on the wrapper, olive override, JA body tracking */
[lang="ja"] { font-family: var(--serif-ja); --serif: var(--serif-ja); --sans: var(--serif-ja); --f-display: var(--serif-ja); --f-body: var(--serif-ja); --kami-olive: #4d4c48; }
[lang="ja"] .c-h2 { letter-spacing: 0.3px; line-height: 1.12; }
[lang="ja"] .x-section-lede { letter-spacing: 0.02em; }
[lang="ja"] p { letter-spacing: 0.02em; }
@media (min-width: 980px) { [lang="ja"] .x-nowrap { white-space: nowrap; } }

/* Closing block: lifted ivory container */
.x-cta { border: 1px solid var(--kami-border); box-shadow: var(--kami-whisper); padding: 48px; }
.x-cta .c-h2 { max-width: 20em; }
@media (max-width: 767px) { .x-cta { padding: 28px 16px; } }

/* Colophon footer */
.x-colophon { padding-bottom: 120px; }
.x-colophon h3 { font: 500 12px/1 var(--sans); letter-spacing: 1.2px; text-transform: uppercase; color: var(--kami-dark-warm); }
.x-colophon h3 + p { margin-top: 12px; }
.x-colophon p, .x-colophon li { font-size: 12px; line-height: 1.45; }
.x-colophon a { color: var(--kami-brand); }
.x-colophon .x-toc li { display: flex; gap: 10px; font-variant-numeric: tabular-nums; }
.x-colophon .x-toc span { color: var(--kami-brand); }
@media (max-width: 767px) { .x-colophon { padding-bottom: 72px; } }

/* Bank tag, recoloured to kami so it does not break the palette */
.bank-tag { background: var(--kami-near-black); color: var(--kami-ivory); font-family: var(--sans); }

/* Print (guide section 8) */
@page { size: A4; margin: 14mm 16mm; background: #f5f4ed; }
@media print {
  .c-section, .c-hero, .c-card, .x-quote, .c-quote, blockquote, pre, tr, .x-metric { break-inside: avoid; }
  .bank-tag, .x-switcher { display: none; }
  .x-card:hover { box-shadow: none; }
}
