/*
  Omoikane — design system.
  Single source of truth for both the public Hugo site (www/, beta/) and the
  daemon/mockups/ post-login HTML scaffolds. Tokens declared once, primitives
  used everywhere. Self-host fonts later (Cormorant Garamond + Inter); for
  now the system fallbacks are good enough.

  CSP-friendly: no remote font/script imports. No third-party trackers.
  Per omoikane mission rules.
*/

/* ─── design tokens ──────────────────────────────────────────────────── */

:root {
  /* primary palette */
  --c-navy:        #1e2d4f;
  --c-navy-darker: #182740;
  --c-navy-soft:   #243758;       /* sidebar nav active */
  --c-cream:       #f5f1e8;       /* page bg */
  --c-cream-soft:  #fbf9f4;       /* card bg variant */
  --c-white:       #ffffff;
  --c-gold:        #b89968;
  --c-gold-darker: #9c7e4f;
  --c-gold-soft:   #d8c8a8;       /* gold tints / accents */

  /* text */
  --c-text:        #2a2a2a;
  --c-text-muted:  #6a6a6a;
  --c-text-light:  #9a9a9a;
  --c-text-on-navy:#f5f1e8;
  --c-text-on-navy-muted: #b6c0d4;

  /* borders / dividers */
  --c-border:      #e8e3d8;
  --c-border-soft: #efece4;
  --c-border-on-navy: #2c3d62;

  /* status colors (bg / text pairs) */
  --c-pink-bg:     #fad4d4;
  --c-pink-text:   #a04545;
  --c-blue-bg:     #d9e5f5;
  --c-blue-text:   #3a5a8a;
  --c-sage-bg:     #d8e8dc;
  --c-sage-text:   #4a6f55;
  --c-cream-bg:    #efe5d2;
  --c-cream-text:  #6f5e3f;
  --c-purple-bg:   #e5d9f0;
  --c-purple-text: #5e4570;

  /* match score colors */
  --c-match-strong-bg:   #c7d9c0;
  --c-match-strong-text: #2f5d3a;
  --c-match-mid-bg:      #f0e0c0;
  --c-match-mid-text:    #6f5d2f;
  --c-match-weak-bg:     #f0c7c0;
  --c-match-weak-text:   #a04545;

  /* typography */
  --font-serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono:  ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  --font-cjk:   'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', serif;

  /* spacing scale (4px base) */
  --s-1:  0.25rem;
  --s-2:  0.5rem;
  --s-3:  0.75rem;
  --s-4:  1rem;
  --s-5:  1.5rem;
  --s-6:  2rem;
  --s-7:  3rem;
  --s-8:  4rem;
  --s-9:  6rem;

  /* radii */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 999px;

  /* shadows (soft, low-contrast — calm aesthetic) */
  --shadow-sm: 0 1px 2px rgba(30, 45, 79, 0.04);
  --shadow-md: 0 2px 8px rgba(30, 45, 79, 0.06);
  --shadow-lg: 0 8px 24px rgba(30, 45, 79, 0.08);

  /* layout */
  --max-width-page: 1140px;
  --max-width-prose: 660px;
  --max-width-narrow: 480px;
}

/* ─── reset ─────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--c-text);
  background: var(--c-cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  min-height: 100vh;
}
/* Omoigane shrine in Yokohama — used very faintly as atmospheric background.
   Source: https://commons.wikimedia.org/wiki/File:Omoigane_shrine_in_Yokohama.jpg
   The shrine is dedicated to the Omoikane kami; the image grounds the brand
   in the source culture without being decorative. Opacity is intentionally
   low so it never competes with content. Disabled on .no-shrine pages
   (e.g. authenticated app surfaces) by removing the class on body. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url('/img/omoigane-shrine.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.11;        /* faintly visible — atmospheric, not decorative */
  pointer-events: none;
  filter: saturate(0.6);
}
body.no-shrine::before { display: none; }

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; padding: 0; color: inherit; }

/* ─── typography ────────────────────────────────────────────────────── */

.t-serif         { font-family: var(--font-serif); }
.t-cjk           { font-family: var(--font-cjk); letter-spacing: 0.1em; }
.t-mono          { font-family: var(--font-mono); }
.t-eyebrow {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--c-gold-darker);
  font-weight: 500;
}
.t-eyebrow-muted {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--c-text-muted);
  font-weight: 500;
}
.t-muted   { color: var(--c-text-muted); }
.t-light   { color: var(--c-text-light); }

h1, h2, h3, h4, h5 { margin: 0; line-height: 1.25; font-weight: 500; }
.t-display {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.1;
  font-weight: 500;
  color: var(--c-navy);
  letter-spacing: -0.01em;
}
.t-h1 { font-size: 2rem; line-height: 1.2; font-weight: 500; }
.t-h2 { font-size: 1.5rem; font-weight: 500; }
.t-h3 { font-size: 1.15rem; font-weight: 500; }
.t-h4 { font-size: 1rem; font-weight: 500; }

.t-lede {
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--c-text-muted);
  max-width: var(--max-width-prose);
  margin: var(--s-4) auto 0;
}

/* ─── layout primitives ─────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--max-width-page);
  margin: 0 auto;
  padding: 0 var(--s-5);
}
.container--narrow { max-width: 720px; }

.section { padding: var(--s-8) 0; }
.section--alt { background: var(--c-white); }
.section--cream { background: var(--c-cream); }

.stack > * + * { margin-top: var(--s-4); }
.stack-sm > * + * { margin-top: var(--s-2); }
.stack-lg > * + * { margin-top: var(--s-6); }

.row { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.row--center { justify-content: center; align-items: center; }
.row--between { justify-content: space-between; align-items: center; }

.grid { display: grid; gap: var(--s-4); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 720px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* ─── card primitive ────────────────────────────────────────────────── */

.card {
  background: var(--c-white);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border-soft);
}
.card--soft       { background: var(--c-cream-soft); border: 1px solid var(--c-border); }
.card--navy       { background: var(--c-navy); color: var(--c-text-on-navy); border-color: transparent; }
.card--bordered   { box-shadow: none; border: 1px solid var(--c-border); }
.card--padded-lg  { padding: var(--s-6); }

.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--s-3);
}
.card__head a { color: var(--c-text-muted); font-size: 0.88rem; }
.card__head a:hover { color: var(--c-gold-darker); }

/* ─── button primitive ──────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 0.6rem 1.2rem;
  border-radius: var(--r-md);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 120ms ease;
  white-space: nowrap;
}
.btn--primary {
  background: var(--c-navy);
  color: var(--c-text-on-navy);
}
.btn--primary:hover { background: var(--c-navy-darker); }
.btn--secondary {
  background: var(--c-white);
  color: var(--c-text);
  border-color: var(--c-border);
}
.btn--secondary:hover { border-color: var(--c-text-muted); }
.btn--ghost {
  background: transparent;
  color: var(--c-text);
}
.btn--ghost:hover { background: var(--c-cream-soft); }
.btn--block { width: 100%; }
.btn--sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn--icon-only { padding: 0.5rem; }

/* ─── chip / tag primitive ──────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 0.18rem 0.6rem;
  border-radius: var(--r-pill);
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--c-border-soft);
  color: var(--c-text-muted);
  white-space: nowrap;
}
.chip--match-strong { background: var(--c-match-strong-bg); color: var(--c-match-strong-text); }
.chip--match-mid    { background: var(--c-match-mid-bg);    color: var(--c-match-mid-text); }
.chip--match-weak   { background: var(--c-match-weak-bg);   color: var(--c-match-weak-text); }
.chip--blue         { background: var(--c-blue-bg);    color: var(--c-blue-text); }
.chip--sage         { background: var(--c-sage-bg);    color: var(--c-sage-text); }
.chip--pink         { background: var(--c-pink-bg);    color: var(--c-pink-text); }
.chip--purple       { background: var(--c-purple-bg);  color: var(--c-purple-text); }
.chip--cream        { background: var(--c-cream-bg);   color: var(--c-cream-text); }
.chip--neutral      { background: var(--c-border-soft); color: var(--c-text-muted); }
.chip--master       { background: #f0d8a0; color: #6f5d2f; }
.chip--cv           { background: #c8e4cc; color: #3a5e44; }
.chip--letter       { background: #d8d0e8; color: #5a4a78; }
.chip--snippet      { background: #e0e0e0; color: #555; }

/* ─── KPI card (dashboard) ──────────────────────────────────────────── */

.kpi {
  background: var(--c-white);
  border-radius: var(--r-lg);
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--c-border-soft);
}
.kpi__label {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--c-text-muted);
  font-weight: 500;
}
.kpi__num {
  font-size: 2.25rem;
  font-weight: 300;
  color: var(--c-text);
  margin-top: var(--s-2);
  line-height: 1;
}
.kpi__sub {
  font-size: 0.8rem;
  color: var(--c-text-light);
  margin-top: var(--s-2);
}
.kpi--accent {
  background: var(--c-navy);
  color: var(--c-text-on-navy);
  border-color: transparent;
}
.kpi--accent .kpi__label { color: var(--c-gold-soft); }
.kpi--accent .kpi__num   { color: var(--c-text-on-navy); }
.kpi--accent .kpi__sub   { color: var(--c-text-on-navy-muted); }

/* ─── feature tile (landing) ────────────────────────────────────────── */

.feature {
  background: var(--c-white);
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border-soft);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.feature > summary.feature__head {
  display: flex;
  gap: var(--s-4);
  padding: var(--s-4);
  align-items: flex-start;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.15s ease;
}
.feature > summary.feature__head::-webkit-details-marker { display: none; }
.feature > summary.feature__head:hover { background: var(--c-cream); }
.feature__main { flex: 1 1 auto; min-width: 0; }
.feature__icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-navy);
  color: var(--c-cream);
  font-size: 1rem;
}
.feature__icon--gold { background: var(--c-gold); color: var(--c-white); }
.feature__title { font-weight: 600; color: var(--c-text); margin-bottom: 0.2rem; font-size: 0.97rem; }
.feature__desc  { color: var(--c-text-muted); font-size: 0.88rem; line-height: 1.45; }
.feature__chevron {
  flex-shrink: 0;
  align-self: center;
  color: var(--c-text-muted);
  font-size: 0.85rem;
  transition: transform 0.18s ease;
}
.feature[open] .feature__chevron { transform: rotate(180deg); }
.feature__more {
  padding: var(--s-3) var(--s-4) var(--s-4) var(--s-4);
  color: var(--c-text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  border-top: 1px solid var(--c-border-soft);
}
.feature__more p { margin: 0; }
.feature__more p + p { margin-top: var(--s-3); }

.feature--wide {
  background: var(--c-navy);
  color: var(--c-text-on-navy);
  border-color: transparent;
  grid-column: 1 / -1;
}
.feature--wide .feature__title { color: var(--c-text-on-navy); }
.feature--wide .feature__desc  { color: var(--c-text-on-navy-muted); }
.feature--wide .feature__icon  { background: var(--c-gold); color: var(--c-white); }
.feature--wide > summary.feature__head:hover { background: rgba(255,255,255,0.04); }
.feature--wide .feature__chevron { color: var(--c-text-on-navy-muted); }
.feature--wide .feature__more {
  color: var(--c-text-on-navy-muted);
  border-top-color: rgba(255,255,255,0.10);
}

/* ─── trust card (landing) ──────────────────────────────────────────── */

.trust {
  background: var(--c-white);
  padding: var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border-soft);
  border-top: 2px solid var(--c-gold);
}
.trust__title { font-weight: 600; font-size: 0.92rem; margin-bottom: var(--s-1); }
.trust__desc  { color: var(--c-text-muted); font-size: 0.85rem; line-height: 1.45; }

/* ─── sign-in card (landing) ────────────────────────────────────────── */

.signin {
  max-width: 380px;
  margin: 0 auto;
  background: var(--c-white);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  border: 1px solid var(--c-border-soft);
  box-shadow: var(--shadow-md);
}
.signin__title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 500;
  font-size: 1.1rem;
  margin-bottom: var(--s-2);
}
.signin__sub {
  color: var(--c-text-muted);
  font-size: 0.88rem;
  margin-bottom: var(--s-4);
}
.signin__or {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--c-text-light);
  font-size: 0.78rem;
  text-align: center;
  margin: var(--s-3) 0;
}
.signin__or::before, .signin__or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-border);
}
.signin .input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: 0.95rem;
  background: var(--c-white);
  color: var(--c-text);
  margin-bottom: var(--s-2);
}
.signin .input:focus { outline: none; border-color: var(--c-navy); }
.signin__forgot {
  display: block;
  text-align: right;
  font-size: 0.8rem;
  color: var(--c-gold-darker);
  margin-bottom: var(--s-3);
}
.signin__legal {
  text-align: center;
  font-size: 0.78rem;
  color: var(--c-text-light);
  margin-top: var(--s-3);
}

/* ─── header / footer ───────────────────────────────────────────────── */

.site-header {
  background: var(--c-cream);
  border-bottom: 1px solid var(--c-border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.site-header .brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 500;
  color: var(--c-navy);
  font-family: var(--font-serif);
  font-size: 1.15rem;
}
.site-header .brand img { width: 28px; height: 28px; border-radius: var(--r-pill); }
.site-header nav { display: flex; align-items: center; gap: var(--s-5); }
.site-header nav a {
  color: var(--c-text-muted);
  font-size: 0.9rem;
}
.site-header nav a:hover { color: var(--c-text); }

.site-footer {
  background: var(--c-navy);
  color: var(--c-text-on-navy-muted);
  padding: var(--s-5) 0;
  font-size: 0.85rem;
}
.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-3);
}
.site-footer .footer-brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-serif);
  color: var(--c-cream);
}
.site-footer .footer-brand img { width: 24px; height: 24px; border-radius: var(--r-pill); opacity: 0.9; }
.site-footer .footer-links { display: flex; gap: var(--s-4); }
.site-footer .footer-links a:hover { color: var(--c-cream); }
.site-footer .footer-legal {
  flex-basis: 100%;
  text-align: center;
  font-size: 0.75rem;
  opacity: 0.65;
  letter-spacing: 0.02em;
}

/* ─── landing-specific ──────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: var(--s-9) 0 var(--s-7);
}
.hero__logo {
  width: 64px; height: 64px;
  margin: 0 auto var(--s-4);
  border-radius: var(--r-pill);
  border: 2px solid var(--c-border);
  background: var(--c-white);
  padding: 4px;
}
.hero__logo img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--r-pill); }
.hero__brand {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  color: var(--c-navy);
  letter-spacing: -0.01em;
  font-weight: 500;
  line-height: 1;
}
.hero__kanji {
  font-family: var(--font-cjk);
  color: var(--c-text-muted);
  letter-spacing: 0.4em;
  font-size: 1.05rem;
  margin: var(--s-2) 0 var(--s-1);
}
.hero__tagline {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: var(--c-gold-darker);
  font-weight: 500;
  margin-bottom: var(--s-5);
}
.hero__line {
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  color: var(--c-text);
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.4;
}
.hero__sub {
  color: var(--c-text-muted);
  font-size: 1.02rem;
  max-width: 560px;
  margin: var(--s-3) auto 0;
  line-height: 1.55;
}
.hero__cta { margin-top: var(--s-6); display: flex; gap: var(--s-3); justify-content: center; flex-wrap: wrap; }

/* ─── content (markdown) prose ──────────────────────────────────────── */

.prose {
  max-width: var(--max-width-prose);
  margin: 0 auto;
  padding: var(--s-7) 0;
}
.prose h1 { font-family: var(--font-serif); font-size: 2.2rem; color: var(--c-navy); margin-bottom: var(--s-4); line-height: 1.2; }
.prose h2 { font-family: var(--font-serif); font-size: 1.5rem; color: var(--c-navy); margin: var(--s-6) 0 var(--s-3); }
.prose h3 { font-size: 1.1rem; color: var(--c-navy); margin: var(--s-5) 0 var(--s-2); }
.prose p  { margin: 0 0 var(--s-4); }
.prose a  { color: var(--c-gold-darker); border-bottom: 1px solid currentColor; }
.prose a:hover { color: var(--c-navy); }
.prose ul, .prose ol { padding-left: var(--s-5); margin: 0 0 var(--s-4); }
.prose li { margin-bottom: var(--s-2); }
.prose blockquote {
  border-left: 3px solid var(--c-gold);
  padding: var(--s-2) var(--s-4);
  color: var(--c-text-muted);
  margin: var(--s-4) 0;
  font-style: italic;
}
.prose hr { border: none; border-top: 1px solid var(--c-border); margin: var(--s-6) 0; }
.prose code { font-family: var(--font-mono); font-size: 0.9em; background: var(--c-cream-soft); padding: 0.1em 0.4em; border-radius: var(--r-sm); border: 1px solid var(--c-border-soft); }

/* ─── tables (used in dashboard mockups) ────────────────────────────── */

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: var(--s-3) var(--s-2);
  text-align: left;
  font-size: 0.9rem;
}
.table th {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--c-text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--c-border-soft);
}
.table td { border-top: 1px solid var(--c-border-soft); color: var(--c-text); }
.table tr:first-child td { border-top: none; }

/* ─── prose tables (markdown-rendered, e.g. legal pages) ─────────────── */
/* Hugo's goldmark emits plain <table>, not class="table". These rules give
   markdown tables borders + padding without each MD author having to touch
   layouts. Scoped to .prose so dashboard tables (.table) keep their theme. */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--s-4) 0;
  font-size: 0.92rem;
}
.prose th, .prose td {
  padding: var(--s-2) var(--s-3);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--c-border-soft);
}
.prose th {
  background: var(--c-cream-soft, #fbf9f4);
  font-weight: 600;
  border-bottom: 2px solid var(--c-border-soft);
}
.prose tbody tr:hover { background: var(--c-cream-soft, #fbf9f4); }
.prose td:first-child { font-weight: 500; }
@media (max-width: 720px) {
  .prose table { display: block; overflow-x: auto; }
}

/* ─── lang switcher ─────────────────────────────────────────────────── */

.lang-switcher {
  display: inline-flex;
  gap: var(--s-2);
  font-size: 0.78rem;
  color: var(--c-text-light);
}
.lang-switcher a { color: var(--c-text-light); }
.lang-switcher a:hover { color: var(--c-cream); }
.lang-switcher .lang-current { color: var(--c-cream); font-weight: 500; }
