@layer reset, base, components, utilities, native;

/* Pinboard, from the Paper design: a warm paper page, keeps on soft sand cards, the newest pinned ones on colored
   cards with a slight tilt, near-black ink, Inclusive Sans for words and JetBrains Mono for labels and dates.
   Each keep has one of six colors, for its pinned card and the top of its page */
:root {
  color-scheme: light dark;

  --color-paper: #fbfaf4;
  --color-card: #f2f1eb;
  --color-surface: #fbfaf4;
  --color-ink: #0e1113;
  --color-ink-secondary: #57606a;
  --color-ink-tertiary: #6b737a;
  /* Too faint for text, so only for separators and other marks */
  --color-ink-muted: rgb(14 17 19 / 45%);
  --color-ink-label: rgb(14 17 19 / 72%);
  --color-ink-placeholder: #57606a;
  --color-ink-reading: #0e1113;
  --color-ink-tag: #0e1113;
  --color-ink-chip: #0e1113;
  --color-line: rgb(14 17 19 / 10%);
  --color-line-card: rgb(14 17 19 / 10%);
  --color-line-strong: #0e1113;
  --color-well: rgb(14 17 19 / 5%);
  --color-well-strong: rgb(14 17 19 / 7%);
  --color-well-hover: rgb(14 17 19 / 9%);
  --color-thumb: rgb(14 17 19 / 6%);
  --color-tag: transparent;
  --color-filter: #0e1113;
  --color-filter-ink: #fbfaf4;
  /* The list's band: the cards' sand, with the page's paper for its chips */
  --color-band: #f2f1eb;
  --color-band-chip: #fbfaf4;
  --color-coral: #db704c;
  /* Coral deep enough for small text */
  --color-coral-text: #b0452a;
  --color-coral-wash: #f8e2d9;
  --color-note: rgb(14 17 19 / 5%);
  --color-note-ink: #0e1113;
  --color-button: #0e1113;
  --color-button-hover: #2b3135;
  --color-button-ink: #fbfaf4;
  --color-selection: #c3d3ce;

  /* The twelve keep colors, like Fizzy's card colors: three lightnesses, dark, mid, and pale, in four hues
     each, at the chroma that keeps them dusty enough to sit together. Entry::COLORS has the order pins take
     them in */
  --tint-teal: oklch(40.8% 0.058 214);
  --tint-ink-blue: oklch(40% 0.045 258);
  --tint-plum: oklch(40% 0.055 345);
  --tint-umber: oklch(40.5% 0.045 60);
  --tint-terracotta: oklch(66.5% 0.135 39);
  --tint-ochre: oklch(73.5% 0.095 80);
  --tint-heather: oklch(70.5% 0.045 300);
  --tint-lichen: oklch(71.5% 0.065 132);
  --tint-sage: oklch(85.3% 0.022 172);
  --tint-mist: oklch(85.5% 0.028 238);
  --tint-sand: oklch(85.9% 0.02 86);
  --tint-blush: oklch(86% 0.035 25);
  /* A pinned keep's star, gold on every surface and in dark mode too */
  --color-star: #f5bf2a;
  --tint-ink-dark: #0e1113;
  --tint-ink-light: #fbfaf4;

  --shadow-pin: 0 20px 60px rgb(0 0 0 / 12%);
  --shadow-picture: 0 24px 64px rgb(0 0 0 / 18%);
  --shadow-sticker: 0 14px 36px rgb(0 0 0 / 16%);
  --shadow-card: none;
  --shadow-control: none;
  --shadow-popup: 0 1px 2px rgb(0 0 0 / 8%), 0 14px 36px -8px rgb(0 0 0 / 22%);

  --font-sans: "Inclusive Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  /* Type sizes in points. In the iOS app a point follows the reader's Dynamic Type size (see below), so all
     text scales together; in a browser a point is a pixel */
  --pt: calc(1rem / 16);
  --text-heading: calc(40 * var(--pt));
  --text-hero: calc(120 * var(--pt));
  --text-pin-title: calc(34 * var(--pt));
  --text-card-title: calc(24 * var(--pt));
  --text-point: calc(21 * var(--pt));
  --text-button: calc(18 * var(--pt));
  --text-prose: calc(18 * var(--pt));
  --text-detail: calc(17 * var(--pt));
  --text-pin-body: calc(17 * var(--pt));
  --text-card-body: calc(16 * var(--pt));
  --text-spec: calc(16 * var(--pt));
  --text-control: calc(16 * var(--pt));
  --text-source: calc(14 * var(--pt));
  --text-label: calc(12 * var(--pt));
  --text-small: calc(11 * var(--pt));

  /* Kept for the dialogs, menus, and sign-in pages, which the design doesn't cover */
  --text-title: calc(26 * var(--pt));
  --text-detail-title: calc(24 * var(--pt));
  --text-section: calc(18 * var(--pt));
  --text-lead: calc(15 * var(--pt));
  --text-body: calc(14 * var(--pt));
  --text-meta: calc(12 * var(--pt));
  --text-tag: calc(12 * var(--pt));
  --text-filter: calc(12 * var(--pt));

  --radius-card: 24px;
  --radius-panel: 32px;
  --radius-thumb: 12px;
  --radius-filter: 12px;
  --radius-button: 16px;

  --page-width: 1172px;
  --reading-width: 720px;
  --page-padding: 32px;
  --filter-height: 36px;
  --chip-height: 28px;
  --thumb-size: 56px;

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

  /* The phone sizes from the iOS screens */
  @media (max-width: 699px) {
    --text-heading: calc(30 * var(--pt));
    --text-hero: calc(68 * var(--pt));
    --text-pin-title: calc(30 * var(--pt));
    --text-card-title: calc(19 * var(--pt));
    --text-point: calc(19 * var(--pt));
    --text-prose: calc(16 * var(--pt));
    --text-pin-body: calc(16 * var(--pt));
    --text-card-body: calc(15 * var(--pt));
    --text-spec: calc(15 * var(--pt));
    --page-padding: 20px;
    --filter-height: 40px;
    --thumb-size: 52px;
  }

  /* Not in the design: the same warm page at night, keeping each keep's own color */
  @media (prefers-color-scheme: dark) {
    --color-paper: #121412;
    --color-card: #1c1e1c;
    --color-surface: #1c1e1c;
    --color-ink: #f2f1eb;
    --color-ink-secondary: #a8aeb2;
    --color-ink-tertiary: #959ba0;
    --color-ink-muted: rgb(242 241 235 / 40%);
    --color-ink-label: rgb(242 241 235 / 70%);
    --color-ink-placeholder: #a8aeb2;
    --color-ink-reading: #f2f1eb;
    --color-ink-tag: #f2f1eb;
    --color-ink-chip: #f2f1eb;
    --color-line: rgb(242 241 235 / 12%);
    --color-line-card: rgb(242 241 235 / 12%);
    --color-line-strong: #f2f1eb;
    --color-well: rgb(242 241 235 / 7%);
    --color-well-strong: rgb(242 241 235 / 10%);
    --color-well-hover: rgb(242 241 235 / 13%);
    --color-thumb: rgb(242 241 235 / 8%);
    --color-filter: #f2f1eb;
    --color-filter-ink: #121412;
    --color-band: #1c1e1c;
    --color-band-chip: #121412;
    --color-coral-text: #ec8c6c;
    --color-coral-wash: #3a2219;
    --color-note: rgb(242 241 235 / 7%);
    --color-note-ink: #f2f1eb;
    --color-button: #f2f1eb;
    --color-button-hover: #ffffff;
    --color-button-ink: #121412;
    --color-selection: #3e504b;

    --shadow-pin: 0 20px 60px rgb(0 0 0 / 45%);
    --shadow-picture: 0 24px 64px rgb(0 0 0 / 50%);
    --shadow-sticker: 0 14px 36px rgb(0 0 0 / 45%);
    --shadow-popup: 0 1px 2px rgb(0 0 0 / 40%), 0 14px 36px -8px rgb(0 0 0 / 60%);
  }
}

/* In the iOS app the page's base size is the reader's Dynamic Type body size, 17 at the default setting, so a
   point stays a point there and grows with larger text */
@supports (font: -apple-system-body) {
  :root:has(body[data-hotwire-native="true"]) {
    --pt: calc(1rem / 17);

    font: -apple-system-body;
  }
}
