/* ============================================================
   棟梁の家 — TORYO NO IE
   Design tokens
   ============================================================ */

:root {
  /* ——— colors ——— */
  --kinari:      #EDE5D3;   /* 生成り — primary surface */
  --kinari-2:    #E6DCC4;   /* 生成り — deeper */
  --kinari-3:    #F5EFE1;   /* 生成り — lighter, paper */
  --sumi:        #1E1A14;   /* 墨 — primary ink */
  --sumi-2:      #2A2620;   /* 墨 — soft ink */
  --hinoki:      #C89D62;   /* 檜 — accent */
  --hinoki-2:    #A07A45;   /* 檜 — deeper */
  --hinoki-3:    #E4C48F;   /* 檜 — lighter */
  --sugi:        #7A5B3A;   /* 杉 — deep wood */
  --moegi:       #7A8C5C;   /* 萌葱 — accent cold */
  --akane:       #8B3A2F;   /* 茜 — accent warm */
  --rule:        rgba(30, 26, 20, 0.14);
  --rule-strong: rgba(30, 26, 20, 0.32);
  --muted:       rgba(30, 26, 20, 0.62);

  /* ——— typography ——— */
  --serif:  "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans:   "Inter", "Hiragino Sans", "Yu Gothic", sans-serif;
  --mono:   "JetBrains Mono", ui-monospace, monospace;

  /* ——— measure ——— */
  --page-max: 1440px;
  --gutter: clamp(24px, 4vw, 64px);
}

/* ——— reset / base ——— */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--kinari);
  color: var(--sumi);
  font-family: var(--serif);
  font-feature-settings: "palt";
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--sumi); color: var(--kinari); }

/* ——— textures ——— */

/* washi paper texture — layered SVG noise + warm tint */
.washi {
  background-color: var(--kinari);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(200,157,98,0.06), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(122,91,58,0.05), transparent 55%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.10 0 0 0 0 0.08 0 0 0 0.10 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.washi-soft {
  background-color: var(--kinari-3);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='420' height='420'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='2' seed='9'/><feColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.14 0 0 0 0 0.10 0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.sumi-bg {
  background-color: var(--sumi);
  color: var(--kinari);
  background-image:
    radial-gradient(circle at 30% 20%, rgba(200,157,98,0.08), transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='2'/><feColorMatrix values='0 0 0 0 0.95 0 0 0 0 0.90 0 0 0 0 0.80 0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ——— wood grain — horizontal pseudo-grain via SVG ——— */
.wood-grain {
  background-color: #D9BE91;
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(122, 91, 58, 0.00) 0px,
      rgba(122, 91, 58, 0.08) 2px,
      rgba(122, 91, 58, 0.00) 5px,
      rgba(160, 122, 69, 0.10) 9px,
      rgba(122, 91, 58, 0.00) 14px,
      rgba(200, 157, 98, 0.06) 20px,
      rgba(122, 91, 58, 0.00) 30px,
      rgba(122, 91, 58, 0.12) 42px,
      rgba(122, 91, 58, 0.00) 48px,
      rgba(160, 122, 69, 0.06) 60px
    ),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='800' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.012 0.8' numOctaves='3' seed='7'/><feColorMatrix values='0 0 0 0 0.47 0 0 0 0 0.36 0 0 0 0 0.23 0 0 0 0.35 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: auto, 800px 240px;
}

/* ink stroke — reusable brush underline */
.ink-stroke {
  position: relative;
  display: inline-block;
}
.ink-stroke::after {
  content: "";
  position: absolute;
  left: -4px; right: -4px;
  bottom: -0.12em;
  height: 0.28em;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 20' preserveAspectRatio='none'><path d='M2 10 C 40 6, 90 14, 150 9 S 270 13, 298 8' stroke='%231E1A14' stroke-width='3.5' fill='none' stroke-linecap='round' opacity='0.82'/></svg>");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: -1;
}

/* ——— type ——— */
.tate { /* vertical writing */
  writing-mode: vertical-rl;
  font-feature-settings: "pkna";
  letter-spacing: 0.12em;
}
.kana-sm { font-family: var(--sans); font-size: 0.72em; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 500; }
.en { font-family: var(--sans); letter-spacing: 0.04em; }

.h-display {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(48px, 7.2vw, 112px);
  line-height: 1.15;
  letter-spacing: 0.02em;
}
.h-section {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 3.6vw, 54px);
  line-height: 1.25;
  letter-spacing: 0.04em;
}
.h-sub {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(22px, 1.6vw, 28px);
  line-height: 1.4;
  letter-spacing: 0.06em;
}
.eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.body-lg {
  font-size: 18px;
  line-height: 2;
}
.body-md {
  font-size: 15px;
  line-height: 1.95;
}
.body-sm {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

/* ——— common layout ——— */
.page {
  min-height: 100vh;
}
.container {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.rule { height: 1px; background: var(--rule); border: 0; }
.rule-ink { height: 1px; background: var(--sumi); opacity: 0.5; border: 0; }

/* numeric */
.num {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-weight: 300;
  letter-spacing: 0;
}

/* links */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid currentColor;
  padding-bottom: 4px;
  transition: gap 0.3s ease;
}
.link-arrow:hover { gap: 16px; }
.link-arrow svg { width: 18px; height: 10px; }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px;
  border: 1px solid var(--sumi);
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: var(--sumi);
  color: var(--kinari);
  transition: background 0.25s ease, color 0.25s ease;
}
.btn:hover { background: transparent; color: var(--sumi); }
.btn.ghost { background: transparent; color: var(--sumi); }
.btn.ghost:hover { background: var(--sumi); color: var(--kinari); }

/* small chrome */
.chrome-logo {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 0.12em;
}
.chrome-logo .en { display: block; font-size: 9px; letter-spacing: 0.32em; color: var(--muted); margin-top: 2px; }

/* seal — hanko-like red square stamp */
.seal {
  display: inline-grid;
  place-items: center;
  width: 52px; height: 52px;
  background: var(--akane);
  color: var(--kinari-3);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.02em;
  border-radius: 2px;
  transform: rotate(-4deg);
  box-shadow: 0 1px 0 rgba(0,0,0,0.1) inset;
  line-height: 1;
  writing-mode: vertical-rl;
  padding: 4px;
}

/* animation utilities */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 1.2s ease, transform 1.2s ease;
  }
  .reveal.in {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ——— image placeholder styles (no real photos yet) ——— */
.ph {
  position: relative;
  overflow: hidden;
  background: var(--kinari-2);
}
.ph::before {
  content: attr(data-label);
  position: absolute;
  left: 16px; top: 16px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(30,26,20,0.55);
  z-index: 2;
}
.ph::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(135deg, rgba(30,26,20,0.08), rgba(30,26,20,0.00) 40%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.10 0 0 0 0 0.08 0 0 0 0.12 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* tatami-like placeholder (warm wood room) */
.ph-room {
  background:
    linear-gradient(180deg, rgba(30,26,20,0.28), rgba(30,26,20,0.05) 35%, rgba(30,26,20,0.0) 60%, rgba(30,26,20,0.18) 100%),
    linear-gradient(180deg, #C7A87A 0%, #B8946A 45%, #8D6D4A 70%, #6C543A 100%);
}
.ph-room::after { opacity: 0.85; }

.ph-wood {
  background:
    repeating-linear-gradient(
      180deg,
      rgba(122,91,58,0.00) 0px,
      rgba(122,91,58,0.12) 2px,
      rgba(122,91,58,0.00) 6px,
      rgba(160,122,69,0.10) 14px,
      rgba(122,91,58,0.00) 24px
    ),
    linear-gradient(180deg, #D4B68A, #B08E5F);
}
.ph-wood::after { opacity: 0.55; }

.ph-dark {
  background:
    linear-gradient(180deg, rgba(0,0,0,0.5), rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.55)),
    linear-gradient(180deg, #3A3026, #1E1A14);
  color: var(--kinari);
}
.ph-dark::before { color: rgba(237,229,211,0.6); }
.ph-dark::after { opacity: 0.6; }

.ph-hinoki {
  background:
    linear-gradient(180deg, rgba(30,26,20,0.12), rgba(30,26,20,0.0) 50%),
    repeating-linear-gradient(
      180deg,
      rgba(160,122,69,0.0) 0,
      rgba(160,122,69,0.18) 3px,
      rgba(160,122,69,0.0) 12px
    ),
    linear-gradient(180deg, #E9CF9E, #C89D62);
}

.ph-portrait {
  background:
    radial-gradient(ellipse at 50% 38%, rgba(237,229,211,0.65) 0%, rgba(237,229,211,0.0) 28%),
    linear-gradient(180deg, #2A231C 0%, #1E1A14 100%);
  color: var(--kinari);
}
.ph-portrait::before { color: rgba(237,229,211,0.5); }

/* caption next to images */
.cap {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 10px;
}

/* annotations on plates */
.plate-num {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--muted);
}
