:root {
  --ink: #17211d;
  --muted: #5b6b63;
  --paper: #f6f8f6;
  --surface: #ffffff;
  --band: #e8efea;
  --line: #d0dbd3;
  --forest: #1f5c43;
  --forest-light: #2d7a5a;
  --teal: #0f6b75;
  --red: #a84235;
  --gold: #c8922b;
  --gold-light: #e0b04a;
  --white: #ffffff;
  --shadow-sm: 0 2px 8px rgba(21, 31, 27, 0.08);
  --shadow-md: 0 8px 30px rgba(21, 31, 27, 0.1);
  --shadow-lg: 0 18px 50px rgba(21, 31, 27, 0.13);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
  padding: 0.75rem clamp(1rem, 4vw, 3.5rem);
  background: rgba(246, 248, 246, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  color: var(--ink);
  font-weight: 820;
  text-decoration: none;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 1.6vw, 1.15rem);
  font-size: 0.92rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.2rem;
  transition: color 0.2s;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--forest);
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  padding: 10px 8px;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2.5px;
  margin: 4px auto;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s;
}

.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: min(82vh, 800px);
  padding: clamp(5rem, 13vh, 8rem) clamp(1rem, 5vw, 4rem) clamp(3rem, 9vh, 5rem);
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 60% at 100% 0%, rgba(31, 92, 67, 0.25), transparent),
    radial-gradient(ellipse 70% 50% at 0% 100%, rgba(200, 146, 43, 0.12), transparent),
    linear-gradient(160deg, #1a2e25 0%, #1f3b2f 30%, #1f5c43 60%, #1a4a3a 100%);
  color: var(--white);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 40px,
      rgba(255, 255, 255, 0.015) 40px,
      rgba(255, 255, 255, 0.015) 41px
    );
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold), var(--teal), var(--red));
}

.hero-content {
  position: relative;
  max-width: 820px;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--gold-light);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

h1,
h2,
h3 {
  letter-spacing: -0.02em;
  line-height: 1.06;
}

h1 {
  max-width: 860px;
  margin-bottom: 1.2rem;
  font-size: clamp(2.8rem, 7.5vw, 6rem);
  font-weight: 850;
}

h2 {
  font-size: clamp(1.6rem, 3.8vw, 2.8rem);
  font-weight: 790;
}

h3 {
  font-size: 1.15rem;
  font-weight: 760;
}

.lead {
  max-width: 720px;
  font-size: clamp(1.05rem, 1.9vw, 1.3rem);
  line-height: 1.65;
  opacity: 0.9;
}

.lead.dark {
  opacity: 1;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.8rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 750;
  text-decoration: none;
  line-height: 1.2;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.button.primary {
  background: var(--gold);
  color: #1f1807;
}

.button.primary:hover {
  background: var(--gold-light);
}

.button.secondary {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.4);
}

.button.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.6);
}

.band,
.method-flow,
.example-section,
.why-section,
.resource-band,
.subpage {
  padding: clamp(3rem, 7vw, 5.5rem) clamp(1rem, 5vw, 4rem);
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(280px, 1.15fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
}

.intro-text {
  max-width: 780px;
}

.intro-text p,
.flow-copy p,
.example-copy p,
.feature p,
.resource-copy p,
.download-item p {
  color: var(--muted);
  line-height: 1.7;
}

.method-flow {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1.2fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  background: var(--band);
}

.flow-copy {
  max-width: 680px;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  list-style: none;
}

.flow-steps li {
  background: var(--surface);
  padding: clamp(1.2rem, 3vw, 2rem);
  transition: box-shadow 0.2s;
}

.flow-steps li:hover {
  box-shadow: inset 0 0 0 2px var(--forest-light);
  position: relative;
  z-index: 1;
}

.flow-steps span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--band);
  color: var(--forest);
  font-weight: 820;
  font-size: 0.85rem;
}

.flow-steps strong {
  display: block;
  margin-bottom: 0.5rem;
}

.flow-steps p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.example-section {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(300px, 1fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
}

.comparison {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s;
}

.comparison:hover {
  box-shadow: var(--shadow-md);
}

.store-row {
  display: grid;
  grid-template-columns: 1fr 1fr 0.8fr;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}

.store-row.header {
  background: var(--forest);
  color: var(--white);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  color: #1f1807;
  font-weight: 820;
  font-size: 0.9rem;
}

.comparison-note {
  margin: 0;
  padding: 1rem 1.2rem 1.25rem;
  color: var(--muted);
  line-height: 1.6;
}

.why-section {
  background: var(--band);
}

.section-heading {
  max-width: 920px;
  margin-bottom: clamp(1.5rem, 3.5vw, 2.5rem);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
}

.feature {
  background: var(--surface);
  padding: clamp(1.3rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.2s, box-shadow 0.2s;
}

.feature:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.feature h3 {
  margin-bottom: 0.6rem;
}

.feature p {
  margin-bottom: 0;
}

.resource-band {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(280px, 1.15fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
  background: var(--forest);
  color: var(--white);
}

.resource-copy {
  max-width: 740px;
}

.resource-copy p {
  color: rgba(255, 255, 255, 0.82);
}

.resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: flex-end;
}

.resource-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.3rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-weight: 750;
  text-decoration: none;
  line-height: 1.2;
  transition: background 0.2s, border-color 0.2s;
  color: var(--white);
}

.resource-links a:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.5);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1.3rem clamp(1rem, 5vw, 4rem);
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
}

.subpage {
  min-height: calc(100vh - 130px);
}

.subpage-hero {
  max-width: 860px;
  margin-bottom: clamp(1.5rem, 4vw, 3rem);
}

.subpage h1 {
  color: var(--ink);
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.download-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: clamp(1.3rem, 3vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.2s, box-shadow 0.2s;
}

.download-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.download-item p {
  margin: 0;
}

.download-item ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.7;
}

.download-item .button {
  margin-top: auto;
}

.download-item .button.secondary {
  background: var(--forest);
  color: var(--white);
  border-color: transparent;
}

.download-item .button.secondary:hover {
  background: var(--forest-light);
}

code {
  color: var(--red);
  white-space: normal;
  font-size: 0.92em;
}

/* ---- Homepage demo ---- */

.home-demo {
  padding: clamp(3rem, 7vw, 5.5rem) clamp(1rem, 5vw, 4rem);
  background: linear-gradient(180deg, var(--band), var(--paper));
}

.home-demo .section-heading p {
  max-width: 640px;
  color: var(--muted);
  line-height: 1.7;
}

.demo-app {
  margin: 1.5rem 0;
}

.de-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.de-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.de-table th,
.de-table td {
  padding: 0.6rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.de-table th {
  background: var(--forest);
  color: var(--white);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: top;
}

.de-table tbody tr:last-child td {
  border-bottom: none;
}

.de-table tbody tr:hover {
  background: rgba(31, 92, 67, 0.03);
}

.de-elem {
  min-width: 110px;
}

.de-aspect {
  min-width: 140px;
  text-align: center;
}

.de-fn {
  display: block;
  font-weight: 400;
  font-size: 0.7rem;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.85;
  margin-top: 0.15rem;
}

.de-apl {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.9;
  background: rgba(255,255,255,0.15);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.de-total {
  min-width: 55px;
  text-align: center;
}

.de-elem-cell {
  font-weight: 600;
}

.de-val-cell {
  text-align: center;
  vertical-align: middle;
}

.de-raw {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  transition: background 0.15s;
}

.de-raw:hover {
  background: var(--band);
}

.de-inline-edit {
  padding: 0.2rem 0.3rem;
  border: 2px solid var(--forest);
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  background: var(--paper);
  width: 56px;
}

.de-level {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--forest);
  margin-top: 0.15rem;
}

.de-total-cell {
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
}

.de-p1 td {
  background: #f0f9f3;
}

.de-p1 .de-total-cell {
  color: var(--forest);
}

.de-summary {
  margin-top: 0.8rem;
}

.de-tie {
  margin: 0;
  padding: 0.65rem 0.9rem;
  background: #fff8e6;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

.de-tie.de-no-tie {
  background: #eef4f0;
  border-left-color: var(--forest);
}

.de-note {
  margin: 0.8rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.demo-cta {
  margin-top: 1.5rem;
}

.demo-cta .button.primary {
  background: var(--forest);
  color: var(--white);
}

.demo-cta .button.primary:hover {
  background: var(--forest-light);
}

/* ---- Tool page ---- */

.tool-page {
  background: linear-gradient(180deg, var(--paper), var(--band));
}

.tool-placeholder {
  max-width: 760px;
  padding: clamp(1.3rem, 3vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.tool-placeholder ul {
  margin: 0 0 1.2rem;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.7;
}

.reveal {
  transform: translateY(18px);
  opacity: 0;
  transition: opacity 600ms ease, transform 600ms ease;
}

.reveal.is-visible {
  transform: translateY(0);
  opacity: 1;
}

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

.visual-section {
  padding: clamp(3rem, 7vw, 5.5rem) clamp(1rem, 5vw, 4rem);
  background: linear-gradient(180deg, var(--paper), var(--band));
  text-align: center;
}

.pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 2rem auto;
  max-width: 1000px;
  flex-wrap: wrap;
}

.pipe-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.2rem 0.8rem;
  min-width: 150px;
  flex: 1;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.6s, box-shadow 0.6s, transform 0.3s;
}

.pipe-stage:hover {
  border-color: var(--forest-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.pipe-stage.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 146, 43, 0.15);
}

.pipe-stage[data-stage="1"].active { border-color: var(--teal); }
.pipe-stage[data-stage="2"].active { border-color: var(--forest); }
.pipe-stage[data-stage="3"].active { border-color: var(--gold); }
.pipe-stage[data-stage="4"].active { border-color: var(--red); }

.pipe-icon {
  color: var(--muted);
  transition: color 0.4s;
}

.pipe-stage.active .pipe-icon {
  color: var(--ink);
}

.pipe-stage strong {
  font-size: 0.92rem;
  color: var(--ink);
}

.pipe-data {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.pipe-label {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.15rem;
}

.pipe-arrow {
  color: var(--muted);
  flex-shrink: 0;
  animation: arrowPulse 1.8s ease-in-out infinite;
}

.pipe-arrow:nth-child(6) { animation-delay: 0.6s; }
.pipe-arrow:nth-child(10) { animation-delay: 1.2s; }

@keyframes arrowPulse {
  0%, 100% { opacity: 0.35; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(4px); }
}

.pipeline-note {
  max-width: 680px;
  margin: 1.5rem auto 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

@media (max-width: 820px) {
  .pipeline {
    flex-direction: column;
  }

  .pipe-arrow {
    transform: rotate(90deg);
  }

  .pipe-arrow:nth-child(6) { animation-delay: 0.6s; }
  .pipe-arrow:nth-child(10) { animation-delay: 1.2s; }

  @keyframes arrowPulse {
    0%, 100% { opacity: 0.35; transform: rotate(90deg) translateX(0); }
    50% { opacity: 1; transform: rotate(90deg) translateX(4px); }
  }

  .pipe-stage {
    min-width: 200px;
    width: 100%;
  }
}

.reveal {
    transform: none;
    opacity: 1;
    transition: none;
  }
}

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

  .download-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .site-header {
    align-items: flex-start;
  }

  .nav-toggle {
    display: block;
  }

  .site-nav {
    position: absolute;
    top: 68px;
    right: 1rem;
    left: 1rem;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--line);
  }

  .site-nav a:last-child {
    border-bottom: 0;
  }

  .hero {
    min-height: 620px;
  }

  .intro-band,
  .method-flow,
  .example-section,
  .resource-band {
    grid-template-columns: 1fr;
  }

  .resource-links {
    justify-content: flex-start;
  }
}

@media (max-width: 600px) {
  .flow-steps,
  .feature-grid,
  .download-grid {
    grid-template-columns: 1fr;
  }

  .store-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .store-row.header {
    display: none;
  }

  .site-footer {
    flex-direction: column;
    text-align: center;
  }
}
