/* ==========================================================================
   modernist — design system
   Ported from the Claude Design project's _ds bundle to plain CSS so the app
   needs no build step on cPanel. Tokens first, then primitives, then the
   three imported components (ios-frame, browser-window, image-slot).

   Retuned to "Style 1" of design/mockups: the editorial front-page direction.
   Set in Archivo (a grotesque, self-hosted below), one bright red accent,
   flat surfaces, and 2px rules doing the structural work.
   ========================================================================== */

/* --- typeface ---------------------------------------------------------- */
/* Archivo, self-hosted as two variable-font subsets (weight axis 100–900) so
   the masthead's 800 and the body's 400 come from one file each. Paths are
   relative to this stylesheet, so they resolve under any BASE_PATH. */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/archivo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/archivo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- tokens ------------------------------------------------------------ */

:root {
  /* Ink on paper, one accent, nothing else. Neutral greys, a bright red. */
  --ink: #201e1d;
  --ink-2: #4c4845;
  --ink-3: #7d7979;
  --paper: #f3f2f2;
  --paper-2: #fbfafa;
  --paper-3: #eae9e9;
  --rule: color-mix(in srgb, var(--ink) 20%, var(--paper));
  --rule-strong: #201e1d;

  --signal: #ec3013;
  --signal-ink: #f3f2f2;
  --up: #1c6b45;
  --down: #b12712;

  /* Archivo first — the front page is set in the grotesque, masthead at 800. */
  --font-sans: "Archivo", "Helvetica Neue", Helvetica, "Segoe UI", system-ui,
    -apple-system, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "Roboto Mono", Menlo,
    Consolas, monospace;

  /* Fluid type scale, 1.25 ratio at the small end and 1.33 at the large. */
  --t-micro: 0.6875rem;
  --t-small: 0.8125rem;
  --t-body: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --t-lede: clamp(1.125rem, 1rem + 0.55vw, 1.4375rem);
  --t-h3: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --t-h2: clamp(1.75rem, 1.35rem + 1.7vw, 3rem);
  --t-h1: clamp(2.5rem, 1.4rem + 5vw, 6.5rem);

  /* 8px base, doubling. */
  --s-1: 0.5rem;
  --s-2: 1rem;
  --s-3: 1.5rem;
  --s-4: 2rem;
  --s-5: 3rem;
  --s-6: 4rem;
  --s-7: 6rem;
  --s-8: 8rem;

  --container: 82.5rem;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --hair: 1px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 240ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f3f2f2;
    --ink-2: #b6b1ad;
    --ink-3: #8a8582;
    --paper: #141312;
    --paper-2: #1c1a19;
    --paper-3: #24211f;
    --rule: color-mix(in srgb, var(--ink) 26%, var(--paper));
    --rule-strong: #f3f2f2;

    --signal: #ff563c;
    --signal-ink: #141312;
    --up: #4fb383;
    --down: #e0684f;
  }
}

/* --- reset ------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Sticky header height, so #anchor targets are not hidden beneath it. */
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, blockquote, ul, ol, dl {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

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

/* --- typography -------------------------------------------------------- */

.display {
  font-size: var(--t-h1);
  line-height: 0.9;
  letter-spacing: -0.045em;
  font-weight: 800;
  text-wrap: balance;
}

.h2 {
  font-size: var(--t-h2);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 800;
  text-wrap: balance;
}

.h3 {
  font-size: var(--t-h3);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.lede {
  font-size: var(--t-lede);
  line-height: 1.4;
  letter-spacing: -0.014em;
  color: var(--ink-2);
  text-wrap: pretty;
}

.prose p + p {
  margin-top: var(--s-2);
}

/* The system's signature: a monospaced, tracked-out, uppercase label. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--t-small);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.muted { color: var(--ink-2); }
.accent { color: var(--signal); }

/* --- layout ------------------------------------------------------------ */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(var(--s-6), 9vw, var(--s-8));
}

.section--tight { padding-block: clamp(var(--s-5), 6vw, var(--s-6)); }

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s-3) var(--gutter);
}

@media (max-width: 60rem) {
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 34rem) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Hairline rules do the structural work in place of boxes and shadows. */
.rule {
  border: 0;
  border-top: var(--hair) solid var(--rule);
  margin: 0;
}

.rule--strong { border-top-color: var(--rule-strong); border-top-width: 2px; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  padding-top: var(--s-2);
  margin-bottom: var(--s-5);
  border-top: 2px solid var(--rule-strong);
}

.section-head .h2 { flex: 1 1 20ch; }

/* --- buttons ----------------------------------------------------------- */

.btn {
  --btn-bg: var(--ink);
  --btn-fg: var(--paper);
  --btn-bd: var(--ink);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  padding: 0.85em 1.6em;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: var(--hair) solid var(--btn-bd);
  border-radius: 0;
  font-size: var(--t-small);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.btn:hover {
  --btn-bg: var(--signal);
  --btn-fg: var(--signal-ink);
  --btn-bd: var(--signal);
}

.btn:active { transform: translateY(1px); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bd: var(--rule-strong);
}

.btn--signal {
  --btn-bg: var(--signal);
  --btn-fg: var(--signal-ink);
  --btn-bd: var(--signal);
}

.btn--signal:hover {
  --btn-bg: var(--ink);
  --btn-fg: var(--paper);
  --btn-bd: var(--ink);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* --- form fields ------------------------------------------------------- */

.field {
  width: 100%;
  padding: 0.85em 1em;
  background: var(--paper-2);
  border: var(--hair) solid var(--rule-strong);
  border-radius: 0;
  font-size: var(--t-body);
}

.field::placeholder { color: var(--ink-3); }

.field:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: -1px;
}

.field[aria-invalid='true'] { border-color: var(--signal); }

/* Segmented control — a row of radios drawn as one ruled block. Ported from
   the design system's `seg` component; the native inputs stay in the DOM (and
   keyboard-reachable) but are drawn by the label around them. */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  border: var(--hair) solid var(--rule-strong);
}

.seg-opt {
  display: inline-flex;
  align-items: center;
  padding: 0.4em 0.8em;
  font-size: var(--t-small);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.seg-opt + .seg-opt { border-left: var(--hair) solid var(--rule-strong); }

.seg-opt input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.seg-opt:has(input:checked) { background: var(--signal); color: var(--signal-ink); }
.seg-opt:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--signal); outline-offset: -2px; }

/* Honeypot: off-screen rather than display:none, which some bots skip. */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- tags and marks ---------------------------------------------------- */

.tag {
  display: inline-block;
  padding: 0.25em 0.6em;
  border: var(--hair) solid currentColor;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.tag--signal { color: var(--signal); }

.delta { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.delta--up { color: var(--up); }
.delta--down { color: var(--down); }

/* Strength meter: five ticks, filled to the score. */
.strength {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.strength i {
  display: block;
  width: 10px;
  height: 3px;
  background: var(--rule);
}

.strength i.on { background: var(--signal); }

/* --- skip link --------------------------------------------------------- */

/* Photography in the house style is black and white. */
.grayscale img { filter: grayscale(1) contrast(1.08); }

/* Available to screen readers, absent from the visual layout. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: var(--s-2);
  top: -4rem;
  z-index: 100;
  padding: 0.75em 1.2em;
  background: var(--ink);
  color: var(--paper);
  font-size: var(--t-small);
  text-decoration: none;
  transition: top var(--dur) var(--ease);
}

.skip:focus { top: var(--s-2); }

/* ==========================================================================
   Component: image-slot
   Aspect-ratio placeholder with a drawn diagonal, so an empty slot reads as
   intentional rather than broken.
   ========================================================================== */

.image-slot {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: var(--slot-ratio, 4 / 3);
  background: var(--paper-3);
  border: var(--hair) solid var(--rule);
  overflow: hidden;
}

.image-slot > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-slot--empty::before,
.image-slot--empty::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top right,
    transparent calc(50% - 0.5px),
    var(--rule) calc(50% - 0.5px),
    var(--rule) calc(50% + 0.5px),
    transparent calc(50% + 0.5px)
  );
}

.image-slot--empty::after { transform: scaleX(-1); }

.image-slot__label {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 1;
  padding: 0.4em 0.7em;
  background: var(--paper);
  border-top: var(--hair) solid var(--rule);
  border-right: var(--hair) solid var(--rule);
}

/* ==========================================================================
   Component: browser-window
   Chrome mock for the dashboard screenshot.
   ========================================================================== */

.browser {
  border: var(--hair) solid var(--rule-strong);
  background: var(--paper-2);
  overflow: hidden;
}

.browser__bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0.6rem 0.75rem;
  background: var(--paper-3);
  border-bottom: var(--hair) solid var(--rule);
}

.browser__dots {
  display: flex;
  gap: 6px;
  flex: none;
}

.browser__dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: var(--hair) solid var(--rule);
  background: var(--paper);
}

.browser__url {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.3em 0.75em;
  background: var(--paper);
  border: var(--hair) solid var(--rule);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser__body { padding: clamp(var(--s-2), 3vw, var(--s-4)); }

/* ==========================================================================
   Component: ios-frame
   Device shell with a dynamic island and a status bar. Sized by --device-w so
   the whole frame scales from one custom property.
   ========================================================================== */

.ios {
  --device-w: 20rem;
  --bezel: 0.75rem;

  position: relative;
  width: var(--device-w);
  max-width: 100%;
  aspect-ratio: 393 / 852;
  padding: var(--bezel);
  background: var(--ink);
  border-radius: calc(var(--device-w) * 0.14);
  box-shadow: 0 0 0 1px var(--rule-strong), 0 30px 60px -30px rgb(0 0 0 / 0.45);
  flex: none;
}

.ios__screen {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: calc(var(--device-w) * 0.1);
  overflow: hidden;
}

.ios__island {
  position: absolute;
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  width: 32%;
  height: 1.55rem;
  background: var(--ink);
  border-radius: 1rem;
  z-index: 3;
}

.ios__status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.1rem 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  z-index: 2;
}

.ios__status-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ios__battery {
  width: 22px;
  height: 11px;
  border: 1px solid currentColor;
  border-radius: 3px;
  position: relative;
  opacity: 0.9;
}

.ios__battery::before {
  content: '';
  position: absolute;
  inset: 1.5px;
  right: 6px;
  background: currentColor;
}

.ios__battery::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 3px;
  width: 2px;
  height: 5px;
  background: currentColor;
  border-radius: 0 1px 1px 0;
}

.ios__app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ios__home {
  flex: none;
  width: 36%;
  height: 4px;
  margin: 0.4rem auto 0.55rem;
  background: var(--ink);
  border-radius: 2px;
  opacity: 0.85;
}

@media (max-width: 34rem) {
  .ios { --device-w: 17.5rem; }
}

/* --- small utilities --------------------------------------------------- */
/* Deliberately few. Anything needed in more than three places earns a real
   component class instead. Inline style attributes are avoided throughout so
   the CSP can stay strict (see src/server.js). */

.title-block { margin-block: 0.75rem 1rem; }
.title-tight { margin-block-start: 0.75rem; }
.measure { max-width: 46ch; }
.rule--spaced { margin-block: 3rem 1.5rem; }

/* A lede sitting on the inverted band: inherit the band's colour rather than
   the light-ground --ink-2. */
.lede--inverted { color: inherit; opacity: 0.78; }
