/* pixel8.ro — Ink / Ivory / Blue / Mint, Arial (brand book v1.0 layout, colours updated 2026-09-25).
   Blue #4D82C6 is the artwork colour; #416DA6 carries text (5.3:1 with white).
   Balance ≈ 70% neutrals, 25% blue, 5% mint. Mint is a highlight, never text on ivory. */
:root {
  --ink: #16151B;
  --ivory: #F4F1E9;
  --blue: #416DA6;
  --mint: #A7FDBF;
  --white: #FFFFFF;

  --bg: var(--ivory);
  --surface: var(--white);
  --text: var(--ink);
  --text-2: #4A4852;
  --line: #D6D2C6;
  --accent-text: var(--blue);     /* deep blue on ivory: 4.7:1 */
  --on-accent: var(--white);        /* white on deep blue: 5.3:1 */
  --ok: #1F7A45;
  --bad: #C0342B;
  --focus: var(--blue);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--ink); --surface: #201F27; --text: var(--ivory); --text-2: #B4B0A6;
    --line: #34323D; --accent-text: #7FA5D6; --ok: #7BD89B; --bad: #FF8A80; --focus: var(--mint);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: var(--ink); --surface: #201F27; --text: var(--ivory); --text-2: #B4B0A6;
  --line: #34323D; --accent-text: #7FA5D6; --ok: #7BD89B; --bad: #FF8A80; --focus: var(--mint);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 18px/1.5 Arial, "Helvetica Neue", Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* the artwork blue, for tiles and marks without text */
:root { --blue-art: #4D82C6; }

/* labels: Arial Bold, uppercase, generous spacing */
.label { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }

/* header — the wordmark keeps its clear space (¼ of the loop height) */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.brand { display: block; padding: 6px 0; line-height: 0; }
.brand img { width: 128px; height: auto; }
.brand .rev { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .pri { display: none; }
  :root:not([data-theme="light"]) .brand .rev { display: block; }
}
:root[data-theme="dark"] .brand .pri { display: none; }
:root[data-theme="dark"] .brand .rev { display: block; }
.top nav { display: flex; gap: 22px; flex-wrap: wrap; }
.top nav a { color: var(--text); text-decoration: none; font-size: 16px; }
.top nav a:hover, .top nav a[aria-current="page"] { color: var(--accent-text); }

/* hero */
.hero { display: grid; grid-template-columns: 1fr; align-items: center; gap: 32px; padding: 64px 0 72px; }
@media (min-width: 860px) { .hero { grid-template-columns: 1.5fr 1fr; padding: 96px 0 104px; } }
.hero h1 { font-size: clamp(44px, 7.4vw, 80px); line-height: 1.05; letter-spacing: -.02em; margin: 16px 0 24px; }
.hero p { font-size: 20px; margin: 0 0 32px; max-width: 36ch; }
.hero .loop { justify-self: center; width: min(240px, 50vw); }
.hero .loop img { width: 100%; height: auto; display: block; }
.eyebrow { color: var(--accent-text); }

.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  font: 700 16px/1 Arial, sans-serif; text-decoration: none; border: 2px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--blue); color: var(--on-accent); }
.btn-primary:hover { background: #3A6396; }
.btn-ghost { border-color: var(--text); color: var(--text); background: transparent; }
.btn-ghost:hover { background: var(--text); color: var(--bg); }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* sections */
.section { padding: 64px 0; border-top: 1px solid var(--line); }
.section h2 { font-size: clamp(32px, 4.6vw, 48px); line-height: 1.05; letter-spacing: -.015em; margin: 12px 0 32px; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 32px; }
.pillars .n { color: var(--accent-text); }
.pillars h3 { font-size: 26px; margin: 8px 0; }
.pillars p { margin: 0; color: var(--text-2); }

/* project cards */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 12px; padding: 28px; min-height: 260px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
a.card:hover { border-color: var(--blue); box-shadow: inset 0 -4px 0 var(--blue); }
.card h3 { margin: 0; font-size: 26px; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--text-2); font-size: 16px; flex: 1; }
.card .foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card .go { color: var(--accent-text); font-weight: 700; font-size: 16px; }
.card.muted { background: transparent; }
.tag { padding: 6px 8px; border: 1px solid var(--line); color: var(--text-2); }
.tag.live { background: var(--mint); border-color: var(--mint); color: var(--ink); }
.card-ico { width: 44px; height: 44px; display: grid; place-items: center; background: var(--blue-art); color: var(--white); }
.card-ico svg { width: 24px; height: 24px; }

/* blue panel — blue kept for focused emphasis */
.panel { background: var(--blue); color: var(--white); padding: 48px 28px; margin: 64px 0 0; display: grid; gap: 24px; }
@media (min-width: 860px) { .panel { grid-template-columns: 1.6fr 1fr; align-items: center; padding: 64px; } }
.panel h2 { margin: 0; font-size: clamp(30px, 4.4vw, 46px); line-height: 1.08; }
.panel p { margin: 8px 0 0; font-size: 18px; }
.panel .btn { background: var(--ink); color: var(--ivory); justify-self: start; }
.panel .btn:hover { background: #000; }
@media (min-width: 860px) { .panel .btn { justify-self: end; } }

/* footer — the ink band */
.foot-site { background: var(--ink); color: var(--ivory); margin-top: 72px; }
.foot-site .wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 24px; padding-top: 24px; padding-bottom: 28px; }
.foot-site a { color: var(--ivory); }
.foot-site nav { display: flex; gap: 20px; flex-wrap: wrap; font-size: 15px; }
:root[data-theme="dark"] .foot-site { border-top: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .foot-site { border-top: 1px solid var(--line); } }

/* page heads */
.page-head { padding: 56px 0 32px; }
.page-head h1 { font-size: clamp(40px, 6vw, 64px); line-height: 1.05; letter-spacing: -.02em; margin: 12px 0; }
.page-head p { margin: 0; color: var(--text-2); max-width: 60ch; }

/* legal article */
.legal { max-width: 760px; }
.legal .updated { color: var(--text-2); font-size: 16px; margin: 0 0 32px; }
.legal nav.toc { background: var(--surface); border: 1px solid var(--line); padding: 20px 24px; margin-bottom: 32px; }
.legal nav.toc ol { margin: 0; padding-left: 22px; columns: 2 240px; font-size: 16px; }
.legal h2 { font-size: 24px; margin: 40px 0 8px; scroll-margin-top: 16px; }
.legal ul { padding-left: 22px; }
.legal li { margin-bottom: 8px; }
.legal .callout { border-left: 6px solid var(--blue); background: var(--surface); padding: 14px 18px; }
.legal .callout p { margin: 0; }

/* contact form */
.contact { max-width: 680px; }
.form { display: grid; gap: 20px; background: var(--surface); border: 1px solid var(--line); padding: 28px; }
.field { display: grid; gap: 6px; }
.field > label { font-weight: 700; font-size: 16px; }
.field .opt { font-weight: 400; color: var(--text-2); }
.field input, .field textarea {
  font: inherit; font-size: 17px; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 0; padding: 12px 14px; width: 100%;
}
.field input:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }
.field textarea { min-height: 180px; resize: vertical; }
[aria-invalid="true"] { border-color: var(--bad) !important; }
.field-error { color: var(--bad); font-size: 15px; }
.field-error:empty { display: none; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; }
.consent input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--blue); flex: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.form-foot button:disabled { opacity: .6; cursor: progress; }
#check { font-size: 15px; color: var(--text-2); }
#check[data-state="ok"] { color: var(--ok); }
#check[data-state="bad"], #status[data-state="bad"] { color: var(--bad); }
#status { margin: 0; font-size: 16px; }
#status:empty { display: none; }
#status[data-state="ok"] { color: var(--ok); font-weight: 700; }

/* the pixel — measured square modules, behind content, never through it */
.pixels { display: grid; grid-template-columns: repeat(9, 10px); gap: 12px; }
.pixels i { width: 10px; height: 10px; background: var(--text); opacity: .85; }
.pixels i.v { background: var(--blue); opacity: 1; }
.pixels i.o { visibility: hidden; }
.legal h1 { font-size: clamp(40px, 6vw, 64px); line-height: 1.05; letter-spacing: -.02em; margin: 56px 0 8px; }
.field > label.consent { font-weight: 400; }

/* phones: keep the header and hero inside the viewport */
@media (max-width: 560px) {
  .top { flex-wrap: wrap; gap: 8px 16px; }
  .top nav { gap: 16px; }
  .top nav a { font-size: 15px; }
  .hero { padding: 40px 0 56px; }
  .hero .loop { width: 140px; justify-self: start; order: -1; }
  .grid { grid-template-columns: 1fr; }
  .pillars { grid-template-columns: 1fr; }
}

/* contact spam check: "match the gap" */
.puzzle { gap: 10px; }
.pz-label { font-size: 16px; }
.pz-stage { position: relative; width: 100%; max-width: 320px; aspect-ratio: 320 / 170; background: var(--bg); border: 1px solid var(--line); overflow: hidden; touch-action: none; user-select: none; }
.pz-stage img { position: absolute; top: 0; left: 0; display: block; -webkit-user-drag: none; }
#pz-bg { width: 100%; height: 100%; }
#pz-piece { width: 15%; height: auto; cursor: grab; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
#pz-piece:active { cursor: grabbing; }
.pz-stage img[hidden] { display: none; }
.pz-loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; color: var(--text-2); }
.pz-track { position: relative; width: 100%; max-width: 320px; height: 40px; background: var(--bg); border: 1px solid var(--line); touch-action: none; user-select: none; }
.pz-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: color-mix(in srgb, var(--blue) 18%, transparent); }
.pz-handle {
  position: absolute; top: -1px; left: 0; width: 48px; height: 40px; display: grid; place-items: center;
  background: var(--blue); color: var(--white); font-weight: 700; cursor: grab;
}
.pz-handle:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pz-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--text-2); }
.pz-new { font: inherit; font-weight: 700; color: var(--accent-text); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.puzzle[data-state="bad"] .pz-stage, .puzzle[data-state="bad"] .pz-track { border-color: var(--bad); }
.pz-loading[hidden] { display: none; }

/* security-check indicator: animated until both checks are done */
#check { display: inline-flex; align-items: center; gap: 8px; }
#check::before { content: ""; width: 10px; height: 10px; flex: none; }
#check[data-state="busy"]::before { border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: pz-spin .8s linear infinite; }
#check[data-state="ok"]::before { display: none; }
@keyframes pz-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #check[data-state="busy"]::before { animation-duration: 2.4s; } }
.puzzle[data-state="ok"] .pz-stage, .puzzle[data-state="ok"] .pz-track { border-color: var(--ok); }
.puzzle[data-state="ok"] .pz-handle { background: var(--ok); cursor: default; }
.puzzle[data-state="ok"] #pz-piece { cursor: default; }

/* message length counter */
.msg-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--text-2); }
#msg-count { font-variant-numeric: tabular-nums; }
#msg-count[data-state="near"] { color: #B26A00; font-weight: 700; }
#msg-count[data-state="short"] { color: var(--text-2); }
:root[data-theme="dark"] #msg-count[data-state="near"] { color: #F2B84B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #msg-count[data-state="near"] { color: #F2B84B; } }

/* square product marks (PixelBox) in the header */
.brand img.mark { width: 40px; }

/* product name next to a square mark (PixelBox pages) */
.brand:has(.brand-name) { display: inline-flex; align-items: center; gap: 10px; line-height: 1; text-decoration: none; }
.brand-name { color: var(--text); font-weight: 700; font-size: 18px; letter-spacing: -.01em; }

/* hero: the 8 drifts (parallax) and turns to ∞ as the page scrolls (hero.js) */
.hero { overflow-x: clip; }
.hero .loop img { will-change: transform; transform-origin: 50% 50%; }

/* No orphans: balanced headings, "pretty" paragraphs (never one word alone on the last line). */
h1, h2, h3, .large-title, .hero h1, .panel h2, b.me-name { text-wrap: balance; }
p, li, .subtitle, .card p, .pillars p, .bc-sub, .beam-callout b, .peer-status, .empty p, .footnote, .hint, .field-label, label { text-wrap: pretty; }

/* Hero headline: each phrase stays on one line; the size follows the column. */
.hero > div { container-type: inline-size; }
.hero-title { font-size: min(80px, 9.4cqi); }
.hero-title span { display: block; white-space: nowrap; }

/* Light / Auto / Dark switch (box.pixel8.ro frame pages): shows the current choice,
   opens to all three — square, like the app's. */
.top { position: relative; }
.p8-theme { position: relative; width: 40px; height: 40px; flex: none; }
.p8-theme-seg { position: absolute; top: 0; right: 0; display: flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); z-index: 5; }
.p8-theme-seg button { width: 32px; height: 32px; display: none; place-items: center; background: none; border: 0; color: var(--text-2); cursor: pointer; }
.p8-theme-seg button[aria-pressed="true"], .p8-theme-seg.open button { display: grid; }
.p8-theme-seg button[aria-pressed="true"] { color: var(--text); background: var(--bg); }
.p8-theme-seg.open { box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .45); }
.p8-theme-seg button:hover { color: var(--text); }
.p8-theme-seg svg { width: 18px; height: 18px; }
.brand img.mark { width: auto; height: 40px; }

/* public work: two live tools */
.section-lead { margin: -16px 0 28px; color: var(--text-2); max-width: 60ch; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
.panel p { max-width: 62ch; }

/* The live pixel 8 (hero.js): the grid is twice the 8's width, centred on it, so the
   8 itself fills the column and the ∞ has room to turn. */
.hero .loop { position: relative; }
.loop-pixels { display: block; width: 200%; height: auto; margin: 0 -50%; will-change: transform; transform-origin: 50% 50%; shape-rendering: crispEdges; }

/* contact: "message sent" pop-up — fades in, fades out, then the page goes home */
.sent-pop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgb(22 21 27 / .55); opacity: 0; transition: opacity .4s ease; cursor: pointer; }
.sent-pop.show { opacity: 1; }
.sent-pop > div { max-width: 420px; padding: 28px 32px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-top: 6px solid var(--mint); font-weight: 700; text-align: center;
  text-wrap: balance; transform: translateY(8px); transition: transform .4s ease; }
.sent-pop.show > div { transform: none; }
@media (prefers-reduced-motion: reduce) { .sent-pop, .sent-pop > div { transition: none; transform: none; } }

/* Ko-fi support block (tools/support.py): Work section, and above the footer on box.pixel8.ro */
.support { display: flex; align-items: center; gap: 16px 20px; flex-wrap: wrap; margin-top: 32px; padding: 18px 20px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.support .support-cup { flex: none; width: 46px; height: auto; color: #4D82C6; }
.support p { flex: 1 1 260px; margin: 0; font-size: 16px; line-height: 1.45; text-wrap: pretty; }
.support .support-go { flex: none; display: inline-block; padding: 11px 18px; background: #416DA6; color: #FFFFFF;
  font-weight: 700; font-size: 15px; text-decoration: none; }
.support .support-go:hover { background: #3A6396; text-decoration: none; }
.support-wrap { margin-top: 56px; }
.support-wrap .support { margin-top: 0; }

/* how-it-works videos (tools/videos.py) */
.demo-video { margin: 0; }
.demo-video video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #16151B; border: 1px solid var(--line); }
.demo-video figcaption { margin-top: 10px; font-size: 15px; line-height: 1.45; color: var(--text-2); text-wrap: pretty; }
.demo-video figcaption b { color: var(--text); }
.videos-title { margin: 48px 0 16px; font-size: 22px; }
.drop-page .demo-video, main > .demo-video { max-width: 760px; margin-top: 40px; }

/* PixelBeam page: the pointer back to PixelBox, same card as PixelBox's pointer to Beam */
.beam-callout { display: flex; align-items: center; gap: 16px; margin-top: 32px; padding: 14px 16px; background: var(--surface);
  color: var(--text); text-decoration: none; border: 1px solid var(--line); }
.beam-callout:hover { text-decoration: none; border-color: var(--accent-text); }
.bc-tile { flex: none; display: grid; place-items: center; width: 76px; height: 44px; background: #4D82C6; }
.bc-tile img { width: 60px; height: auto; display: block; }
.box-callout .bc-tile img { width: 34px; }
.bc-text { display: grid; gap: 2px; min-width: 0; }
.beam-callout b { font-size: 16px; line-height: 1.3; }
.bc-sub { font-size: 14px; color: var(--text-2); }
.beam-callout .go { font-size: 14px; font-weight: 700; color: var(--accent-text); }

/* privacy notice (assets/stats.js): informational, bottom corner, never blocks the page */
.p8-notice { position: fixed; left: 16px; bottom: 16px; z-index: 60; max-width: 400px; padding: 16px 18px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: inset 0 4px 0 #A7FDBF, 0 12px 32px rgba(0, 0, 0, .25);
  font: 14px/1.45 Arial, "Helvetica Neue", Helvetica, sans-serif; }
.p8-notice p { margin: 4px 0 12px; text-wrap: pretty; }
.p8-notice-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.p8-notice-row a { color: var(--accent-text); font-weight: 700; text-underline-offset: 3px; }
.p8-notice-row button { font: inherit; font-weight: 700; padding: 8px 16px; border: 0; background: #416DA6; color: #FFFFFF; cursor: pointer; }
.p8-notice-row button:hover { background: #3A6396; }
.p8-notice-row { flex-wrap: wrap; row-gap: 10px; }
.p8-notice-btns { display: flex; gap: 8px; }
.p8-notice-row button.p8-never { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line); font-weight: 400; }
.p8-notice-row button.p8-never:hover { background: transparent; box-shadow: inset 0 0 0 1px var(--text); }
.p8-notice-row button:focus-visible, .p8-notice-row a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 480px) { .p8-notice { right: 16px; max-width: none; } }
@media print { .p8-notice { display: none; } }

