/* Teewinot Studio / Cross Stitch Tracker — shared stylesheet.
   Plain CSS, system fonts, no webfonts, no third-party anything.

   IMPORTANT: this file is duplicated at cst/static/css/main.css so the two
   Hugo sites stay independently deployable. Edit both, or neither. */

/* ---- Design tokens: the Working Copy (WEBSITE-BRIEF.md §2, verbatim) ---- */

:root {
  --canvas: #F8F3E7;            /* LedgerPaper — page background */
  --canvas-secondary: #F1EAD9;  /* Well */
  --surface-raised: #FFFDF7;    /* SheetWhite — cards */
  --ink: #262119;               /* InkUmber — primary text */
  --ink-secondary: #544C3B;     /* PencilSoft */
  --hairline: #E3DAC5;          /* FeintRule — decorative rules, card borders */
  --rule: #8F8262;              /* Rule — structural lines that must read (≥3:1) */
  --accent: #34437F;            /* Indigo 930 */
  --accent-pressed: #2A3768;
  --on-accent: #FFFFFF;
  --accent-wash: rgba(52,67,127,.10);
  --stamp: #B65E36;             /* KakiStamp — date stamps ONLY, never decoration */
  --status-success: #3E7C4F;
  --status-caution: #8F6013;
  --status-destructive: #BE3B34;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #221B14; --canvas-secondary: #1A140F; --surface-raised: #2D251C;
    --ink: #F2EADB; --ink-secondary: #C2B9A2; --hairline: #3A342A; --rule: #857A5E;
    --accent: #9FB2F2; --accent-pressed: #8296D6; --on-accent: #1B2140;
    --accent-wash: rgba(159,178,242,.14);
    --stamp: #DE9A6C;
    --status-success: #7FBF8E; --status-caution: #E0A64B; --status-destructive: #E4756B;
  }
}

/* Non-token layout constants. */
:root {
  --content-max: 1080px;
  --prose-max: 640px;
  --gutter: clamp(1.5rem, 5vw, 3rem);
  --radius-card: 8px;         /* borders over shadows (§2) — no --shadow-card */
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

/* ---- Base ---- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Numerals get tabular figures wherever they appear (§2). */
time,
data,
.tabular,
th,
td {
  font-variant-numeric: tabular-nums;
}

/* Every number — counts, percentages, prices, DMC codes, dimensions — is
   monospace (§2). Wrap it: <span class="num">$14.99</span>. */
.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.94em;
  letter-spacing: -0.01em;
}

h1, h2, h3 {
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* Visible focus everywhere (§7.3). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- Layout ---- */

.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(3rem, 12vh, 6rem) var(--gutter) 3rem;
  display: flex;
  flex-direction: column;
  gap: clamp(2.75rem, 8vw, 4.5rem);
}

/* Reading column for text-heavy pages (privacy, support). */
.page--prose {
  max-width: calc(var(--prose-max) + var(--gutter) * 2);
  gap: clamp(2rem, 6vw, 3rem);
}

.prose {
  max-width: var(--prose-max);
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: var(--gutter);
  top: 1rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  text-decoration: none;
}

/* ---- Type scale ---- */

.eyebrow {
  margin: 0 0 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

/* On the inner pages the eyebrow is the way back to the homepage. */
.eyebrow a {
  color: inherit;
  text-decoration: none;
}

.eyebrow a:hover {
  text-decoration: underline;
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 680;
  max-width: 18ch;
}

.subline {
  margin: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  line-height: 1.5;
  color: var(--ink-secondary);
  max-width: 34rem;
}

.lede {
  font-size: 1.125rem;
  color: var(--ink-secondary);
}

/* ---- Cards ---- */

.card {
  padding: clamp(1.5rem, 4vw, 2.25rem);
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.375rem;
  font-weight: 640;
}

.card > :last-child {
  margin-bottom: 0;
}

/* ---- Buttons / chips (pill) ---- */

.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface-raised);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

/* Accent fill is reserved for the primary action only — one accent-filled
   control per viewport (§2). In the hero, the App Store badge is that control. */
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn--primary:active {
  background: var(--accent-pressed);
  border-color: var(--accent-pressed);
}

.chip {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 600;
}

/* ---- Studio page bits ---- */

.intro p {
  max-width: var(--prose-max);
  margin: 0 0 1.1rem;
}

.intro p:last-child {
  margin-bottom: 0;
}

.now-building {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.now-building p {
  margin: 0;
  max-width: var(--prose-max);
}

.now-building .app-name {
  font-weight: 660;
  color: var(--ink);
}

/* ---- Prose pages (privacy, support) ---- */

.prose h2 {
  margin: 2.25rem 0 0.6rem;
  font-size: 1.25rem;
  font-weight: 660;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose p,
.prose ul {
  margin: 0 0 1.1rem;
}

.prose ul {
  padding-left: 1.25rem;
}

.prose li {
  margin-bottom: 0.5rem;
}

.effective-date {
  color: var(--ink-secondary);
  font-size: 0.9375rem;
}

/* Press fact sheet: label / value rows. */
.facts {
  display: grid;
  grid-template-columns: minmax(7rem, max-content) 1fr;
  gap: 0.5rem 1.5rem;
  margin: 0 0 1.1rem;
}

.facts dt {
  color: var(--ink-secondary);
}

.facts dd {
  margin: 0;
}

/* ---- FAQ ---- */

/* Visible group headings so the questions can be scanned closed (§4.2). */
.faq h3 {
  margin: 2.25rem 0 0.25rem;
  font-size: 0.9375rem;
  font-weight: 640;
  letter-spacing: 0.01em;
  color: var(--ink-secondary);
}

.faq h3:first-child {
  margin-top: 0.5rem;
}

.prose h2 + .faq h3:first-child {
  margin-top: 0;
}

.faq details {
  border-bottom: 1px solid var(--hairline);
  padding: 1rem 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 620;
  list-style: none;
}

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

.faq summary::after {
  content: "+";
  float: right;
  color: var(--ink-secondary);
  font-weight: 400;
}

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

.faq details > :last-child {
  margin-bottom: 0;
}

/* ---- Feature trio / grids ---- */

.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 40rem) {
  .grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }

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

.grid h3 {
  margin: 0 0 0.4rem;
  font-size: 1.0625rem;
  font-weight: 660;
}

.grid p {
  margin: 0;
  color: var(--ink-secondary);
}

/* ---- Comparison table ---- */

.compare {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.compare th,
.compare td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

.compare thead th {
  font-size: 0.9375rem;
  color: var(--ink-secondary);
  font-weight: 620;
}

.table-scroll {
  overflow-x: auto;
}

/* ---- CST launch homepage (WEBSITE-BRIEF.md §4.1) ---- */

.page--home h2 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 660;
}

.hero--home .subline {
  margin-bottom: 1.75rem;
}

.cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
}

/* Apple's badge artwork, unaltered; sized up from its 120×40 viewBox. */
.app-store-badge {
  display: inline-block;
  border-radius: 9px;
  line-height: 0;
}

.app-store-badge img {
  height: 3.25rem;
  width: auto;
}

.price-line {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ink-secondary);
}

.hero__shot {
  margin-top: clamp(2rem, 6vw, 3.5rem);
}

/* Device frames are CSS only: a thin dark border with the device's corner
   radius, no bezel artwork (§10). Radii are % of width / % of height. */
.device {
  display: block;
  width: 100%;
  height: auto;
  border: clamp(3px, 0.6vw, 6px) solid #1A1A1A;
  background: #1A1A1A;
}

.device--ipad {
  border-radius: 2.4% / 3.3%;
}

.device--iphone {
  border-radius: 13% / 6%;
}

.device--flat {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: none;
}

/* Three jobs: each card leads with its screenshot. */
.job h2 {
  margin: 0 0 0.4rem;
  font-size: 1.1875rem;
}

.job p {
  margin: 0;
  color: var(--ink-secondary);
}

/* The well is a fixed height and the phone is sized to it, so the whole
   screenshot shows — nothing is cropped. */
.job__shot {
  margin: 0 0 1.25rem;
  padding: 1rem;
  background: var(--canvas-secondary);
  border-radius: calc(var(--radius-card) - 2px);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 24rem;
}

.job__shot:not(.job__shot--pair) picture {
  display: block;
  height: 100%;
}

.job__shot:not(.job__shot--pair) .device--iphone {
  height: 100%;
  width: auto;
}

/* W4: iPad and iPhone side by side, bottoms aligned. */
.job__shot--pair {
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem;
}

@media (max-width: 39.99rem) {
  .job__shot--pair {
    height: auto;
  }
}

/* Widths in the ratio of the two aspect ratios, so both stand the same height. */
.job__shot--pair picture:first-child {
  width: 73%;
}

.job__shot--pair picture:last-child {
  width: 24.5%;
}

/* Text beside one image; sections alternate text-left / image-right (§4). */
.split {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}

@media (min-width: 52rem) {
  .split {
    grid-template-columns: 5fr 7fr;
  }

  .split--flip {
    grid-template-columns: 7fr 5fr;
  }

  .split--flip .split__media {
    order: -1;
  }

  .split--phone {
    grid-template-columns: 7fr 5fr;
  }
}

.split__text p {
  margin: 0 0 1rem;
  max-width: 34rem;
}

.split__text > :last-child {
  margin-bottom: 0;
}

.split--phone .split__media picture {
  display: block;
  max-width: 17rem;
  margin: 0 auto;
}

.split__media--stack {
  display: grid;
  gap: 1rem;
}

.aside {
  color: var(--ink-secondary);
}

.small {
  font-size: 0.875rem;
  color: var(--ink-secondary);
}

/* The one blunt line on the page (§3 rule 6). */
.blunt {
  margin: 1rem 0 0;
  font-weight: 660;
}

.home-faq {
  max-width: var(--prose-max);
}

.home-faq details p {
  margin: 0.6rem 0 0;
  color: var(--ink-secondary);
}

.home-faq .more {
  margin: 1.25rem 0 0;
}

.close {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.close h2 {
  margin: 0;
}

/* ---- Footer ---- */

.site-footer {
  margin-top: 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.875rem;
  color: var(--ink-secondary);
}

.site-footer p {
  margin: 0 0 0.35rem;
}

.site-footer a {
  color: var(--ink-secondary);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.legal {
  margin-top: 1rem;
  font-size: 0.8125rem;
}

.legal + .legal {
  margin-top: 0.35rem;
}

/* ---- Motion ---- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
