:root {
  color-scheme: light dark;
  --paper: #f3f6f7;
  --surface: #ffffff;
  --ink: #102028;
  --muted: #586a71;
  --line: #ccd6d9;
  --accent: #005f9e;
  --accent-ink: #004b7d;
  --frame: #13232a;
  --shadow: rgba(24, 47, 58, 0.14);
  font-family: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101b20;
    --surface: #16252b;
    --ink: #eef4f5;
    --muted: #b6c6ca;
    --line: #385057;
    --accent: #72b9eb;
    --accent-ink: #9dd3f6;
    --frame: #071015;
    --shadow: rgba(0, 0, 0, 0.38);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible, [tabindex="0"]:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  transform: translateY(-200%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 0.8rem;
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  width: min(1240px, calc(100% - 3rem));
  height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 1.12rem;
  font-weight: 760;
  letter-spacing: -0.035em;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(1rem, 2.2vw, 2rem);
  font-size: 0.94rem;
}

.site-nav a { text-decoration: none; }


.page-shell { width: min(1240px, calc(100% - 3rem)); margin: 0 auto; }

.hero {
  min-height: calc(100dvh - 76px);
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(340px, 0.74fr);
  align-items: center;
  gap: clamp(2rem, 8vw, 8rem);
  padding: clamp(3.5rem, 7vw, 7rem) 0 clamp(3.5rem, 6vw, 6rem);
}

.hero-copy { max-width: 34rem; }

.kicker {
  margin: 0 0 1.15rem;
  color: var(--accent-ink);
  font-size: 0.82rem;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 9.5ch;
  margin-bottom: 1.5rem;
  font-size: clamp(3.2rem, 6.4vw, 6.1rem);
  line-height: 0.95;
  letter-spacing: -0.075em;
  font-weight: 760;
}

.hero-copy > p:not(.kicker) {
  max-width: 31rem;
  margin-bottom: 2rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.6vw, 1.22rem);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--accent-ink);
  font-weight: 720;
  text-decoration: none;
}

.text-link::after { content: "↗"; font-size: 1.1em; }
.text-link:active { transform: translateY(1px); }

.hero-visual { display: flex; justify-content: flex-end; }

.app-frame {
  width: min(100%, 400px);
  overflow: hidden;
  border: 9px solid var(--frame);
  border-radius: 28px;
  background: var(--frame);
  box-shadow: 20px 24px 0 var(--shadow);
}

.app-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.app-note {
  width: min(100%, 400px);
  margin: 1rem 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 8vw, 8rem);
  padding: clamp(5rem, 10vw, 10rem) 0;
  border-top: 1px solid var(--line);
}

.intro h2, .detail-section h2, .legal-heading h1 {
  margin-bottom: 1.1rem;
  font-size: clamp(2rem, 3.6vw, 3.85rem);
  line-height: 1.02;
  letter-spacing: -0.06em;
}

.intro p { max-width: 39rem; color: var(--muted); font-size: 1.1rem; }

.principles { padding-bottom: clamp(5rem, 10vw, 10rem); }

.principles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.principle { min-height: 232px; padding: 1.55rem clamp(1.2rem, 2.5vw, 2.4rem) 2rem 0; }
.principle + .principle { border-left: 1px solid var(--line); padding-left: clamp(1.2rem, 2.5vw, 2.4rem); }
.principle h3 { margin-bottom: 0.85rem; font-size: 1.45rem; letter-spacing: -0.035em; }
.principle p { max-width: 16rem; margin-bottom: 0; color: var(--muted); }

.detail-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.72fr);
  gap: clamp(2rem, 9vw, 9rem);
  align-items: end;
  padding: clamp(5rem, 10vw, 10rem) 0;
  border-top: 1px solid var(--line);
}

.detail-section p { max-width: 33rem; color: var(--muted); font-size: 1.08rem; }
.detail-section a { font-size: 1.05rem; }

.legal-links {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.legal-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 1.08rem;
  font-weight: 650;
  text-decoration: none;
}

.legal-links a span:last-child { color: var(--accent-ink); }

.site-footer {
  width: min(1240px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}

.footer-row { display: flex; justify-content: space-between; gap: 1rem; }

.footer-links {
  display: flex;
  justify-content: flex-end;
  gap: 1.4rem;
  text-align: right;
}

.footer-links a { text-decoration: none; }

.legal-page { padding: clamp(3.5rem, 8vw, 7rem) 0 clamp(5rem, 10vw, 9rem); }
.legal-heading { max-width: 46rem; padding-bottom: 3.5rem; border-bottom: 1px solid var(--line); }
.legal-heading h1 { max-width: none; }
.legal-heading p { max-width: 40rem; color: var(--muted); }

.legal-copy {
  display: grid;
  grid-template-columns: minmax(0, 9rem) minmax(0, 42rem);
  gap: clamp(1.5rem, 7vw, 8rem);
  padding-top: 3rem;
}

.legal-index { position: sticky; top: 1.5rem; align-self: start; color: var(--muted); font-size: 0.88rem; }
.legal-index a { display: block; margin: 0 0 0.7rem; text-decoration: none; }
.legal-text h2 { margin: 3rem 0 0.75rem; font-size: 1.45rem; letter-spacing: -0.035em; }
.legal-text h2:first-child { margin-top: 0; }
.legal-text p, .legal-text li { color: var(--muted); }
.legal-text ul { padding-left: 1.25rem; }
.legal-text li + li { margin-top: 0.45rem; }
.legal-text strong { color: var(--ink); }
.legal-text .rule { margin-top: 2.5rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }

.excel-home {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  align-items: center;
  gap: clamp(2rem, 7vw, 6rem);
  padding: clamp(4.5rem, 9vw, 8rem) 0;
  border-top: 1px solid var(--line);
}

.excel-home-copy h2 {
  max-width: 12ch;
  margin-bottom: 1rem;
  font-size: clamp(2.25rem, 4.2vw, 4rem);
  line-height: 1;
  letter-spacing: -0.065em;
}

.excel-home-copy > p:not(.kicker) { max-width: 35rem; color: var(--muted); font-size: 1.08rem; }
.excel-actions, .guide-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.85rem 1rem; margin: 1.65rem 0 1rem; }
.action-link { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 0.5rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.65rem 1.05rem; font-size: 0.93rem; font-weight: 700; text-decoration: none; transition: transform 120ms ease, background 120ms ease, border-color 120ms ease; }
.action-link:hover { transform: translateY(-1px); }
.action-primary { border-color: var(--accent); background: var(--accent); color: var(--paper); }
.action-primary:hover { color: var(--paper); background: var(--accent-ink); }
.action-secondary { background: var(--surface); }
.excel-note, .guide-actions > span { margin: 0; font-size: 0.86rem !important; }
.excel-sheet-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 12px 16px 0 var(--shadow); }
.excel-sheet-top, .example-sheet-label { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.sheet-status { border: 1px solid var(--line); border-radius: 5px; padding: 0.1rem 0.4rem; font-size: 0.72rem; }
.excel-table-scroll, .guide-table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.excel-table, .guide-table { width: 100%; border-collapse: collapse; text-align: left; }
.excel-table { min-width: 710px; font-size: 0.75rem; }
.excel-table th, .guide-table th { background: var(--paper); color: var(--ink); font-size: 0.77rem; font-weight: 750; white-space: nowrap; }
@supports (background: color-mix(in srgb, white, black)) {
  .excel-table th, .guide-table th { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
}
.excel-table th, .excel-table td { padding: 0.8rem 0.75rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.excel-table td:first-child, .excel-table td:nth-child(2) { font-weight: 650; }
.excel-table tbody tr:last-child td { border-bottom: 0; }
.picture-cell { display: inline-flex; min-width: 3rem; justify-content: center; border-radius: 4px; background: var(--paper); color: var(--muted); padding: 0.15rem 0.3rem; }
.sheet-caption { margin: 0; padding: 0.7rem 1rem 0.85rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; }

.guide-page { padding-top: clamp(3.25rem, 7vw, 6rem); }
.guide-heading { max-width: 58rem; padding-bottom: 2.5rem; }
.guide-heading h1 { max-width: 15ch; font-size: clamp(2.8rem, 6.6vw, 5.25rem); line-height: 0.98; }
.guide-heading > p:not(.kicker) { max-width: 46rem; font-size: 1.08rem; }
.guide-actions { margin-bottom: 0; }
.guide-actions > span { color: var(--muted); }
.guide-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 2rem 0 0; border-bottom: 1px solid var(--line); }
.guide-facts > div { display: grid; gap: 0.25rem; padding: 1rem 1.1rem 1.2rem 0; }
.guide-facts > div + div { border-left: 1px solid var(--line); padding-left: 1.1rem; }
.guide-facts span { color: var(--muted); font-size: 0.83rem; }
.guide-facts strong { font-size: 1rem; letter-spacing: -0.02em; }
.guide-text { min-width: 0; }
.guide-text section + section { margin-top: 4.5rem; }
.guide-text section > h2 { scroll-margin-top: 1.5rem; }
.guide-text p, .guide-text li { line-height: 1.72; }
.guide-steps, .guide-text ul { padding-left: 1.35rem; }
.guide-steps li, .guide-text li { padding-left: 0.2rem; }
.guide-steps li + li, .guide-text li + li { margin-top: 0.8rem; }
.guide-text strong { color: var(--ink); }
.guide-table-scroll { margin: 1.25rem 0 1.5rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.guide-table { min-width: 650px; font-size: 0.9rem; }
.guide-table th, .guide-table td { padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.guide-table tbody tr:last-child th, .guide-table tbody tr:last-child td { border-bottom: 0; }
.guide-table tbody th { background: var(--paper); }
@supports (background: color-mix(in srgb, white, black)) {
  .guide-table tbody th { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
}
.guide-table tbody td { color: var(--muted); }
.example-sheet { overflow: hidden; margin-top: 1.6rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.example-sheet .guide-table-scroll { margin: 0; border: 0; border-radius: 0; }
.example-sheet-label { border-bottom: 1px solid var(--line); }
.example-table { min-width: 820px; font-size: 0.78rem; }
.guide-bottom-action { margin-top: 2.5rem; }

@media (max-width: 760px) {
  .excel-home { grid-template-columns: 1fr; gap: 2.25rem; padding: 4rem 0; }
  .excel-sheet-card { grid-row: 2; }
  .guide-heading h1 { max-width: 13ch; font-size: clamp(2.7rem, 12vw, 4rem); }
  .guide-facts { grid-template-columns: 1fr; }
  .guide-facts > div { padding: 0.8rem 0; }
  .guide-facts > div + div { border-top: 1px solid var(--line); border-left: 0; padding-left: 0; }
  .guide-facts strong { font-size: 0.97rem; }
  .guide-text section + section { margin-top: 3rem; }
  .guide-table { font-size: 0.84rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media (max-width: 760px) {
  .site-header, .page-shell, .site-footer { width: min(100% - 2rem, 1240px); }
  .site-header { height: auto; min-height: 70px; gap: 1rem; }
  .site-nav { gap: 0.75rem; font-size: 0.84rem; }
  .site-nav .home-only { display: none; }
  .hero { grid-template-columns: 1fr; gap: 3rem; min-height: auto; padding-top: 4rem; }
  h1 { max-width: 11ch; font-size: clamp(3.1rem, 15vw, 4.8rem); }
  .hero-visual { justify-content: flex-start; }
  .app-note { margin-left: 0; }
  .intro, .detail-section, .legal-copy { grid-template-columns: 1fr; gap: 1.8rem; }
  .principles-grid { grid-template-columns: 1fr; }
  .principle { min-height: 0; padding: 1.6rem 0; }
  .principle + .principle { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
  .legal-index { display: none; }
  .footer-row { flex-direction: column; }
  .footer-links { justify-content: flex-start; text-align: left; }
}

/* Keep the two import guides and language controls usable on narrow phones. */
@media (max-width: 760px) {
  .site-header { flex-wrap: wrap; padding-block: 12px; }
  .site-nav { flex-wrap: wrap; }
}
