/* ============================================
   YORIAI — Topography of Minds
   ============================================ */

:root {
  --earth-ink: #1A1814;
  --topo-green: #3F5D4A;
  --topo-green-soft: #6E8576;
  --saffron: #D68A3C;
  --saffron-soft: #E5A969;
  --washi: #F6F1E8;
  --paper: #FBFAF7;
  --sky-mist: #E8EFEE;
  --line-faint: rgba(26, 24, 20, 0.08);
  --line-soft: rgba(26, 24, 20, 0.16);
  --ink-60: rgba(26, 24, 20, 0.6);
  --ink-75: rgba(26, 24, 20, 0.75);

  --ff-serif: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --ff-sans: "Inter", "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--ff-sans);
  background: var(--washi);
  color: var(--earth-ink);
  font-feature-settings: "palt";
  line-height: 1.7;
  text-wrap: pretty;
}

/* Typography */
.serif { font-family: var(--ff-serif); font-weight: 500; letter-spacing: 0.01em; }
.mono { font-family: var(--ff-mono); }
.tnum { font-variant-numeric: tabular-nums; }

h1, h2, h3, h4 {
  font-family: var(--ff-serif);
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1.25;
  margin: 0;
}

p { margin: 0; }

a { color: inherit; text-decoration: none; }

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* Display sizes */
.d-1 { font-size: clamp(40px, 5.2vw, 64px); line-height: 1.18; letter-spacing: -0.01em; word-break: keep-all; overflow-wrap: anywhere; }
.d-2 { font-size: clamp(32px, 4vw, 52px); line-height: 1.22; word-break: keep-all; overflow-wrap: anywhere; }
.d-3 { font-size: clamp(24px, 2.8vw, 40px); line-height: 1.3; word-break: keep-all; overflow-wrap: anywhere; }
.d-4 { font-size: clamp(22px, 2.4vw, 32px); line-height: 1.35; letter-spacing: -0.005em; word-break: keep-all; overflow-wrap: anywhere; }
.h-1 { font-size: clamp(24px, 2.4vw, 32px); line-height: 1.3; }
.h-2 { font-size: 20px; line-height: 1.4; }
.eyebrow {
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--topo-green);
}
.eyebrow-jp {
  font-family: var(--ff-sans);
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--topo-green);
}

.body-lg { font-size: 18px; line-height: 1.85; }
.body { font-size: 16px; line-height: 1.8; }
.body-sm { font-size: 14px; line-height: 1.7; color: var(--ink-75); }
.caption { font-size: 12px; letter-spacing: 0.04em; color: var(--ink-60); }

/* Layout */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 48px;
}
@media (max-width: 720px) {
  .container { padding: 0 24px; }
}

.section { padding: 120px 0; position: relative; }
.section-sm { padding: 80px 0; }

/* Contour divider */
.contour-divider {
  height: 80px;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.contour-divider svg { width: 100%; height: 100%; display: block; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--earth-ink);
  color: var(--paper);
}
.btn-primary:hover { background: var(--topo-green); transform: translateY(-1px); }
.btn-saffron {
  background: var(--saffron);
  color: var(--earth-ink);
}
.btn-saffron:hover { background: var(--saffron-soft); transform: translateY(-1px); }
.btn-ghost {
  border: 1px solid var(--line-soft);
  color: var(--earth-ink);
}
.btn-ghost:hover { border-color: var(--earth-ink); }

.arrow-r::after {
  content: "→";
  display: inline-block;
  transition: transform 0.25s ease;
}
.arrow-r:hover::after { transform: translateX(4px); }

/* Cards */
.card {
  background: var(--paper);
  border: 1px solid var(--line-faint);
  border-radius: 16px;
  padding: 32px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: var(--line-soft); }

/* Tag */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--sky-mist);
  font-size: 12px;
  color: var(--topo-green);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.tag-saffron { background: rgba(214, 138, 60, 0.12); color: #A0651F; }
.tag-green { background: rgba(63, 93, 74, 0.1); color: var(--topo-green); }
.tag-outline { background: transparent; border: 1px solid var(--line-soft); color: var(--ink-75); }

/* Header / Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 241, 232, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-faint);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--ff-serif);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.06em;
}
.logo-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
}
.nav {
  display: flex;
  align-items: center;
  gap: 36px;
}
.nav a {
  font-size: 14px;
  color: var(--ink-75);
  position: relative;
  padding: 6px 0;
  transition: color 0.2s ease;
}
.nav a:hover { color: var(--earth-ink); }
.nav a.active { color: var(--earth-ink); }
.nav a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--saffron);
}
.nav-jp { font-size: 14px; }
@media (max-width: 860px) {
  .nav { gap: 18px; }
  .nav a { font-size: 13px; }
  .nav .nav-cta { display: none; }
}

/* ===== Hamburger Button ===== */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.hamburger:hover { background: rgba(26, 24, 20, 0.06); }

.hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 20px;
}
.hamburger-icon span {
  display: block;
  height: 1.5px;
  background: var(--earth-ink);
  border-radius: 2px;
  transition: transform 0.28s ease, opacity 0.2s ease;
  transform-origin: center;
}
.hamburger-icon.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger-icon.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger-icon.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ===== Mobile Menu Overlay ===== */
.mobile-menu {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  background: rgba(246, 241, 232, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  padding: 32px 32px 48px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.mobile-menu.is-open {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}
.mobile-menu nav { display: flex; flex-direction: column; }

.mobile-nav-link {
  display: block;
  padding: 18px 4px;
  font-family: var(--ff-serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--earth-ink);
  border-bottom: 1px solid var(--line-faint);
  letter-spacing: 0.01em;
  transition: color 0.18s ease, padding-left 0.18s ease;
}
.mobile-nav-link:hover,
.mobile-nav-link.active { color: var(--topo-green); padding-left: 8px; }

.mobile-nav-cta {
  margin-top: 32px;
  align-self: flex-start;
}

@media (max-width: 640px) {
  .hamburger { display: flex; }
  .nav-desktop { display: none; }
}
@media (min-width: 641px) {
  .mobile-menu { display: none !important; }
}

/* Footer */
.footer {
  background: var(--earth-ink);
  color: rgba(251, 250, 247, 0.7);
  padding: 80px 0 40px;
}
.footer h4 { color: var(--paper); font-size: 14px; letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 20px; font-family: var(--ff-mono); font-weight: 500; }
.footer a { color: rgba(251, 250, 247, 0.7); }
.footer a:hover { color: var(--paper); }

/* Utilities */
.muted { color: var(--ink-60); }
.row { display: flex; }
.col { display: flex; flex-direction: column; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; } .gap-32 { gap: 32px; } .gap-48 { gap: 48px; } .gap-64 { gap: 64px; }
.center { align-items: center; justify-content: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

/* Page transition */
.page-enter { animation: pageIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Focus styles */
*:focus-visible {
  outline: 2px solid var(--saffron);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Subtle washi grain */
.grain {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(63, 93, 74, 0.04) 1px, transparent 1.5px),
    radial-gradient(circle at 70% 60%, rgba(26, 24, 20, 0.03) 1px, transparent 1.5px),
    radial-gradient(circle at 40% 80%, rgba(214, 138, 60, 0.03) 1px, transparent 1.5px);
  background-size: 80px 80px, 120px 120px, 100px 100px;
}

/* Scroll containers */
.scroll-y { overflow-y: auto; }
.scroll-y::-webkit-scrollbar { width: 6px; }
.scroll-y::-webkit-scrollbar-thumb { background: var(--line-soft); border-radius: 4px; }
.scroll-y::-webkit-scrollbar-track { background: transparent; }

/* Teaser sections (Ando / Map) — stack on mobile */
@media (max-width: 860px) {
  .teaser-grid {
    grid-template-columns: 1fr !important;
    gap: 48px !important;
  }
  .teaser-grid .teaser-visual { order: 0 !important; }
  .teaser-grid .teaser-text { order: 1 !important; }
}

/* Branch cards (FOR FAMILIES / FOR PROVIDERS) */
.branch-card {
  border-radius: 4px;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.branch-card:hover {
  border-color: var(--earth-ink);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(26, 24, 20, 0.06);
}
.branch-card .arrow-r::after {
  content: " →";
  display: inline-block;
  transition: transform 0.25s ease;
}
.branch-card:hover .arrow-r::after { transform: translateX(4px); }

/* Responsive grid utilities
   - grid-2-stack: 2col → 1col at 720px
   - grid-3-stack: 3col → 1col at 860px, 2col at 1100px
   - grid-4-stack: 4col → 2col at 860px, 1col at 560px
*/
@media (max-width: 720px) {
  .grid-2-stack {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
}
@media (max-width: 1100px) {
  .grid-3-stack { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 720px) {
  .grid-3-stack {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
}
@media (max-width: 860px) {
  .grid-4-stack { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 560px) {
  .grid-4-stack { grid-template-columns: 1fr !important; }
}

/* Principle list (PhilosophyPage) — 3col → 1col */
@media (max-width: 860px) {
  .principle-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 40px 0 !important;
  }
}

/* Timeline rows — stacked on small screens */
@media (max-width: 560px) {
  .timeline-row {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
}

/* Legal / definition list — stack on mobile */
@media (max-width: 640px) {
  .legal-dl {
    grid-template-columns: 1fr !important;
  }
  .legal-dl dt { padding-bottom: 4px !important; border-bottom: none !important; }
  .legal-dl dd { padding-top: 0 !important; }
}

/* Footer grid — collapses to 2 columns then 1 */
@media (max-width: 1100px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 32px !important;
  }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 28px !important;
  }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}

/* Responsive display sizes on small screens */
@media (max-width: 720px) {
  .d-1 { font-size: clamp(32px, 7.5vw, 44px); }
  .d-2 { font-size: clamp(28px, 6.5vw, 38px); }
  .d-3 { font-size: clamp(22px, 5.5vw, 30px); }
  .section { padding: 80px 0; }
  .section-sm { padding: 56px 0; }
  /* Loosen inline hero paddings on phones */
  section[style*="padding: 140px"] { padding: 72px 0 !important; }
  section[style*="padding: 100px 0 60px"] { padding: 60px 0 40px !important; }
  section[style*="padding: 80px 0 60px"] { padding: 56px 0 40px !important; }
  section[style*="padding: 80px 0 40px"] { padding: 56px 0 28px !important; }
  section[style*="padding: 100px 0"] { padding: 72px 0 !important; }
}

/* ===== Mobile-specific improvements (≤480px) ===== */
@media (max-width: 480px) {
  .container { padding: 0 20px; }
  .card { padding: 24px 20px; }
  .btn { padding: 14px 22px; font-size: 14px; }
  /* Prevent overflow on very small screens */
  .d-1 { font-size: clamp(28px, 8vw, 36px); }
  .d-2 { font-size: clamp(24px, 7vw, 32px); }
  /* Branch cards full width on small phones */
  .branch-card { border-radius: 12px !important; }
  /* Footer on small phones */
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  .footer { padding: 56px 0 32px; }
  /* Section spacing tighter */
  .section { padding: 64px 0; }
  .section-sm { padding: 44px 0; }
}
