:root {
  --ink: #182326;
  --muted: #566461;
  --light: #66736f;
  --paper: #f8f6f0;
  --cream: #ffffff;
  --surface-subtle: #f2efe7;
  --line: rgba(24, 35, 38, 0.12);
  --line-strong: rgba(24, 35, 38, 0.22);
  --green: #8cae68;
  --deep: #182326;
  --orange: #e65124;
  --orange-text: #bf3f18;
  --orange-soft: #fbf0ec;
  --surface-raised: #ffffff;
  --tint: rgba(24, 35, 38, 0.08);
  --card-bg: #182326;
  --card-line: transparent;
  --card-fg: #ffffff;
  --card-muted: #b8c4c1;
  --card-light: #8c9c99;
  --icon-filter: none;
  color-scheme: light;
}

/* Dark mode: follows the OS unless the header switch stored a choice. Same values in both blocks. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f2efe8;
    --muted: #b3bcb8;
    --light: #8e9894;
    --paper: #182326;
    --cream: #1f2b2e;
    --surface-subtle: #243033;
    --line: rgba(242, 239, 232, 0.12);
    --line-strong: rgba(242, 239, 232, 0.24);
    --orange: #f26a3d;
    --orange-text: #f5865f;
    --orange-soft: #2b2622;
    --surface-raised: #243033;
    --tint: rgba(242, 239, 232, 0.1);
    --card-bg: #1f2b2e;
    --card-line: rgba(242, 239, 232, 0.24);
    --card-fg: #f2efe8;
    --card-muted: #b3bcb8;
    --card-light: #8e9894;
    --icon-filter: invert(1) hue-rotate(180deg);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --ink: #f2efe8;
  --muted: #b3bcb8;
  --light: #8e9894;
  --paper: #182326;
  --cream: #1f2b2e;
  --surface-subtle: #243033;
  --line: rgba(242, 239, 232, 0.12);
  --line-strong: rgba(242, 239, 232, 0.24);
  --orange: #f26a3d;
  --orange-text: #f5865f;
  --orange-soft: #2b2622;
  --surface-raised: #243033;
  --tint: rgba(242, 239, 232, 0.1);
  --card-bg: #1f2b2e;
  --card-line: rgba(242, 239, 232, 0.24);
  --card-fg: #f2efe8;
  --card-muted: #b3bcb8;
  --card-light: #8e9894;
  --icon-filter: invert(1) hue-rotate(180deg);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

.shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--cream);
  z-index: 5;
}

/* Header & Navigation */
.site-header {
  position: relative;
  width: 100%;
  top: 0;
  z-index: 10;
  background: var(--paper);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: contain;
  filter: var(--icon-filter);
}

.brand-dot {
  color: var(--orange);
}

nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 14px;
}

nav a {
  color: var(--muted);
  font-weight: 500;
  transition: color 0.15s;
}

nav a:hover,
nav a:focus-visible,
.text-link:hover,
.text-link:focus-visible,
.card-links a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav-index {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--light);
  margin-right: 5px;
}

.nav-cta {
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--cream);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.nav-cta span {
  color: var(--orange);
}

.nav-cta:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}

/* Typography Standards */
.eyebrow,
.card-type,
.visual-kicker {
  margin: 0 0 14px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
}

h1, h2, h3 {
  letter-spacing: -0.038em;
  line-height: 1.1;
  margin: 0;
  color: var(--ink);
}

h1 {
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 600;
}

h1 span {
  display: block;
}

h1 .h1-soft {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-weight: 400;
}

h2 {
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 600;
}

h3 {
  font-size: 20px;
  font-weight: 600;
}

/* Hero Section */
.hero {
  padding: 48px 0 40px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 56px;
  align-items: center;
}

.hero-copy {
  max-width: 580px;
}

.hero-lede {
  margin: 20px 0 28px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--muted);
}

.actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 14px;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.button-dark {
  background: var(--ink);
  color: var(--paper);
}

.button-dark span {
  color: var(--orange);
}

.button-light {
  background: var(--cream);
  color: var(--ink);
  border-color: var(--line-strong);
}

.button-light span {
  color: var(--orange);
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(24, 35, 38, 0.12);
}

.hero-note {
  margin: 18px 0 0;
  color: var(--light);
  font-size: 13px;
}

.text-link {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-block: 10px;
}

.text-link span {
  color: var(--orange);
}

/* Interactive Workflow Diagnosis Panel (Hero Right) */
.hero-art {
  position: relative;
}

.diagnostic-panel {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(24, 35, 38, 0.05);
}

.diagnostic-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.diagnostic-header h2 {
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.diagnostic-header .diag-indicator {
  font-size: 11px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--orange-text);
  font-weight: 600;
}

.diagnostic-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  color: var(--ink);
}

.diag-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.diag-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.diag-card:hover,
.diag-card:focus-visible {
  background: var(--surface-raised);
  border-color: var(--ink);
  box-shadow: 0 2px 10px rgba(24, 35, 38, 0.08);
}

.diag-card:hover .diag-icon,
.diag-card:focus-visible .diag-icon {
  background: var(--ink);
  color: var(--cream);
}

.diag-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--tint);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.diag-content {
  flex: 1;
}

.diag-content h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 2px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.diag-content p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.diag-tag {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 11px;
  color: var(--orange-text);
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Systems 3-Column Division (01 Fit, 02 Focus, 03 Care) */
.systems-grid-section {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.systems-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.system-column {
  padding: 36px 32px;
  border-right: 1px solid var(--line);
}

.system-column:first-child {
  padding-left: 0;
}

.system-column:last-child {
  border-right: none;
  padding-right: 0;
}

.col-step {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--orange-text);
  font-weight: 600;
  display: block;
  margin-bottom: 10px;
}

.col-title {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
}

.col-desc {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 16px;
}

.col-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.col-list li {
  font-size: 13px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.col-list li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
}

/* Proof Line / Foundation Bar */
.foundation-bar {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  background: var(--cream);
}

.foundation-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  flex-wrap: wrap;
  gap: 14px;
}

.foundation-label {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.foundation-links {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.foundation-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 500;
  font-size: 13px;
}

.foundation-item img {
  width: 22px;
  height: 22px;
  filter: var(--icon-filter);
}

.foundation-item.github-link {
  color: var(--muted);
}

.foundation-item.github-link span {
  color: var(--orange);
}

.proof-line {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 20px 0 0;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.proof-line span + span:before {
  content: "·";
  margin-right: 18px;
  color: var(--orange);
}

/* Integrated Start & Studio Footer Section */
.start-section {
  background: var(--paper);
  padding: 44px 0 32px;
}

.start-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 48px;
  padding: 40px 48px;
  background: var(--card-bg);
  border: 1px solid var(--card-line);
  color: var(--card-fg);
  border-radius: 8px;
}

.start-card .eyebrow {
  color: var(--orange);
}

.start-card h2 {
  max-width: 580px;
  color: var(--card-fg);
}

.start-lede {
  max-width: 520px;
  color: var(--card-muted);
  font-size: 16px;
  margin: 14px 0 0;
  line-height: 1.55;
}

.start-actions {
  text-align: right;
  min-width: 220px;
  flex-shrink: 0;
}

.start-subnote {
  font-size: 12px;
  color: var(--card-light);
  margin: 10px 0 0;
}

/* Footer */
.site-footer {
  padding: 36px 0 44px;
  background: var(--cream);
  border-top: 1px solid var(--line);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-brand {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.footer-brand img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: contain;
  filter: var(--icon-filter);
}

.footer-tagline,
.footer-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.footer-bottom nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
}

.footer-bottom nav a {
  color: var(--muted);
  font-weight: 500;
  transition: color 0.15s;
}

.footer-bottom nav a:hover,
.footer-bottom nav a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Theme switch: hidden until theme.js has run, so a no-script page shows no dead control */
.theme-toggle {
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s;
}

html[data-theme] .theme-toggle {
  display: grid;
}

.theme-toggle:hover {
  border-color: var(--ink);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-sun,
html[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

/* Accessibility & Focus */
a:focus-visible,
input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Responsive Breakpoints */
@media (max-width: 1140px) {
  .foundation-links {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px 22px;
  }
}

@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .systems-grid {
    grid-template-columns: 1fr;
  }
  .system-column {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 28px 0;
  }
  .system-column:last-child {
    border-bottom: none;
  }
  .start-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 32px 28px;
    gap: 24px;
  }
  .start-actions {
    text-align: left;
  }
}

@media (max-width: 680px) {
  .foundation-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-header .nav-wrap {
    flex-wrap: wrap;
    row-gap: 10px;
    padding-block: 12px;
    min-height: 0;
  }
  .site-header nav {
    display: contents;
  }
  .site-header .nav-cta {
    order: 1;
    padding: 7px 12px;
    font-size: 12px;
  }
  .site-header .theme-toggle {
    order: 2;
    margin-left: auto;
    width: 32px;
    height: 32px;
  }
  .site-header .nav-wrap::after {
    content: "";
    order: 1;
    flex-basis: 100%;
  }
  .site-header nav a:not(.nav-cta) {
    order: 2;
    font-size: 13px;
    margin-right: 18px;
  }
  .hero {
    padding: 36px 0 28px;
  }
  .hero h1 {
    font-size: 34px;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .footer-bottom nav {
    flex-wrap: wrap;
    gap: 14px;
  }
}
