/* DevClip — devclip.nuasa.uk
   Palette is the app's own (ClipItem.swift / FolderColor.hex), with the
   semantic tokens re-derived per theme so every pair clears WCAG AA.
   Ratios in comments were computed against the token's actual background. */

:root {
  color-scheme: light dark;

  --bg:         #FBFBFC;
  --surface:    #FFFFFF;
  --border:     #E2E3E7;  /* decorative separators only — never a UI edge */
  --border-ui:  #8A8D95;  /* kbd, buttons, table cells — 3.21 vs bg  */
  --ink:        #17181C;  /* 17.15 */
  --ink-muted:  #63666E;  /*  5.55 */
  --accent:     #0561C4;  /* button fill; white on it = 5.98 */
  --accent-ink: #0561C4;  /* link text = 5.78 */
  --pro:        #8B31C9;  /*  6.01 */
  --ok:         #177A36;  /*  5.24 */
  --stop:       #C21C10;  /*  5.86 */
  --focus:      #17181C;

  --font-ui:   system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  --measure: 68ch;
  --wrap: 62rem;
  --header-h: 3.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #121316;
    --surface:    #22262C;
    --border:     #343841;
    --border-ui:  #6E727B;  /* 3.85 vs bg */
    --ink:        #F2F3F5;
    --ink-muted:  #9A9EA6;
    --accent:     #0A84FF;
    --accent-ink: #4DA3FF;  /* 7.08 */
    --pro:        #D9A0F7;
    --ok:         #30D158;
    --stop:       #FF453A;
    --focus:      #F2F3F5;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }

/* Every id is a potential anchor target and the header is sticky. */
[id] { scroll-margin-top: calc(var(--header-h) + 1rem); }

:where(a, button, [tabindex], summary):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;   /* load-bearing: puts the ring on --bg, not on the blue fill */
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Clip-rect, not display:none — it has to stay focusable. */
.skip {
  position: absolute;
  left: 0.75rem; top: 0.75rem;
  z-index: 100;
  padding: 0.55rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border-ui);
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
/* The app icon already carries its own rounded-square padding, so it needs no
   border or radius here — adding one would draw a box around a box. */
.wordmark img { width: 24px; height: 24px; flex: none; }

.nav ul {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0; padding: 0;
  font-size: 0.92rem;
}
.nav a { color: var(--ink-muted); text-decoration: none; }
.nav a:hover { color: var(--ink); }

/* 320px cannot hold wordmark + 5 links + a button. The links are duplicated
   in the footer and in the document flow, so they are the part that goes. */
@media (max-width: 46rem) { .nav { display: none; } }
@media (max-height: 30rem) { .site-header { position: static; } }

/* ---------- buttons and links ---------- */

a { color: var(--accent-ink); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }

.btn {
  display: inline-block;
  padding: 0.62rem 1.15rem;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 120ms linear;
}
.btn:hover { background: #044E9E; color: #fff; }
.btn-sm { padding: 0.38rem 0.8rem; font-size: 0.87rem; }
.btn-ghost {
  background: none;
  color: var(--accent-ink);
  border-color: var(--border-ui);
}
.btn-ghost:hover { background: var(--surface); color: var(--ink); }

@media (forced-colors: active) {
  .btn { border: 2px solid ButtonText; }
}

/* ---------- type ---------- */

h1, h2, h3 { text-wrap: balance; margin: 0; }

h1 {
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.08;
}

h2 {
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin-bottom: 0.9rem;
}
/* the 24×2 accent rule that opens every section */
h2::before {
  content: "";
  display: block;
  width: 24px; height: 2px;
  background: var(--accent);
  margin-bottom: 0.85rem;
}
h2.plain::before { display: none; }

h3 { font-size: 1.05rem; font-weight: 600; line-height: 1.4; }

p { max-width: var(--measure); margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

.lede {
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--ink-muted);
  max-width: 34em;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  font-weight: 400;
}

small, .small { font-size: 0.88rem; color: var(--ink-muted); }

kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 2px 6px;
  border: 1px solid var(--border-ui);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  white-space: nowrap;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

ul.bullets { max-width: var(--measure); padding-left: 1.1rem; margin: 0 0 1rem; }
ul.bullets li { margin-bottom: 0.5rem; }

/* ---------- sections ---------- */

main > section {
  padding-block: 3.25rem;
  border-top: 1px solid var(--border);
}
main > section:first-child { border-top: 0; }

.hero { padding-block: 3rem 2.5rem; }
.hero h1 { margin-bottom: 1.1rem; }
.hero .lede { margin-bottom: 1.5rem; }

.price-line {
  border: 1px solid var(--border-ui);
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  max-width: 40rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
}
.price-line p { margin: 0; max-width: none; }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}

.meta-lines { display: grid; gap: 0.2rem; margin-bottom: 2rem; }

figure { margin: 0; }
figure.shot { margin-top: 1.75rem; }
figure.shot img {
  border: 1px solid var(--border);
  border-radius: 8px;
}
.hero figure.shot img { box-shadow: 0 8px 28px rgb(0 0 0 / 9%); }
figcaption { margin-top: 0.6rem; font-size: 0.88rem; color: var(--ink-muted); }

/* ---------- tiles ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.tile {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem;
  background: var(--surface);
}
.tile h3 { margin-bottom: 0.6rem; }
.tile p { font-size: 0.94rem; max-width: none; }

/* ---------- tool table ---------- */

.table-scroll { overflow-x: auto; margin-top: 1.5rem; }

table {
  border-collapse: collapse;
  width: 100%;
  max-width: 34rem;
  font-size: 0.94rem;
}
caption {
  caption-side: bottom;
  text-align: left;
  padding-top: 0.75rem;
  font-size: 0.88rem;
  color: var(--ink-muted);
}
th, td {
  text-align: left;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
}
thead th {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 400;
  color: var(--ink);
  background: var(--surface);
}
td.tier { width: 6.5rem; }

.tier-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tier-free { color: var(--ink-muted); }
.tier-pro  { color: var(--pro); font-weight: 600; }

/* ---------- pricing ---------- */

.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.plan {
  border: 1px solid var(--border-ui);
  border-radius: 10px;
  padding: 1.25rem;
  background: var(--surface);
}
.plan h3 { margin-bottom: 0.15rem; }
.plan .amount { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.plan .amount .per { font-size: 0.9rem; font-weight: 400; color: var(--ink-muted); }
.plan ul { list-style: none; margin: 1rem 0 0; padding: 0; font-size: 0.94rem; }
.plan li { display: flex; gap: 0.55rem; margin-bottom: 0.5rem; }
.plan li::before {
  content: "✓";
  color: var(--ok);
  font-weight: 700;
  flex: none;
}

/* ---------- FAQ ---------- */

.faq { max-width: var(--measure); }
.faq h3 { margin-top: 1.75rem; }
.faq h3:first-of-type { margin-top: 1.25rem; }
.faq p { margin-top: 0.4rem; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem 3rem;
  font-size: 0.9rem;
  color: var(--ink-muted);
}
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  list-style: none;
  margin: 0 0 0.6rem;
  padding: 0;
}
/* separator drawn as pseudo-content so it stays out of the a11y tree
   and out of copy-paste */
.site-footer li + li::before {
  content: "·";
  margin-right: 0.9rem;
  color: var(--border-ui);
}

/* ---------- legal pages ---------- */

.doc { max-width: 44rem; }
.doc h2 { margin-top: 2.5rem; font-size: 1.3rem; }
.doc h3 { margin-top: 1.75rem; }
.doc p, .doc li { max-width: none; }
.doc .standfirst {
  border: 1px solid var(--border-ui);
  border-radius: 10px;
  background: var(--surface);
  padding: 1.1rem;
  margin-bottom: 1.5rem;
}
.doc .standfirst p:first-child { font-weight: 600; }
.langswitch { margin-bottom: 2rem; font-size: 0.92rem; }
.langswitch a + a::before { content: "·"; margin: 0 0.5rem; color: var(--border-ui); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
