/* Spinifex Apps — shared styles for every page. Colours live in the :root block. */

:root {
  --bg: #faf6ef;
  --bg-alt: #f1eadd;
  --card: #ffffff;
  --ink: #2a2118;
  --ink-soft: #6b5d4f;
  --line: #e2d8c6;
  --accent: #b4532a;        /* red earth */
  --accent-ink: #ffffff;
    --green: #6f7a45;         /* spinifex */
    --error: #8f2d24;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 8px 24px rgba(60, 40, 20, .08);
  --radius: 14px;
  --wrap: 1080px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1613;
    --bg-alt: #221d19;
    --card: #2a241f;
    --ink: #f1e8da;
    --ink-soft: #b3a594;
    --line: #3a322b;
    --accent: #e08a5c;
    --accent-ink: #1a1613;
    --green: #aab678;
    --error: #f0b0a8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
}

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

a { color: var(--accent); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

.lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 40em; }
.eyebrow {
  font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--green); margin-bottom: .8em;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand svg { width: 28px; height: 28px; color: var(--green); }
.nav { display: flex; gap: 22px; flex-wrap: wrap; }
.nav a { color: var(--ink-soft); text-decoration: none; font-size: .95rem; font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }

/* Buttons */
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: 1rem; text-decoration: none; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--card); }
.btn-ghost:hover { border-color: var(--ink-soft); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 1.4em; }
.note { font-size: .9rem; color: var(--ink-soft); margin-top: .9em; }

/* Sections */
section { padding: 72px 0; }
section.alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.hero { padding: 84px 0 64px; }
.center { text-align: center; }
.center .lead { margin-inline: auto; }
.center .btn-row { justify-content: center; }

/* Product hero */
.product-hero { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.product-hero img.icon { width: 128px; height: 128px; border-radius: 28px; }
.subtitle { font-family: var(--sans); font-size: 1.15rem; font-weight: 600; color: var(--ink-soft); margin: -.2em 0 1em; }
/* The subtitle inside the h1, so the heading says what the app is, looks the same as the line under it did. */
h1 .subtitle { display: block; margin: .55em 0 0; line-height: 1.4; letter-spacing: 0; }
h1:has(.subtitle) { margin-bottom: 1em; }
.soon { display: inline-block; vertical-align: middle; font-family: var(--sans); font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1; padding: .35em .6em; border: 1px solid var(--accent); border-radius: 999px; color: var(--accent); white-space: nowrap; }

/* Cards and grids */
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
}
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
.card h3 { margin-bottom: .4em; }
.card p { color: var(--ink-soft); }

.product-card { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; transition: transform .15s ease; }
.product-card:hover { transform: translateY(-3px); }
.product-card img { width: 84px; height: 84px; border-radius: 19px; margin-bottom: 10px; }
.more-link { margin: .8em 0 0; font-size: .95rem; }
.more-link a { font-weight: 600; }
.product-card .more { color: var(--accent); font-weight: 600; margin-top: auto; padding-top: 10px; }

/* Feature lists */
.features { list-style: none; padding: 0; margin: 0; }
.features li { position: relative; padding-left: 26px; margin-bottom: .55em; color: var(--ink-soft); }
.features li::before {
  content: ""; position: absolute; left: 4px; top: .55em; width: 9px; height: 9px;
  border-radius: 50%; background: var(--green);
}
.features li strong { color: var(--ink); font-weight: 600; }

/* Numbered steps */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; margin-bottom: 12px;
}

/* Screenshot placeholder: swap the div for an <img> when real screenshots exist */
.shot {
  aspect-ratio: 16 / 10; border-radius: var(--radius); border: 1px dashed var(--ink-soft);
  display: grid; place-items: center; color: var(--ink-soft); font-size: .95rem; text-align: center;
  padding: 20px; margin-top: 40px;
  background: repeating-linear-gradient(-45deg, transparent 0 14px, color-mix(in srgb, var(--line) 50%, transparent) 14px 15px);
}
img.shot-img { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); margin-top: 40px; }

/* Facts table */
.facts { width: 100%; border-collapse: collapse; }
.facts th, .facts td { text-align: left; padding: 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.facts th { width: 34%; font-weight: 600; padding-right: 16px; }
.facts td { color: var(--ink-soft); }

/* What's new page (kelpie-changelog.html, made by tools/build-changelog.py): the manual's text styles, one column. */
.changelog h2 .when { font-family: var(--sans); font-size: .95rem; font-weight: 400; color: var(--ink-soft); margin-left: .6em; }
.changelog h3 { font-size: .8rem; font-family: var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); margin-top: 1.4em; }

/* Comparison table (Kelpie page): feature, our app, the other app */
.compare { width: 100%; min-width: 640px; border-collapse: collapse; font-size: .95rem; line-height: 1.45; }
.compare th, .compare td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare thead th { font-family: var(--serif); font-size: 1.1rem; }
.compare tbody th { width: 30%; font-weight: 600; }
.compare td { width: 35%; color: var(--ink-soft); }
.compare td:nth-child(2) { color: var(--ink); }
.compare tr.group th { background: var(--bg-alt); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); padding: 8px 16px; }
.compare tbody tr:last-child th, .compare tbody tr:last-child td { border-bottom: 0; }
#compare { scroll-margin-top: 76px; }

/* Contact form */
#contact { scroll-margin-top: 76px; }
.contact-panel { max-width: 40rem; }
.contact-form { margin-top: 1.4rem; }
.field { display: flex; flex-direction: column; align-items: stretch; gap: .35rem; margin-block-end: 1.1rem; }
.field label { font-weight: 600; }
.contact-form input,
.contact-form textarea {
  font: inherit;
  font-size: max(1rem, 1em);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .75rem .9rem;
  min-height: 48px;
  width: 100%;
}
.contact-form textarea { min-height: 9rem; resize: vertical; line-height: 1.5; }
.contact-form input:focus-visible,
.contact-form textarea:focus-visible,
.contact-form button:focus-visible,
.form-status:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}
.contact-form :is(input, textarea):user-invalid {
  border-color: var(--error);
  box-shadow: inset 4px 0 0 var(--error);
}
.error-msg { display: none; margin: 0; color: var(--error); font-size: .92rem; }
.field:has(:user-invalid) .error-msg { display: block; }
button.btn { font: inherit; cursor: pointer; min-height: 48px; }
button.btn:disabled { opacity: .7; cursor: progress; }
.form-status { margin: 1rem 0 0; font-weight: 600; }
.form-status.is-error { color: var(--error); }
.hp {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 36px 0 48px; color: var(--ink-soft); font-size: .88rem; }
.site-footer .wrap { display: grid; gap: 10px; }
.site-footer a { color: var(--ink-soft); }

@media (max-width: 820px) {
  .grid.two, .grid.three, .steps { grid-template-columns: 1fr; }
  .product-hero { grid-template-columns: 1fr; }
  .product-hero img.icon { width: 96px; height: 96px; border-radius: 22px; }
  section { padding: 52px 0; }
  .hero { padding: 56px 0 44px; }
  .nav { gap: 14px; }
  .nav a { font-size: .9rem; }
  .facts th { width: 42%; }
}

figure { margin: 0; }
figcaption { margin-top: 10px; color: var(--ink-soft); font-size: 0.95rem; }

/* Cpanion page: the tour video sits like a screenshot; the home page's second row of apps gets a heading. */
video.shot-img { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); margin-top: 40px; background: #000; }
h2.also { margin-top: 56px; }
/* Running text, such as the About page: a comfortable line length and room between sections. */
.prose p { max-width: 40em; font-size: 1.05rem; }
.prose h2 + p { margin-top: 0; }
.prose p + h2 { margin-top: 1.6em; }

/* Manual page (cpanion-manual.html, made by tools/build-manual.py): contents at the side, text in a readable column. */
.manual-hero { padding-bottom: 28px; }
.manual-hero .eyebrow a { color: inherit; text-decoration: none; }
.manual-section { padding-top: 28px; }
.manual-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 48px; align-items: start; }
.manual-toc { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; font-size: .95rem; }
.manual-toc h2 { font-size: 1.05rem; margin-bottom: .7em; }
.manual-toc ol { margin: 0; padding-left: 1.5em; }
.manual-toc li { margin-bottom: .45em; color: var(--ink-soft); }
.manual-toc a { color: var(--ink-soft); text-decoration: none; }
.manual-toc a:hover { color: var(--accent); }
.manual h2, .manual h3 { scroll-margin-top: 80px; }
.manual h2 { margin-top: 2.2em; padding-top: 1.1em; border-top: 1px solid var(--line); }
.manual h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.manual h3 { margin-top: 1.8em; font-size: 1.3rem; }
.manual p, .manual ul, .manual ol { max-width: 44em; }
.manual ul, .manual ol { padding-left: 1.4em; margin: 0 0 1em; }
.manual li { margin-bottom: .5em; }
.manual code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 5px; padding: .05em .35em; overflow-wrap: anywhere; }
.manual figure { margin: 1.6em 0; }
.manual figure img { height: auto; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.manual figure.wide img { width: 100%; }
.table-scroll { overflow-x: auto; margin: 1.2em 0 1.6em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.manual table { width: 100%; border-collapse: collapse; font-size: .93rem; line-height: 1.45; }
.manual th, .manual td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); min-width: 8em; }
.manual tr:last-child td { border-bottom: 0; }
.manual thead th { font-weight: 600; background: var(--bg-alt); }
.manual td:first-child { color: var(--ink); font-weight: 500; }
.manual td { color: var(--ink-soft); }

@media (max-width: 820px) {
  .manual-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .manual-toc { position: static; max-height: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
}
