/* Korean Saju Lab — global English four pillars calculator
   Palette: warm ivory, deep navy, antique gold. Mobile first. */

:root {
  --ivory: #f6f0e4;
  --ivory-deep: #efe6d5;
  --paper: #fffdf7;
  --navy: #0e1a2b;
  --navy-soft: #17263c;
  --ink: #1b2230;
  --muted: #5f6673;
  --line: rgba(14, 26, 43, 0.14);
  --gold: #b8964f;
  --gold-soft: #e7d6ac;
  --seal: #9d3b2b;

  --wood: #3f7a5a;
  --fire: #b4432b;
  --earth: #a97a3b;
  --metal: #6f7a8a;
  --water: #2f5f8c;

  --radius: 14px;
  --shadow: 0 18px 40px -28px rgba(14, 26, 43, 0.55);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Liberation Sans", "Noto Sans", sans-serif;
  --hanzi: "Noto Serif CJK KR", "Noto Serif CJK SC", "Source Han Serif", "Songti SC", "Hiragino Mincho ProN", serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }

a { color: var(--navy); text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--seal); }

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

h1 { font-size: clamp(2rem, 6.2vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.15rem); }
h3 { font-size: clamp(1.15rem, 2.6vw, 1.4rem); }

p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin: 0 0 0.6em;
}

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

.site-head {
  background: var(--navy);
  color: #f2ecdf;
  border-bottom: 1px solid rgba(231, 214, 172, 0.25);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #f7f2e6;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.12rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand:hover { color: #fff; }

.brand-mark {
  width: 26px;
  height: 26px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 0.78rem;
  font-family: var(--hanzi);
}

.site-nav { display: flex; align-items: center; gap: 18px; }

.site-nav a {
  color: rgba(247, 242, 230, 0.78);
  text-decoration: none;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}

.site-nav a:hover { color: var(--gold-soft); }
.site-nav .nav-hide { display: none; }

/* ── hero ───────────────────────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 18%, rgba(184, 150, 79, 0.22), transparent 46%),
    linear-gradient(165deg, #0e1a2b 0%, #132137 58%, #0c1626 100%);
  color: #f4eee2;
  padding: 46px 0 108px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(231, 214, 172, 0.55), transparent);
}

.hero .wrap { position: relative; z-index: 2; }

.hero h1 { color: #fdf9f0; margin-bottom: 0.35em; }
.hero h1 em { font-style: italic; color: var(--gold-soft); }

.hero-lead {
  max-width: 34em;
  color: rgba(244, 238, 226, 0.82);
  font-size: 1.02rem;
  margin-bottom: 1.4em;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(231, 214, 172, 0.9);
}

.hero-badges li {
  border: 1px solid rgba(231, 214, 172, 0.32);
  border-radius: 999px;
  padding: 4px 11px;
}

.hero-ring {
  position: absolute;
  right: -90px;
  top: 10px;
  width: 300px;
  opacity: 0.3;
  pointer-events: none;
  display: none;
}

/* ── calculator card ────────────────────────────────────── */

.calc-wrap { margin-top: -76px; position: relative; z-index: 3; padding-bottom: 8px; }

.calc {
  background: var(--paper);
  border: 1px solid rgba(14, 26, 43, 0.09);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px 20px 20px;
}

.calc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  margin-bottom: 14px;
}

.calc-head h2 { font-size: 1.22rem; margin: 0; }
.calc-head span { font-size: 0.8rem; color: var(--muted); }

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.field > label:not(.check),
.field-label {
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.field input[type="date"],
.field input[type="time"],
.field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbf7ee;
  color: var(--ink);
  font: inherit;
  font-size: 0.98rem;
  appearance: none;
}

.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--navy) 50%),
    linear-gradient(135deg, var(--navy) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.field input:focus,
.field select:focus,
.btn:focus-visible,
details summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.35;
}

.check input { width: 17px; height: 17px; accent-color: var(--navy); }

.hint { font-size: 0.78rem; color: var(--muted); line-height: 1.45; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 14px 26px;
  border: 1px solid var(--navy);
  border-radius: 999px;
  background: var(--navy);
  color: #fdf9f0;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:hover { background: #1a2c46; transform: translateY(-1px); }
.btn[disabled] { opacity: 0.6; cursor: progress; transform: none; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.btn-note { font-size: 0.78rem; color: var(--muted); margin: 0; }

.form-error {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-left: 3px solid var(--seal);
  background: rgba(157, 59, 43, 0.07);
  color: #7d2f22;
  font-size: 0.9rem;
  border-radius: 0 8px 8px 0;
}

/* ── results ────────────────────────────────────────────── */

.results { padding: 40px 0 10px; scroll-margin-top: 16px; }
.results[hidden] { display: none; }

.result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 20px;
  margin-bottom: 18px;
}

.result-head h2 { margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 0; padding: 0; list-style: none; }

.chip {
  font-size: 0.76rem;
  color: var(--navy);
  background: rgba(184, 150, 79, 0.13);
  border: 1px solid rgba(184, 150, 79, 0.32);
  border-radius: 999px;
  padding: 4px 11px;
  white-space: nowrap;
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 26px;
}

.pillar {
  position: relative;
  background: var(--paper);
  border: 1px solid rgba(14, 26, 43, 0.1);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  box-shadow: 0 10px 24px -22px rgba(14, 26, 43, 0.5);
  border-top: 3px solid var(--el-color, var(--gold));
}

.pillar-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 6px;
  margin-bottom: 10px;
}

.pillar-label {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}

.pillar-el {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--el-color, var(--gold));
  font-weight: 700;
}

.glyphs { display: flex; flex-direction: column; gap: 6px; }

.glyph { display: flex; align-items: center; gap: 9px; min-height: 2.4rem; }

.glyph .han {
  font-family: var(--hanzi);
  font-size: 2rem;
  line-height: 1;
  color: var(--navy);
}

.glyph .gname {
  font-size: 0.74rem;
  line-height: 1.3;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.pillar-note {
  margin: 9px 0 0;
  font-size: 0.7rem;
  color: #7c8290;
  letter-spacing: 0.02em;
}

.pillar-note .han { font-family: var(--hanzi); color: var(--ink); }

.pillar.is-unknown .glyph .han { color: #a9adb6; }

.dm-badge {
  position: absolute;
  top: -10px;
  right: 12px;
  background: var(--gold);
  color: #1b1405;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

/* day master panel */
.dm {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #132137, #0d1828);
  color: #f2ecdf;
  border-radius: 18px;
  border: 1px solid rgba(231, 214, 172, 0.28);
  padding: 26px 22px;
  margin-bottom: 22px;
}

.dm::before {
  content: attr(data-glyph);
  position: absolute;
  right: -6px;
  top: -34px;
  font-family: var(--hanzi);
  font-size: 12rem;
  line-height: 1;
  color: rgba(231, 214, 172, 0.07);
  pointer-events: none;
}

.dm > * { position: relative; }
.dm .eyebrow { color: var(--gold-soft); }
.dm h3 { color: #fdf9f0; margin-bottom: 4px; font-size: clamp(1.5rem, 4.4vw, 2.05rem); }
.dm-tagline { color: rgba(231, 214, 172, 0.92); font-size: 0.92rem; margin-bottom: 14px; }
.dm p { color: rgba(242, 236, 223, 0.86); font-size: 0.96rem; }

.dm-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 18px 0 18px;
}

.dm-cols h4 {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin: 0 0 8px;
}

.dm-cols ul { margin: 0; padding-left: 18px; font-size: 0.9rem; color: rgba(242, 236, 223, 0.85); }
.dm-cols li { margin-bottom: 5px; }
.dm-cols li::marker { color: var(--gold); }

.dm-facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0 0 16px;
  padding: 16px 0 0;
  border-top: 1px solid rgba(231, 214, 172, 0.22);
}

.dm-facts dt {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin-bottom: 3px;
}

.dm-facts dd { margin: 0; font-size: 0.9rem; color: rgba(242, 236, 223, 0.85); }

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.keywords li {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-soft);
  border: 1px solid rgba(231, 214, 172, 0.3);
  border-radius: 999px;
  padding: 3px 10px;
}

/* elements */
.panel {
  background: var(--paper);
  border: 1px solid rgba(14, 26, 43, 0.1);
  border-radius: 18px;
  padding: 22px 20px;
  margin-bottom: 22px;
}

.panel h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel h3 span { font-family: var(--sans); font-size: 0.75rem; color: var(--muted); font-weight: 400; letter-spacing: 0.03em; }

.bar-row { margin: 0 0 12px; }

.bar-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.86rem;
  margin-bottom: 5px;
}

.bar-name { display: inline-flex; align-items: baseline; gap: 7px; font-weight: 600; }
.bar-name .han { font-family: var(--hanzi); color: var(--el-color); font-size: 1rem; }
.bar-val { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

.bar-track {
  height: 9px;
  border-radius: 999px;
  background: #e9e1d1;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--el-color);
  width: 0;
  transition: width 0.6s ease;
}

.advice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 18px;
}

.advice {
  border-left: 3px solid var(--gold);
  padding: 2px 0 2px 13px;
  font-size: 0.9rem;
  margin: 0;
}

.advice b { display: block; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }

/* 2027 card */
.year-card {
  background: linear-gradient(155deg, #fbf4e4, #f3e8d2);
  border: 1px solid rgba(184, 150, 79, 0.4);
  border-radius: 18px;
  padding: 22px 20px;
  margin-bottom: 22px;
}

.year-card .glyph-inline {
  font-family: var(--hanzi);
  font-size: 1.5rem;
  color: var(--seal);
  border: 1px solid rgba(157, 59, 43, 0.35);
  border-radius: 10px;
  padding: 4px 10px;
  display: inline-block;
  margin-bottom: 10px;
  background: rgba(255, 253, 247, 0.7);
}

.year-card h3 { margin-bottom: 8px; }
.year-card p { font-size: 0.94rem; margin-bottom: 0.7em; }
.year-card .caution { font-size: 0.84rem; color: #6b5a3a; margin: 0; }

.result-foot {
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 4px;
}

/* ── ad slots ───────────────────────────────────────────── */

.ad-slot {
  margin: 40px auto;
  padding: 18px 12px;
  border: 1px dashed rgba(14, 26, 43, 0.22);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.7);
  text-align: center;
  min-height: 96px;
  display: grid;
  place-items: center;
  gap: 4px;
}

.ad-slot .ad-label {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8b909b;
}

.ad-slot .ad-note { font-size: 0.78rem; color: #9aa0aa; }

/* ── guide ──────────────────────────────────────────────── */

.guide { padding: 34px 0 10px; }
.guide section { padding: 26px 0; border-top: 1px solid var(--line); }
.guide section:first-of-type { border-top: 0; }
.guide p { max-width: 46em; }
.guide .lead { font-size: 1.02rem; color: #333b48; }

.pillar-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 4px 0 8px; }
.pillar-table th, .pillar-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pillar-table th { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.pillar-table td:first-child { font-family: var(--serif); font-size: 1rem; white-space: nowrap; }

.master-list { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 14px; }

.master-item {
  background: var(--paper);
  border: 1px solid rgba(14, 26, 43, 0.1);
  border-radius: 12px;
  padding: 12px 14px;
}

.master-item summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 10px; }
.master-item summary::-webkit-details-marker { display: none; }
.master-item summary .han { font-family: var(--hanzi); font-size: 1.25rem; color: var(--navy); }
.master-item summary .m-name { font-family: var(--serif); font-size: 1rem; }
.master-item summary .m-el { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-left: auto; }
.master-item p { font-size: 0.9rem; margin: 10px 0 0; color: #3a4150; }

.element-list { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 8px; }
.element-item { border-left: 3px solid var(--el-color); padding-left: 13px; }
.element-item h4 { margin: 0 0 3px; font-family: var(--serif); font-size: 1.05rem; }
.element-item h4 .han { font-family: var(--hanzi); color: var(--el-color); margin-right: 6px; }
.element-item p { margin: 0; font-size: 0.9rem; color: #3a4150; }

details.faq {
  background: var(--paper);
  border: 1px solid rgba(14, 26, 43, 0.1);
  border-radius: 12px;
  padding: 0 16px;
  margin-bottom: 10px;
}

details.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 15px 26px 15px 0;
  font-family: var(--serif);
  font-size: 1.02rem;
  color: var(--navy);
  position: relative;
}

details.faq summary::-webkit-details-marker { display: none; }

details.faq summary::after {
  content: "+";
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-size: 1.3rem;
  line-height: 1;
}

details.faq[open] summary::after { content: "\2013"; }

details.faq .faq-body { padding: 0 0 16px; font-size: 0.93rem; color: #3a4150; }
details.faq .faq-body p:last-child { margin-bottom: 0; }

.method { margin: 0; padding-left: 20px; font-size: 0.93rem; color: #3a4150; }
.method li { margin-bottom: 8px; }

.disclaimer {
  font-size: 0.82rem;
  color: var(--muted);
  background: rgba(184, 150, 79, 0.1);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 26px 0 0;
}

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

.site-foot {
  margin-top: 40px;
  background: var(--navy);
  color: rgba(242, 236, 223, 0.72);
  padding: 38px 0 30px;
  font-size: 0.85rem;
}

.site-foot .wrap { display: grid; gap: 22px; }
.site-foot .brand { color: #f7f2e6; }
.site-foot p { margin: 8px 0 0; max-width: 32em; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; margin: 0; padding: 0; }
.foot-links a { color: rgba(242, 236, 223, 0.82); text-decoration: none; border-bottom: 1px solid rgba(231, 214, 172, 0.35); }
.foot-links a:hover { color: var(--gold-soft); }
.foot-fine { font-size: 0.76rem; color: rgba(242, 236, 223, 0.5); margin: 0; }

/* ── document pages ─────────────────────────────────────── */

.doc { padding: 46px 0 20px; }
.doc h1 { font-size: clamp(1.7rem, 5vw, 2.5rem); }
.doc h2 { font-size: 1.25rem; margin-top: 1.6em; }
.doc .updated { font-size: 0.78rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.doc ul { padding-left: 20px; }
.doc li { margin-bottom: 8px; }

/* ── responsive ─────────────────────────────────────────── */

@media (max-width: 639px) {
  .hero { padding: 34px 0 92px; }
  .hero h1 { font-size: 2rem; }
  .hero-lead { font-size: 0.98rem; line-height: 1.55; margin-bottom: 1.15em; }
  .hero-badges { font-size: 0.69rem; gap: 6px 8px; }
  .calc-wrap { margin-top: -58px; }
  .site-nav { gap: 13px; }
  .site-nav a { font-size: 0.8rem; }
  .dm .eyebrow { font-size: 0.66rem; letter-spacing: 0.1em; }
  .pillar-label, .pillar-el { font-size: 0.64rem; letter-spacing: 0.1em; }
  .pillar-note { font-size: 0.66rem; }
}

/* the brand is three words long: keep it on one line down to 360px */
@media (max-width: 400px) {
  .brand { font-size: 0.98rem; gap: 7px; }
  .brand-mark { width: 24px; height: 24px; }
  .site-nav { gap: 11px; }
  .site-nav a { font-size: 0.76rem; }
}

@media (max-width: 340px) {
  .site-head .wrap { flex-wrap: wrap; }
  .site-nav { width: 100%; gap: 22px; }
  .site-head { padding-bottom: 4px; }
}

@media (min-width: 640px) {
  .hero-ring { display: block; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pillar-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .dm-cols { grid-template-columns: 1fr 1fr; }
  .dm-facts { grid-template-columns: 1fr 1fr; }
  .advice-grid { grid-template-columns: 1fr 1fr; }
  .master-list { grid-template-columns: 1fr 1fr; }
  .element-list { grid-template-columns: 1fr 1fr; }
  .site-foot .wrap { grid-template-columns: 1.4fr 1fr; align-items: start; }
}

@media (min-width: 900px) {
  .hero { padding: 62px 0 120px; }
  .hero-ring { width: 470px; right: -40px; top: -60px; }
  .calc { padding: 26px 26px 24px; }
  .field-grid { grid-template-columns: 1.1fr 1.1fr 0.9fr 1.4fr; }
  .site-nav .nav-hide { display: inline; }
  .dm { padding: 32px 30px; }
  .panel, .year-card { padding: 26px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar-fill, .btn { transition: none; }
}
