:root {
  --ink: #241e24;
  --muted: #675e64;
  --red: #bd2042;
  --paper: #fcfaf6;
  --rule: #dfd8d2;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
html { scroll-padding-top: 1.5rem; }
body, h1, h2, h3, p, figure, fieldset, pre { margin: 0; }
body { line-height: 1.55; }
img { display: block; max-width: 100%; height: auto; }
button, input { font: inherit; }
button, label { cursor: pointer; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 3px solid #0067aa; outline-offset: 4px; }
.wrap { width: min(1190px, calc(100% - 88px)); margin-inline: auto; }
.sr, label input { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: 1rem; transform: translateY(-210%); z-index: 1; padding: .6rem 1rem; background: white; }
.skip:focus { transform: none; }
.masthead { background: #fff9f1; border-bottom: 1px solid var(--rule); }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 85px; }
.brand img { width: 198px; }
nav { display: flex; align-items: center; gap: clamp(16px, 2.8vw, 38px); }
nav a { text-decoration: none; font-weight: 650; font-size: .9rem; }
nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

.hero { border-bottom: 1px solid var(--rule); background: #f7f1e9; }
.hero-grid { display: grid; grid-template-columns: .91fr 1.09fr; align-items: center; gap: clamp(30px, 5vw, 78px); padding-block: clamp(52px, 5.6vw, 88px); }
.platform { display: flex; gap: 13px; align-items: center; color: #635861; font-size: .89rem; font-weight: 650; }
.platform img { width: 48px; border-radius: 11px; }
h1 { font-size: clamp(3.6rem, 6.6vw, 6.35rem); letter-spacing: -.076em; line-height: .99; margin: 19px 0 21px; }
h1 em { display: block; font-family: Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: -.065em; color: var(--red); }
.hero-copy > p { max-width: 27em; color: #51474e; font-size: clamp(1.02rem, 1.4vw, 1.24rem); line-height: 1.5; }
.store-link { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; margin-top: 25px; color: #fff; background: #1d1c20; border-radius: 10px; text-decoration: none; }
.store-link:hover { background: #433339; }
.store-link svg { width: 26px; height: 31px; }
.store-link small, .store-link strong { display: block; line-height: 1.05; }
.store-link small { font-size: .7rem; }
.store-link strong { font-size: 1.42rem; letter-spacing: -.035em; }
.trace { min-width: 0; background: #fffdfa; border: 1px solid #cec5c1; border-radius: 16px; box-shadow: 0 7px 0 #e6ded7; padding: clamp(18px, 2.1vw, 32px); }
.plot-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.plot-heading .formula { color: var(--ink); font: italic 1.9rem/1.1 Georgia, serif; }
.plot-heading > span:last-child { color: var(--muted); font: .76rem/1.2 ui-monospace, monospace; }
.sine { display: block; width: 100%; height: auto; }
.marker { display: none; stroke: #bb163b; stroke-width: 1.3; }
.marker circle { fill: var(--red); stroke: white; stroke-width: 2.4; }
.point-controls, .switch, .sizes { border: 0; padding: 0; }
.point-controls { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.point-controls legend, .sizes legend { font-size: .77rem; font-weight: 650; margin: 0 0 7px; padding: 0; }
label { position: relative; }
label > span { display: block; border-radius: 6px; padding: 6px 11px; font-size: .82rem; font-weight: 650; line-height: 1.3; }
input:focus-visible + span { outline: 3px solid #0067aa; outline-offset: 3px; }
.point-controls label > span { border: 1px solid var(--rule); background: #fffdfa; }
.point-controls input:checked + span { color: white; border-color: var(--red); background: var(--red); }
.coords { display: grid; margin-top: 12px; color: var(--red); font: .91rem/1.3 ui-monospace, monospace; }
.coords > span { grid-area: 1/1; }
.coords > span, .matrix { display: none; }
.trace:has(#minimum:checked) :is(.mark-min, .min-val),
.trace:has(#zero:checked) :is(.mark-zero, .zero-val),
.trace:has(#maximum:checked) :is(.mark-max, .max-val) { display: block; }

.screens, .scripting { padding-block: clamp(52px, 6vw, 92px); }
.section-heading { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 32px; }
h2 { font-size: clamp(2.3rem, 3.7vw, 3.65rem); line-height: 1.06; letter-spacing: -.063em; }
.section-heading p { color: var(--muted); max-width: 38em; font-size: 1rem; }
.switch { display: inline-flex; padding: 4px; gap: 4px; background: #eee9e3; border-radius: 9px; margin-block: 27px 21px; }
.switch label span { min-width: 67px; text-align: center; padding: 8px 12px; }
.switch input:checked + span { background: #fff; box-shadow: 0 1px 5px #36292f22; }
.shot-grid { display: none; gap: 25px 20px; }
.gallery:has(#ipad:checked) .ipad-shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery:has(#iphone:checked) .iphone-shots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.thumbnail { display: block; width: 100%; padding: 0; border-radius: 7px; overflow: hidden; border: 1px solid #cdc5c1; background: #eee; cursor: zoom-in; }
.thumbnail img { width: 100%; }
.thumbnail:hover { outline: 2px solid var(--red); outline-offset: 2px; }
figcaption { font-size: .98rem; font-weight: 650; letter-spacing: -.022em; margin-top: 8px; }
.scripting { background: #27232a; color: #fcf7f1; }
.scripting .section-heading p { color: #ded5dc; }
.script-example { display: grid; grid-template-columns: 1fr 1fr; margin-top: 32px; border: 1px solid #595259; border-radius: 14px; overflow: hidden; }
.script-source { padding: clamp(24px, 3.5vw, 50px); }
.script-source h3 { margin-bottom: 18px; color: #fff5e7; font: 1.17rem/1.3 ui-monospace, monospace; }
pre { max-width: 100%; overflow: auto; font: clamp(.8rem, 1.2vw, 1rem)/1.72 ui-monospace, "SFMono-Regular", monospace; }
code b { font-weight: 500; color: #e8aecc; }
.pattern-demo { display: grid; justify-items: center; align-content: center; padding: 28px 15px; background: #eee8e2; color: var(--ink); }
.pattern-images { width: min(62%, 235px); aspect-ratio: 1; background: #101316; padding: 8px; }
.matrix { width: 100%; height: 100%; }
.pattern-demo:has(#size12:checked) .size-12,
.pattern-demo:has(#size20:checked) .size-20,
.pattern-demo:has(#size29:checked) .size-29 { display: block; }
.sizes { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 15px; }
.sizes legend { text-align: center; width: 100%; }
.sizes label > span { border: 1px solid #b5aeb0; }
.sizes input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
footer { border-top: 1px solid var(--rule); font-size: .85rem; }
dialog { padding: 12px; border: 1px solid #d8ceca; border-radius: 12px; max-width: min(calc(100vw - 24px), 1060px); max-height: calc(100dvh - 24px); background: #fffaf5; color: var(--ink); }
dialog::backdrop { background: #201922c9; }
dialog header { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding-bottom: 10px; }
dialog h2 { font-size: 1.04rem; letter-spacing: -.02em; }
dialog img { max-height: calc(100dvh - 112px); width: auto; object-fit: contain; margin-inline: auto; }
dialog button { background: #29232b; border: 0; border-radius: 6px; color: white; padding: 6px 12px; font-size: .83rem; }

@media (max-width: 850px) {
  .wrap { width: calc(100% - 48px); }
  .hero-grid { gap: 26px; }
  h1 { font-size: clamp(3.3rem, 6.8vw, 4rem); }
  .gallery:has(#iphone:checked) .iphone-shots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 675px) {
  .wrap { width: calc(100% - 36px); }
  .masthead .bar { min-height: 68px; gap: 10px; }
  .brand img { width: clamp(105px, 26vw, 162px); }
  nav { gap: 12px; }
  nav a { font-size: .77rem; }
  .hero-grid, .section-heading, .script-example { grid-template-columns: 1fr; }
  .hero-grid { padding-block: 36px; gap: 30px; }
  h1 { font-size: clamp(3.7rem, 13vw, 5rem); }
  .platform img { width: 40px; }
  .hero-copy > p { max-width: 28em; }
  .plot-heading { margin-bottom: 13px; }
  .plot-heading .formula { font-size: 1.55rem; }
  .section-heading { gap: 12px; }
  .gallery:has(#ipad:checked) .ipad-shots, .gallery:has(#iphone:checked) .iphone-shots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shot-grid { gap: 19px 12px; }
  .bar { flex-wrap: wrap; }
  footer .bar { padding-block: 18px; gap: 12px; }
}
@media (max-width: 480px) {
  .gallery:has(#ipad:checked) .ipad-shots { grid-template-columns: 1fr; }
}
