/* ============================================================================
   japanese.org — foundation
   Design language: 間 (ma). Space is not what's left over; it's the material.
   ========================================================================= */

/* ---------- tokens ------------------------------------------------------ */

:root {
  /* surface — warm paper, never pure white */
  --washi:      #F6F2EA;
  --washi-2:    #EFE9DE;
  --washi-3:    #E6DED0;
  --paper:      #FFFDF9;

  /* Permanently dark panels (the drill, the CTA, the featured plan) invert
     against both themes, so their ink and ground must NOT follow the theme.
     Anything sitting on one of these uses --onink / --onink-soft. */
  --panel:       #16130F;
  --panel-2:     rgba(246,242,234,.045);
  --panel-bd:    rgba(246,242,234,.12);
  --onink:       #F6F2EA;
  --onink-soft:  rgba(246,242,234,.66);
  --onink-faint: rgba(246,242,234,.42);

  /* ink */
  --sumi:       #16130F;
  --sumi-2:     #2B2621;
  --ink:        #3D3730;
  --ink-soft:   #6B6156;
  --ink-faint:  #9A8F82;
  --hairline:   rgba(22,19,15,.10);
  --hairline-2: rgba(22,19,15,.055);

  /* accents */
  --shu:        #C8442B;   /* 朱 vermillion — torii, seals, correction ink */
  --shu-deep:   #9E3120;
  --shu-soft:   rgba(200,68,43,.09);
  --ai:         #1F3A5F;   /* 藍 indigo */
  --ai-soft:    rgba(31,58,95,.08);
  --kin:        #A8862F;   /* 金 gold leaf */
  --matcha:     #6E7F52;
  --sakura:     #D9A0A8;

  /* semantics */
  --ok:         #4F7A52;
  --warn:       #B07C2A;
  --bad:        var(--shu);

  /* type */
  --serif:  "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans:   -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mincho: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "MS Mincho", "Noto Serif JP", serif;
  --gothic: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  --mono:   "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  /* rhythm */
  --ma:     clamp(4.5rem, 9vw, 9rem);   /* the big vertical breath */
  --gut:    clamp(1.25rem, 4vw, 2.5rem);
  --maxw:   1240px;
  --readw:  62ch;

  --r-s: 6px;
  --r-m: 12px;
  --r-l: 20px;

  --shadow-1: 0 1px 2px rgba(22,19,15,.05), 0 4px 14px rgba(22,19,15,.045);
  --shadow-2: 0 2px 6px rgba(22,19,15,.06), 0 18px 48px rgba(22,19,15,.09);
  --shadow-3: 0 4px 12px rgba(22,19,15,.08), 0 32px 80px rgba(22,19,15,.14);

  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);

  color-scheme: light;
}

[data-theme="dark"] {
  --washi:      #14120F;
  --washi-2:    #1B1814;
  --washi-3:    #241F1A;
  --paper:      #1A1713;

  /* Dark theme cannot go darker than the page, so the inverted panels rise
     instead of sinking. Same ink, opposite direction. */
  --panel:       #241F19;
  --panel-2:     rgba(246,242,234,.05);
  --panel-bd:    rgba(246,242,234,.11);

  --sumi:       #F2EDE4;
  --sumi-2:     #E2DACD;
  --ink:        #CFC6B8;
  --ink-soft:   #A0968A;
  --ink-faint:  #6F675D;
  --hairline:   rgba(242,237,228,.13);
  --hairline-2: rgba(242,237,228,.07);

  --shu:        #E06449;
  --shu-deep:   #C8442B;
  --shu-soft:   rgba(224,100,73,.13);
  --ai:         #7FA3CC;
  --ai-soft:    rgba(127,163,204,.11);
  --kin:        #D6B45C;
  --matcha:     #9DAE7E;

  --ok:         #7BAA7E;
  --warn:       #D5A44E;

  --shadow-1: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.28);
  --shadow-2: 0 2px 6px rgba(0,0,0,.34), 0 18px 48px rgba(0,0,0,.44);
  --shadow-3: 0 4px 12px rgba(0,0,0,.4), 0 32px 80px rgba(0,0,0,.55);

  color-scheme: dark;
}

/* ---------- reset ------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  background: var(--washi);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1;
  overflow-x: hidden;
  transition: background-color .5s var(--ease), color .5s var(--ease);
}

img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible {
  outline: 2px solid var(--shu);
  outline-offset: 3px;
  border-radius: 3px;
}
::selection { background: var(--shu); color: var(--paper); }

/* ---------- type -------------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -.022em;
  color: var(--sumi);
  text-wrap: balance;
}

.display {
  font-size: clamp(2.9rem, 7.6vw, 6.4rem);
  line-height: .98;
  letter-spacing: -.036em;
}
.h1 { font-size: clamp(2.3rem, 5.4vw, 4.1rem); }
.h2 { font-size: clamp(1.7rem, 3.4vw, 2.7rem); }
.h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); letter-spacing: -.014em; }

.lede {
  font-size: clamp(1.08rem, 1.65vw, 1.32rem);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: var(--readw);
}

.eyebrow {
  font-family: var(--sans);
  font-size: .69rem;
  font-weight: 600;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: .7em;
}
.eyebrow::before {
  content: "";
  width: 1.9rem; height: 1px;
  background: var(--shu);
  flex: none;
}

.jp   { font-family: var(--mincho); font-feature-settings: "palt" 1; }
.jp-g { font-family: var(--gothic); }
.mono { font-family: var(--mono); font-size: .82em; letter-spacing: -.01em; }

em, .em { font-style: italic; color: var(--sumi); }
b, strong { font-weight: 600; color: var(--sumi); }

/* vertical Japanese — used as ornament and as real text */
.tategaki {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--mincho);
  letter-spacing: .18em;
}

/* ---------- layout ------------------------------------------------------ */

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gut);
}
.wrap-narrow { max-width: 900px; }

.section { padding-block: var(--ma); position: relative; }
.section + .section { padding-top: 0; }

.rule {
  height: 1px;
  background: var(--hairline);
  border: 0;
}

.grid { display: grid; gap: clamp(1.4rem, 3vw, 2.6rem); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .g-3, .g-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .g-2, .g-3, .g-4 { grid-template-columns: 1fr; } }

.stack   { display: flex; flex-direction: column; }
.row     { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap-xs  { gap: .45rem; } .gap-s { gap: .85rem; }
.gap-m   { gap: 1.4rem; } .gap-l { gap: 2.4rem; }
.wrapflex{ flex-wrap: wrap; }

/* ---------- controls ---------------------------------------------------- */

.btn {
  --bg: var(--sumi); --fg: var(--paper); --bd: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  gap: .55em;
  font-family: var(--sans);
  font-size: .875rem; font-weight: 550; letter-spacing: -.005em;
  padding: .78em 1.5em;
  border-radius: 100px;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--bd);
  cursor: pointer;
  white-space: nowrap;
  transition: transform .28s var(--ease-out), box-shadow .28s var(--ease),
              background-color .22s var(--ease), color .22s var(--ease),
              border-color .22s var(--ease), opacity .22s;
  will-change: transform;
}
.btn:hover  { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-1); }
.btn:disabled { opacity: .38; pointer-events: none; }

.btn--shu   { --bg: var(--shu); --fg: #fff; }
.btn--ghost { --bg: transparent; --fg: var(--sumi); --bd: var(--hairline); }
.btn--ghost:hover { --bd: var(--sumi); background: var(--hairline-2); }
.btn--sm    { font-size: .8rem; padding: .58em 1.1em; }
.btn--lg    { font-size: .95rem; padding: .95em 1.9em; }
.btn--block { width: 100%; }

.chip {
  display: inline-flex; align-items: center; gap: .4em;
  font-family: var(--sans); font-size: .68rem; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  padding: .34em .72em;
  border-radius: 100px;
  border: 1px solid var(--hairline);
  color: var(--ink-soft);
  background: var(--hairline-2);
}
.chip--shu { color: var(--shu); border-color: color-mix(in srgb, var(--shu) 30%, transparent); background: var(--shu-soft); }
.chip--ai  { color: var(--ai);  border-color: color-mix(in srgb, var(--ai) 30%, transparent);  background: var(--ai-soft); }

.card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-l);
  padding: clamp(1.3rem, 2.6vw, 2rem);
  transition: transform .4s var(--ease-out), box-shadow .4s var(--ease), border-color .3s;
}
.card--hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: var(--hairline); }

/* the vermilion seal — a recurring brand mark */
.seal {
  width: 2.6rem; height: 2.6rem;
  display: grid; place-items: center;
  border-radius: 5px;
  background: var(--shu);
  color: #fff;
  font-family: var(--mincho);
  font-size: 1.15rem;
  line-height: 1;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--shu) 32%, transparent);
  flex: none;
}

/* ---------- motion ------------------------------------------------------ */

[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .95s var(--ease-out), transform .95s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
[data-reveal].in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}

/* ---------- utilities --------------------------------------------------- */

.muted   { color: var(--ink-soft); }
.faint   { color: var(--ink-faint); }
.shu     { color: var(--shu); }
.center  { text-align: center; }
.mx-auto { margin-inline: auto; }
.reada   { max-width: var(--readw); }
.sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.nowrap { white-space: nowrap; }
