/* SPDX-License-Identifier: GPL-3.0-only */
/* POLY5: the landing page. The device's look: a black screen, the five synths' colours (CH_RGB in poly5.c), the
   amber of "plays next", cream text; line art and glass. Pictures are the firmware's own screens (site/make_images.py). */

:root {
  --ground: #06070B;
  --panel: #10131D;
  --line: #222838;
  --cream: #EDE8E0;
  --text: #C9C5BE;
  --dim: #7C8296;
  --amber: #F0A030;
  --s1: #6AA8F0;
  --s2: #F08A70;
  --s3: #7DD498;
  --s4: #F0C870;
  --s5: #D890A8;
  --gutter: 18px;
  --max: 1120px;
  color-scheme: dark;
}
@media (min-width: 900px) { :root { --gutter: 40px; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}
@media (min-width: 900px) { body { font-size: 18px; } }

.wrap { max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
a { color: var(--cream); text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--amber); }
a:hover { color: var(--amber); }
a:focus-visible, .btn:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; }
b, strong { color: var(--cream); font-weight: 600; }
p { margin: 0 0 1em; max-width: 44em; }
code, .mono { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: 0.86em; }
code { color: var(--cream); background: var(--panel); padding: 0.1em 0.4em; border-radius: 4px; }
pre { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; overflow-x: auto; margin: 0 0 1.2em; }
pre code { background: none; padding: 0; font-size: 0.82em; line-height: 1.7; }
h2, h3 { color: var(--cream); line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: clamp(34px, 5vw, 56px); font-weight: 700; margin: 0 0 0.5em; }
h3 { font-size: clamp(21px, 2.2vw, 26px); font-weight: 600; margin: 1.8em 0 0.5em; }
.eyebrow { font-family: "JetBrains Mono", monospace; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); margin: 0 0 14px; }

/* the five stripes: one a synth */
.stripes { display: flex; gap: 8px; margin: 0 0 26px; }
.stripes i { display: block; width: 44px; height: 6px; border-radius: 3px; }
.stripes i:nth-child(1) { background: var(--s1); } .stripes i:nth-child(2) { background: var(--s2); }
.stripes i:nth-child(3) { background: var(--s3); } .stripes i:nth-child(4) { background: var(--s4); }
.stripes i:nth-child(5) { background: var(--s5); }

/* nav */
.nav { position: sticky; top: 0; z-index: 10; background: rgba(6, 7, 11, 0.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 22px; height: 58px; }
.nav .logo { font-weight: 700; font-size: 22px; letter-spacing: 0.02em; text-decoration: none; flex: none; }
.nav ul { display: flex; gap: 18px; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; font-size: 15px; }
.nav ul::-webkit-scrollbar { display: none; }
.nav li a { color: var(--dim); text-decoration: none; white-space: nowrap; }
.nav li a:hover { color: var(--cream); }
.word span:nth-child(1) { color: var(--s1); } .word span:nth-child(2) { color: var(--s2); }
.word span:nth-child(3) { color: var(--s3); } .word span:nth-child(4) { color: var(--s4); }
.word span:nth-child(5) { color: var(--s5); }

/* hero */
.hero { padding: 72px 0 40px; position: relative; overflow: hidden; }
.hero-grid {  /* POLY5's PLAY background, drawn live (index.html) */
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; display: block;
  mask-image: radial-gradient(ellipse 85% 75% at 50% 50%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 50%, #000 40%, transparent 100%);
}
.hero .wrap { position: relative; display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .hero .wrap { grid-template-columns: 1.15fr 0.85fr; } }
.hero h1 { font-size: clamp(76px, 15vw, 168px); line-height: 0.9; font-weight: 700; letter-spacing: -0.04em; margin: 0 0 18px; }
.lede { font-size: clamp(22px, 2.8vw, 32px); line-height: 1.25; color: var(--cream); font-weight: 500; letter-spacing: -0.02em; max-width: 20em; margin: 0 0 18px; }
.hero p.sub { color: var(--text); max-width: 32em; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.btn { display: inline-block; padding: 12px 20px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 16px; border: 2px solid var(--line); color: var(--cream); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #1A1206; }
.btn.primary:hover { background: var(--cream); border-color: var(--cream); color: #1A1206; }
.btn:hover { border-color: var(--cream); }
/* one main button (Install); the rest are plain links beside it */
.btn.quiet { border-color: transparent; padding: 12px 6px; font-weight: 500; color: var(--cream); opacity: .78; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 5px; }
.btn.quiet:hover { border-color: transparent; opacity: 1; text-decoration-color: var(--cream); }
.btns { align-items: center; }
.btns .btn.primary { margin-right: 10px; }
button.btn { background: none; cursor: pointer; font-family: inherit; }

/* the five lights: round robin, then random (site.js) */
.lights { display: flex; gap: 12px; margin: 26px 0 6px; align-items: center; }
.lights b { width: 18px; height: 18px; border-radius: 50%; background: var(--line); transition: background 0.12s, box-shadow 0.12s; }
.lights b.on:nth-child(1) { background: var(--s1); box-shadow: 0 0 18px var(--s1); }
.lights b.on:nth-child(2) { background: var(--s2); box-shadow: 0 0 18px var(--s2); }
.lights b.on:nth-child(3) { background: var(--s3); box-shadow: 0 0 18px var(--s3); }
.lights b.on:nth-child(4) { background: var(--s4); box-shadow: 0 0 18px var(--s4); }
.lights b.on:nth-child(5) { background: var(--s5); box-shadow: 0 0 18px var(--s5); }
.lights .label { font-family: "JetBrains Mono", monospace; font-size: 13px; letter-spacing: 0.12em; color: var(--dim); margin-left: 8px; }

/* the device's screen */
.screen { margin: 0; }
.screen img, .screen .screen-video, .screen .ui-loop { display: block; width: 100%; max-width: 480px; height: auto; image-rendering: pixelated; background: #000; border-radius: 14px; outline: 10px solid #151925; outline-offset: 0; box-shadow: 0 0 0 11px #262c3c, 0 30px 80px rgba(0, 0, 0, 0.6); margin: 11px; }
.screen figcaption { font-size: 15px; color: var(--dim); margin: 26px 11px 0; max-width: 30em; }
.screen .screen-video, .screen .ui-loop { aspect-ratio: 1; object-fit: contain; }
.screen.small img, .screen.small .ui-loop { max-width: 320px; border-radius: 10px; outline-width: 7px; box-shadow: 0 0 0 8px #262c3c, 0 20px 50px rgba(0, 0, 0, 0.5); margin: 8px; }

/* sections */
section { padding: 88px 0; border-top: 1px solid var(--line); }
.split { display: grid; gap: 44px; align-items: start; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; } .split.wide-left { grid-template-columns: 1.2fr 0.8fr; } }

/* random: three cards */
.cards { display: grid; gap: 18px; margin: 34px 0; }
@media (min-width: 760px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; }
.card:nth-child(1)::before { background: var(--s1); } .card:nth-child(2)::before { background: var(--s3); } .card:nth-child(3)::before { background: var(--s5); }
.card .n { font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--dim); letter-spacing: 0.1em; }
.card h3 { margin: 8px 0 10px; }
.card p { font-size: 16px; margin: 0; }
.card img, .card .ui-loop { width: 100%; height: auto; image-rendering: pixelated; border-radius: 8px; margin-top: 18px; display: block; }

/* video */
.video { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.video video { display: block; width: 100%; height: auto; }
.chapters { display: grid; gap: 22px; margin-top: 30px; }
@media (min-width: 700px) { .chapters { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .chapters { grid-template-columns: repeat(3, 1fr); } }
.chapters figure { margin: 0; }
.chapters figcaption { font-size: 15px; margin-top: 10px; color: var(--text); }
.chapters figcaption b { font-family: "JetBrains Mono", monospace; color: var(--amber); margin-right: 8px; font-weight: 500; }

/* key caps: the FM-1's buttons and knobs, by name */
.k { display: inline-block; font-family: "JetBrains Mono", monospace; font-size: 0.74em; font-weight: 600; line-height: 1; padding: 0.42em 0.6em 0.38em; border-radius: 6px; background: #2C3142; color: var(--cream); border: 1px solid #3C4256; border-bottom-width: 3px; white-space: nowrap; vertical-align: 0.1em; }
.k.r { border-radius: 999px; background: #1F2331; }    /* a rotary */
.k.c1 { background: var(--s1); color: #0B1220; border-color: #4B7CB8; } .k.c2 { background: var(--s2); color: #22100C; border-color: #B86450; }
.k.c3 { background: var(--s3); color: #0C2216; border-color: #5AA070; } .k.c4 { background: var(--s4); color: #221A08; border-color: #B8964E; }
.k.c5 { background: var(--s5); color: #220E16; border-color: #A86A80; }

/* tables */
.table { overflow-x: auto; margin: 18px 0 8px; border: 1px solid var(--line); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 16px; }
th, td { text-align: left; vertical-align: top; padding: 13px 16px; border-bottom: 1px solid var(--line); }
th { font-family: "JetBrains Mono", monospace; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); font-weight: 500; background: var(--panel); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td:first-child { white-space: nowrap; }
.table table { min-width: 640px; }
@media (max-width: 699px) { td:first-child { white-space: normal; min-width: 7.5em; } td:first-child .k { margin: 0 2px 4px 0; } }
td .dim { color: var(--dim); }
.modes { display: grid; gap: 14px; margin: 24px 0; }
@media (min-width: 700px) { .modes { grid-template-columns: repeat(2, 1fr); } }
.mode { border-left: 3px solid var(--amber); padding: 4px 0 4px 16px; }
.mode b { display: block; font-family: "JetBrains Mono", monospace; font-size: 14px; letter-spacing: 0.1em; color: var(--amber); font-weight: 600; margin-bottom: 4px; }
.mode span { font-size: 16px; }

.panel-pic { width: 100%; height: auto; display: block; border-radius: 16px; margin: 30px 0 10px; }
.note { color: var(--dim); font-size: 15px; }
.tag { display: inline-block; font-family: "JetBrains Mono", monospace; font-size: 11px; letter-spacing: 0.08em; padding: 3px 7px; border-radius: 5px; border: 1px solid var(--line); color: var(--dim); white-space: nowrap; }
.tag.rr { color: var(--s1); border-color: #2C4466; } .tag.rnd { color: var(--s2); border-color: #66382E; }
.tag.uni { color: var(--s3); border-color: #2E5A3C; } .tag.poly { color: var(--s4); border-color: #665430; }
.pages { columns: 2; column-gap: 28px; padding-left: 1.1em; margin: 0 0 1em; font-size: 16px; }
@media (min-width: 700px) { .pages { columns: 3; } }

footer { border-top: 1px solid var(--line); padding: 48px 0 70px; color: var(--dim); font-size: 15px; }
footer p { max-width: 52em; }

/* the manual's player: the chapter on the left, the list on the right (under it on a phone) */
.player { display: grid; gap: 18px; margin-top: 30px; align-items: start; }
@media (min-width: 900px) { .player { grid-template-columns: minmax(0, 1fr) 340px; } }
.pl-now { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin: 14px 0 0; max-width: none; }
.pl-now b { font-family: "JetBrains Mono", monospace; color: var(--amber); font-weight: 500; }
.pl-now #pl-title { color: var(--cream); font-weight: 600; font-size: 20px; }
.pl-next { color: var(--dim); font-size: 15px; margin-left: auto; }
.pl-list { list-style: none; margin: 0; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  max-height: 420px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3A4156 transparent; }
@media (min-width: 900px) { .pl-list { max-height: calc((min(100vw, 1200px) - 2 * var(--gutter) - 358px) * 9 / 16); min-height: 320px; } }
.pl-item { display: grid; grid-template-columns: 128px 1fr; gap: 12px; align-items: center; width: 100%; padding: 8px; border: 0; border-radius: 10px;
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pl-item:hover { background: #181C29; }
.pl-item:focus-visible { outline: 2px solid var(--cream); outline-offset: -2px; }
.pl-item.on { background: #1E2333; box-shadow: inset 3px 0 0 var(--amber); }
.pl-item img { width: 128px; height: 72px; object-fit: cover; border-radius: 6px; display: block; background: #000; }
.pl-text { display: grid; gap: 2px; font-size: 15px; line-height: 1.3; }
.pl-text b { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--dim); font-weight: 500; }
.pl-item.on .pl-text b { color: var(--amber); }
.pl-title { color: var(--cream); font-weight: 500; }
.pl-dur { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--dim); }

.ui-loop { background: #000; }
.card .ui-loop { aspect-ratio: 1; }

/* ---- motion (only with html.anim: JavaScript on, no request for less motion) ---- */
@keyframes p5-pop { 0% { opacity: 0; transform: translateY(0.45em) scale(0.55) rotate(-10deg); } 60% { opacity: 1; transform: translateY(-0.06em) scale(1.08) rotate(3deg); } 100% { opacity: 1; transform: none; } }
@keyframes p5-rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes p5-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes p5-screen { from { opacity: 0; transform: translateY(26px) scale(0.94); filter: brightness(2.2) blur(3px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes p5-fade { from { opacity: 0; } to { opacity: 1; } }
html.anim .hero .stripes i { transform-origin: left; animation: p5-draw 0.5s cubic-bezier(.2,.8,.2,1) both; }
html.anim .hero .stripes i:nth-child(1) { animation-delay: 0.05s; } html.anim .hero .stripes i:nth-child(2) { animation-delay: 0.13s; }
html.anim .hero .stripes i:nth-child(3) { animation-delay: 0.21s; } html.anim .hero .stripes i:nth-child(4) { animation-delay: 0.29s; }
html.anim .hero .stripes i:nth-child(5) { animation-delay: 0.37s; }
html.anim .hero h1 span { display: inline-block; animation: p5-pop 0.7s cubic-bezier(.2,.8,.25,1) both; }
html.anim .hero h1 span:nth-child(1) { animation-delay: 0.25s; } html.anim .hero h1 span:nth-child(2) { animation-delay: 0.38s; }
html.anim .hero h1 span:nth-child(3) { animation-delay: 0.51s; } html.anim .hero h1 span:nth-child(4) { animation-delay: 0.64s; }
html.anim .hero h1 span:nth-child(5) { animation-delay: 0.77s; }
html.anim .hero .lede { animation: p5-rise 0.7s ease 0.95s both; }
html.anim .hero p.sub { animation: p5-rise 0.7s ease 1.08s both; }
html.anim .hero .lights { animation: p5-rise 0.7s ease 1.18s both; }
html.anim .hero .btns { animation: p5-rise 0.7s ease 1.28s both; }
html.anim .hero figure.screen { animation: p5-screen 1s cubic-bezier(.2,.8,.2,1) 0.5s both; }
html.anim .hero figure.screen figcaption { animation: p5-fade 0.8s ease 1.4s both; }
html.anim .hero-grid { animation: p5-fade 1.6s ease both; }
html.anim .nav { animation: p5-fade 0.6s ease both; }
html.anim .rv { opacity: 0; transform: translateY(28px); transition: opacity 0.75s ease, transform 0.75s cubic-bezier(.2,.75,.2,1); transition-delay: var(--d, 0s); }
html.anim .rv.in { opacity: 1; transform: none; }
html.anim .panel-pic.rv { transform: translateY(36px) scale(0.97); }
html.anim .panel-pic.rv.in { transform: none; }
@media (prefers-reduced-motion: reduce) { html.anim * { animation: none !important; transition: none !important; } html.anim .rv { opacity: 1; transform: none; } }

/* cards: the picture at the bottom, so a row of cards lines its pictures up whatever the text above */
.card { display: flex; flex-direction: column; }
.card > p { margin-bottom: 20px; }
.card > img, .card > .ui-loop { margin-top: auto; }

.safe { list-style: none; padding: 0; margin: 0 0 1.2em; display: grid; gap: 12px; max-width: 46em; }
.safe li { border-left: 3px solid var(--s3); padding: 2px 0 2px 16px; font-size: 16px; }
.safe b { display: block; }

/* ---- the playable FM-1 (site/play/poly5-player.js) ---- */
.play { background: radial-gradient(ellipse 70% 60% at 50% 55%, #131a30 0%, var(--ground) 70%); }
.p5 { margin: 30px auto 0; max-width: 1100px; }
.p5-device { position: relative; width: 100%; aspect-ratio: 1760 / 1072; border-radius: 3.6% / 6%; box-shadow: 0 40px 100px rgba(0,0,0,.6), 0 0 0 1px #2a2d38; }
.p5-svg { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.p5-screen { position: absolute; left: 27.33%; top: 9.42%; width: 21.14%; height: 34.70%; image-rendering: pixelated; background: #000; pointer-events: none; }
.p5-knob, .p5-btn, .p5-key { cursor: pointer; }
.p5-knob:focus, .p5-btn:focus { outline: none; }
.p5-knob:focus-visible circle:nth-child(2), .p5-btn:focus-visible rect { stroke: var(--cream); stroke-width: 4; }
.p5-knob.on circle:nth-child(2) { stroke: var(--amber); stroke-dasharray: none; }
.p5-on { position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 22px 36px; border-radius: 22px; border: 2px solid var(--amber); background: rgba(10,12,20,.88); color: var(--cream); font: inherit; cursor: pointer;
  box-shadow: 0 0 60px rgba(240,160,48,.25); }
.p5-on b { font-size: clamp(20px, 2.6vw, 30px); font-weight: 700; }
.p5-on small { color: var(--dim); font-size: 14px; max-width: 26em; text-align: center; }
.p5-on-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 18px var(--amber); }
.p5-on:hover { background: rgba(20,22,32,.95); }
.p5-on.busy b::after { content: "\2026"; }
.p5-device.running .p5-on { display: none; }
.p5-help { display: grid; gap: 10px; margin-top: 22px; font-size: 15px; color: var(--text); max-width: 1100px; margin-left: auto; margin-right: auto; }
@media (min-width: 900px) { .p5-help { grid-template-columns: repeat(2, 1fr); } }
.p5-help b { color: var(--amber); font-weight: 600; margin-right: 6px; }

/* the video manual: its own band, so it reads as a place to go, not one more picture */
section.manual { background: linear-gradient(180deg, #17120a 0%, #0d0f1a 38%, #0a0c16 100%); border-top: 2px solid var(--amber); border-bottom: 2px solid var(--amber);
  position: relative; overflow: hidden; }
section.manual::before { content: ""; position: absolute; left: 50%; top: -260px; width: 900px; height: 520px; transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(240,160,48,.22), transparent 65%); pointer-events: none; }
section.manual .wrap { position: relative; }
.manual-head { display: flex; flex-wrap: wrap; align-items: center; gap: 22px 28px; margin-bottom: 10px; }
.manual-head h2 { margin: 0; font-size: clamp(38px, 5.6vw, 64px); }
.manual-head .eyebrow { margin-bottom: 8px; }
.manual-play { width: 74px; height: 74px; flex: none; border-radius: 50%; background: var(--amber); position: relative; box-shadow: 0 0 0 10px rgba(240,160,48,.15), 0 0 50px rgba(240,160,48,.45); }
.manual-play::after { content: ""; position: absolute; left: 29px; top: 22px; border-left: 24px solid #1a1206; border-top: 15px solid transparent; border-bottom: 15px solid transparent; }
.manual-start { font-size: 17px; padding: 14px 24px; }
section.manual .player .video { box-shadow: 0 0 0 2px var(--amber), 0 30px 90px rgba(0,0,0,.6), 0 0 80px rgba(240,160,48,.18); }
section.manual .pl-list { border-color: #3a3020; }
@media (max-width: 600px) { .p5-on { padding: 10px 18px; border-radius: 14px; } .p5-on b { font-size: 18px; } .p5-on small { display: none; } .manual-start { margin-left: 0; } .manual-play { width: 54px; height: 54px; } .manual-play::after { left: 21px; top: 16px; border-left-width: 18px; border-top-width: 11px; border-bottom-width: 11px; } }

/* the install steps; building from source, folded away */
ol.steps { margin: 26px 0 18px; padding-left: 1.3em; display: grid; gap: 14px; }
ol.steps li::marker { color: var(--amber); font-weight: 700; }
ol.steps pre { margin: 10px 0 0; }
details.build { margin: 22px 0; border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; }
details.build summary { cursor: pointer; font-weight: 600; color: var(--cream); }
details.build[open] summary { margin-bottom: 8px; }
