/* KnitPad pages (alagumna.com/knitpad/). Own look, taken from the app icon: white fabric, deep teal, a red heart.
   No third-party fonts: the rounded system face on Apple devices, the system sans elsewhere. */

:root {
  --ground: #EDF1EF;
  --paper: #FFFFFF;
  --ink: #14323A;
  --muted: #536D75;
  --line: #C9D5D2;
  --heart: #D62A32;
  --heart-deep: #B01F27;
  --teal: #1A363B;

  --display: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 5vw, 48px);
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
}

img, svg { max-width: 100%; }

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--heart-deep); }

:focus-visible { outline: 3px solid var(--heart); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--paper); padding: 8px 12px; z-index: 10; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); font-weight: 800; }
h2 { font-size: clamp(1.625rem, 3vw, 2.25rem); }
h3 { font-size: 1.1875rem; line-height: 1.3; }
p { margin: 0; text-wrap: pretty; }

/* Header and footer */

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 20px; padding-bottom: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.site-nav { display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); font-size: 0.9375rem; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 8px 0; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }

.site-footer { border-top: 1px solid var(--line); margin-top: clamp(56px, 8vw, 96px); padding: 28px 0 40px; color: var(--muted); font-size: 0.9375rem; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-links a { color: var(--muted); }

/* Buttons */

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1.5px solid transparent; font-family: var(--display); font-weight: 700; font-size: 1.0625rem; text-decoration: none; cursor: pointer; }
.button-primary { background: var(--heart); color: #FFFFFF; }
.button-primary:hover { background: var(--heart-deep); color: #FFFFFF; }
.button-quiet { border-color: var(--ink); color: var(--ink); background: transparent; }
.button-quiet:hover { background: var(--ink); color: #FFFFFF; }
.site-nav .button { min-height: 38px; padding: 0 16px; font-size: 0.9375rem; color: #FFFFFF; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Landing: hero with the chart you can paint */

.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; padding-top: clamp(20px, 4vw, 56px); padding-bottom: clamp(48px, 7vw, 88px); }
.hero-copy { display: flex; flex-direction: column; gap: 22px; }
.lede { font-size: clamp(1.125rem, 1.5vw, 1.25rem); color: var(--muted); max-width: 30em; }
.note { font-size: 0.9375rem; color: var(--muted); }

.demo { background: var(--paper); border-radius: 22px; padding: clamp(12px, 2vw, 20px); box-shadow: 0 1px 0 var(--line), 0 24px 48px -28px rgba(20, 50, 58, 0.45); }
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.segmented { display: inline-flex; background: var(--ground); border-radius: 999px; padding: 3px; }
.segmented button { border: 0; background: transparent; color: var(--muted); font: 600 0.9375rem var(--sans); padding: 7px 16px; border-radius: 999px; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 50, 58, 0.25); }
.swatches { display: inline-flex; gap: 8px; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--paper); box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; padding: 0; }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--ink); }

.grid { display: grid; gap: 1px; background: #B9C4C1; border: 1.5px solid var(--ink); touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.grid .cell { aspect-ratio: 5 / 4; background: #FFFFFF; }
.grid .cell[data-c="1"] { background: #E5343A; }
.grid .cell[data-c="2"] { background: #1F5560; }
.grid.knit { cursor: default; }
.grid.knit .cell { opacity: 0.4; }
.grid.knit .cell.current { opacity: 1; box-shadow: 0 -2px 0 #F08A1C, 0 2px 0 #F08A1C; position: relative; z-index: 1; }

.demo-foot { margin-top: 14px; min-height: 112px; display: flex; flex-direction: column; gap: 10px; }
.demo-foot p { font-size: 0.9375rem; color: var(--muted); }
.demo-foot .row-title { font-family: var(--display); font-weight: 700; color: var(--ink); font-size: 1rem; }
.demo-foot .row-text { font-family: var(--mono); font-size: 0.875rem; color: var(--ink); }
.demo-foot > div { display: flex; flex-direction: column; gap: 6px; }
.demo-foot .actions { margin-top: 10px; }
.demo-foot .button { min-height: 40px; font-size: 0.9375rem; padding: 0 18px; }
[hidden] { display: none !important; }

/* Landing: sections */

.band { padding: clamp(48px, 7vw, 88px) 0; border-top: 1px solid var(--line); }
.band-head { max-width: 40em; display: flex; flex-direction: column; gap: 12px; margin-bottom: clamp(28px, 4vw, 44px); }
.band-head p { color: var(--muted); }

.phones { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(16px, 3vw, 36px); }
.phones figure { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.phones img { display: block; width: 100%; height: auto; border-radius: clamp(18px, 2.4vw, 30px); border: 5px solid var(--ink); background: var(--paper); }
.phones figcaption { font-size: 0.9375rem; color: var(--muted); }
.phones figcaption strong { display: block; font-family: var(--display); font-size: 1.0625rem; color: var(--ink); }

.points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(24px, 4vw, 56px); margin: 0; }
.points dt { font-family: var(--display); font-weight: 700; font-size: 1.1875rem; margin-bottom: 6px; }
.points dd { margin: 0; color: var(--muted); }

.price { background: var(--teal); color: #F3F6F4; border-top: 0; }
.price .wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) auto; gap: 28px 56px; align-items: center; }
.price p { color: #C4D3D0; max-width: 36em; margin-top: 12px; }

.faq { max-width: 44em; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 16px 0; font-family: var(--display); font-weight: 700; font-size: 1.0625rem; }
.faq details p { padding: 0 0 18px; color: var(--muted); }

/* Free charts */

.motifs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: clamp(14px, 2vw, 22px); }
.motifs a { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 0.9375rem; line-height: 1.3; }
.motifs .tile { display: block; background: var(--paper); border-radius: 16px; padding: 8px; box-shadow: 0 1px 0 var(--line); transition: transform 0.15s ease; }
.motifs a:hover .tile { transform: translateY(-3px); }
.motifs svg { display: block; width: 100%; height: auto; }
.motifs small { display: block; font-weight: 400; font-size: 0.8125rem; color: var(--muted); }
.strip { grid-template-columns: repeat(8, minmax(0, 1fr)); }
@media (prefers-reduced-motion: reduce) { .motifs .tile { transition: none; } }

.charts-head { padding: clamp(20px, 4vw, 48px) 0 clamp(28px, 4vw, 44px); max-width: 42em; display: flex; flex-direction: column; gap: 14px; }
.charts-head p { color: var(--muted); font-size: 1.125rem; }
.group { padding: clamp(24px, 3vw, 36px) 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px 32px; }
.group h2 { font-size: 1.375rem; }
.group h2 small { display: block; font: 400 0.875rem var(--sans); color: var(--muted); letter-spacing: 0; margin-top: 4px; }

.motif { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; padding-top: clamp(16px, 3vw, 40px); }
.motif-chart { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 14px; }
.chart { background: var(--paper); border-radius: 22px; padding: clamp(14px, 3vw, 30px); box-shadow: 0 1px 0 var(--line), 0 24px 48px -28px rgba(20, 50, 58, 0.45); }
.chart svg { display: block; width: 100%; height: auto; max-height: 70vh; }
.motif-text { display: flex; flex-direction: column; gap: 14px; }
.motif-text h2 { font-size: 1.25rem; margin-top: 18px; }
.motif-text ul { margin: 0; padding-left: 1.2em; }
.motif-text .summary { font-size: 1.1875rem; color: var(--muted); }
.rows { list-style: none; padding: 16px 18px !important; background: var(--paper); border-radius: 14px; font-family: var(--mono); font-size: 0.875rem; line-height: 1.7; overflow-wrap: anywhere; }

.cta { background: var(--teal); color: #F3F6F4; border-radius: 22px; padding: clamp(22px, 3vw, 36px); margin-top: clamp(40px, 6vw, 72px); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 40px; align-items: center; }
.cta p { color: #C4D3D0; max-width: 40em; }
.cta h2 { font-size: 1.375rem; margin-bottom: 8px; }
.more { padding-top: clamp(40px, 6vw, 72px); display: flex; flex-direction: column; gap: 22px; }

/* Help and privacy */

.doc { max-width: 68ch; padding-top: clamp(20px, 4vw, 48px); }
.doc h1 { margin-bottom: 14px; }
.doc .updated { color: var(--muted); font-size: 0.9375rem; margin-bottom: 32px; }
.doc .summary { font-size: 1.1875rem; color: var(--muted); padding-bottom: 24px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.doc h2 { font-size: 1.375rem; margin: 40px 0 12px; }
.doc p, .doc ul { margin: 0 0 14px; }
.doc ul { padding-left: 1.25em; }
.doc li { margin-bottom: 8px; }

/* Narrow screens */

@media (max-width: 860px) {
  .hero, .motif, .price .wrap, .cta { grid-template-columns: minmax(0, 1fr); }
  .motif-chart { position: static; }
  .phones { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .points { grid-template-columns: minmax(0, 1fr); }
  .strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .group { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .site-nav .button { display: none; }
  .motifs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
