/* Ownly — ownly.tercodevs.com
   Layout: one column of reading width; the home opens with the gallery a
   person sees in the app, each photo in its protection color. Same tokens
   as the iPhone app (Assets.xcassets): cobalt ink on warm paper. */
:root {
  --paper: #f9f8f5;
  --card: #ffffff;
  --ink: #16181d;
  --muted: #5d6270;
  --line: #e4e2dc;
  --accent: #1f5bdf;
  --on-accent: #ffffff;
  --accent-soft: #e6edfc;
  --safe: #128049;
  --released: #0a7975;
  --pending: #b45208;
  --risk: #d32a2a;
  --code-bg: #efede7;

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: clamp(2rem, 1.4rem + 2.6vw, 3.25rem);
  --radius: 14px;
  --measure: 66ch;
  --wide: 1120px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121212; --card: #1e1e1e; --ink: #f2f2f4; --muted: #a3a7b2; --line: #2e2f33;
    --accent: #7ea6ff; --on-accent: #091a3c; --accent-soft: #1b2741;
    --safe: #49de80; --released: #5eead3; --pending: #fabe23; --risk: #ff7979; --code-bg: #26272b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121212; --card: #1e1e1e; --ink: #f2f2f4; --muted: #a3a7b2; --line: #2e2f33;
  --accent: #7ea6ff; --on-accent: #091a3c; --accent-soft: #1b2741;
  --safe: #49de80; --released: #5eead3; --pending: #fabe23; --risk: #ff7979; --code-bg: #26272b;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 20; background: var(--paper);
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: var(--step-3); font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: var(--step-2); font-weight: 700; }
h3 { font-size: var(--step-1); font-weight: 600; }
p { margin: 0; }
code, kbd {
  font: 0.9em var(--font-mono); background: var(--code-bg); border-radius: 6px; padding: 0.1em 0.4em;
}
pre {
  margin: 0; font: var(--step--1)/1.6 var(--font-mono); background: var(--code-bg);
  border-radius: 10px; padding: 14px 16px; overflow-x: auto;
}
pre code { background: none; padding: 0; }
.tabnum { font-variant-numeric: tabular-nums; }

/* Frame */
.wrap {
  max-width: var(--wide); margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: var(--step-1); color: var(--ink); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-left: auto; font-size: var(--step--1); }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; padding: 6px 0; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }

main { display: block; }
.section { padding-block: clamp(48px, 8vw, 96px); }
.section + .section { border-top: 1px solid var(--line); }
.section-head { display: grid; gap: 10px; max-width: var(--measure); margin-bottom: 32px; }
.eyebrow { font-size: var(--step--1); font-weight: 600; color: var(--accent); letter-spacing: 0.02em; }
.lede { font-size: var(--step-1); color: var(--muted); line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); }
.prose { max-width: var(--measure); display: grid; gap: 14px; }
.prose h2 { margin-top: 28px; }
.prose h3 { margin-top: 14px; }
.prose ul, .prose ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 12px; border: 0;
  font: 600 var(--step-0)/1 var(--font-ui); text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-quiet { background: var(--accent-soft); color: var(--accent); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Hero */
.hero { padding-block: clamp(40px, 7vw, 88px); }
.hero .wrap { display: grid; gap: clamp(32px, 5vw, 64px); grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); align-items: center; }
.hero-copy { display: grid; gap: 20px; min-width: 0; }
.hero-copy .lede { max-width: 34ch; }
.hero-note { font-size: var(--step--1); color: var(--muted); }

/* The phone in the hero: Ownly's gallery, each tile in its state color */
.phone {
  justify-self: center; width: min(100%, 340px); aspect-ratio: 9 / 18.5;
  background: var(--card); border: 1px solid var(--line); border-radius: 44px;
  padding: 18px 14px; display: grid; grid-template-rows: auto auto 1fr auto; gap: 12px;
  box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--accent) 45%, transparent);
}
.phone-title { font: 700 1.5rem/1.1 var(--font-display); padding: 8px 6px 0; }
.phone-stats { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.78rem; padding-inline: 6px; color: var(--muted); }
.phone-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.grid-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; align-content: start; }
.tile { aspect-ratio: 1; border-radius: 4px; position: relative; background: var(--t, #888); }
.tile::after {
  content: ""; position: absolute; right: 3px; bottom: 3px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--dot); box-shadow: 0 0 0 2px var(--card);
}
.tile.safe { --dot: var(--safe); }
.tile.released { --dot: var(--released); opacity: 0.55; }
.tile.pending { --dot: var(--pending); }
.phone .btn { width: 100%; font-size: 0.95rem; min-height: 44px; }

/* State legend: the app's words and colors */
.states { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.state { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start; align-content: start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.state .dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 5px; grid-row: span 2; }
.state p { color: var(--muted); font-size: var(--step--1); }

/* Steps: a real sequence */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; counter-reset: step; }
.steps li { list-style: none; display: grid; gap: 8px; align-content: start; min-width: 0; }
.steps li::before {
  counter-increment: step; content: counter(step);
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.steps p { color: var(--muted); }
ol.steps { margin: 0; padding: 0; }

/* Platforms */
.platforms { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.platform { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.platform h3 { font-size: var(--step-0); }
.platform p { font-size: var(--step--1); color: var(--muted); }
.pill { justify-self: start; font-size: 0.78rem; font-weight: 600; border-radius: 999px; padding: 3px 10px; background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: color-mix(in srgb, var(--safe) 14%, transparent); color: var(--safe); }
.pill.wait { background: color-mix(in srgb, var(--pending) 16%, transparent); color: var(--pending); }
.pill.off { background: var(--code-bg); color: var(--muted); }

/* Two columns of text */
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.split > * { min-width: 0; display: grid; gap: 10px; align-content: start; }

/* Facts list */
.facts { display: grid; gap: 0; border-top: 1px solid var(--line); max-width: 860px; }
.facts > div { display: grid; grid-template-columns: minmax(140px, 0.4fr) 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; color: var(--muted); min-width: 0; }

/* FAQ */
.faq { display: grid; gap: 10px; max-width: 820px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 18px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 16px 0; list-style-position: outside; }
.faq details > div { padding-bottom: 16px; color: var(--muted); display: grid; gap: 8px; }

/* Contact */
.contact { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: clamp(22px, 4vw, 40px); display: grid; gap: 16px; max-width: 760px; }
.copy-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.copy-row output { font: 600 var(--step-1) var(--font-mono); user-select: all; overflow-wrap: anywhere; }

/* Install guide */
.guide { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; align-items: start; }
.toc { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 84px); display: grid; gap: 4px; font-size: var(--step--1); }
.toc a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.toc a:hover { color: var(--ink); }
.guide-step { display: grid; gap: 14px; padding-bottom: 40px; margin-bottom: 40px; border-bottom: 1px solid var(--line); max-width: var(--measure); }
.guide-step:last-child { border-bottom: 0; }
.guide-step ol, .guide-step ul { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; }
.note { border-radius: 12px; padding: 12px 14px; background: var(--accent-soft); font-size: var(--step--1); }
.note.warn { background: color-mix(in srgb, var(--pending) 14%, transparent); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button {
  font: 600 var(--step--1) var(--font-ui); min-height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.tabpanel { display: grid; gap: 12px; }

/* Architecture */
.diagram { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; overflow-x: auto; }
.diagram svg { display: block; min-width: 720px; width: 100%; height: auto; }
.diagram text { fill: var(--ink); font-family: var(--font-ui); }
.diagram .sub { fill: var(--muted); }
.diagram .box { fill: var(--paper); stroke: var(--line); stroke-width: 1.5; }
.diagram .zone { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 6 6; }
.diagram .lan { stroke: var(--safe); }
.diagram .wan { stroke: var(--accent); }
.diagram .flow { fill: none; stroke-width: 2.5; }
.diagram .label-lan { fill: var(--safe); font-weight: 600; }
.diagram .label-wan { fill: var(--accent); font-weight: 600; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 36px; font-size: var(--step--1); color: var(--muted); }
.site-footer .wrap { display: flex; gap: 12px 28px; flex-wrap: wrap; justify-content: space-between; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

@media (max-width: 900px) {
  .hero .wrap, .split { grid-template-columns: 1fr; }
  .platforms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: 1fr; }
  .guide { grid-template-columns: 1fr; gap: 24px; }
  .toc { position: static; grid-auto-flow: row; }
}
@media (max-width: 520px) {
  .platforms { grid-template-columns: 1fr; }
  .facts > div { grid-template-columns: 1fr; gap: 4px; }
  .nav { margin-left: 0; width: 100%; padding-bottom: 8px; }
}
@media (prefers-reduced-motion: no-preference) {
  .tile.released { transition: opacity 0.4s; }
}
