/* ═══════════════════════════════════════════════════════════
   1718 Coffee — design tokens

   Type:  Clash Display (headings) · Satoshi (UI) · JetBrains Mono (labels)
   No serif, no italics anywhere.

   Both themes define the SAME variable names, so every component is
   written once. `--bg` reads as "app background", not "dark".
   ═══════════════════════════════════════════════════════════ */

/* Dark is graphite rather than black. The old palette sat at #0B0B0C with
   panels at #141416 — six points of separation, so cards dissolved into the
   page and every screen read as one flat sheet. These greys are lifted and
   spaced far enough apart that a card is legible as an object, which is what
   makes the frosted panels and the page wash below read as depth. */
:root,
:root[data-theme="dark"]{
  --bg:#141416;          /* page base — the wash in --page-grad sits over it */
  --surface:#232327;     /* cards, panels, bars */
  --surface-2:#2B2B30;   /* inputs, wells */
  --surface-3:#35353B;   /* raised chips, hover */
  --line:rgba(255,255,255,.08);
  --line-2:rgba(255,255,255,.16);

  --fg:#F4F4F3;          /* primary text  — 15.9:1 on --surface */
  --fg-2:#ADADA9;        /* secondary     —  6.9:1 */
  --fg-3:#7E7E82;        /* tertiary      —  4.5:1, still AA */

  /* Two tokens rather than one, because a gradient cannot be a text colour.
   * --accent carries every icon, border and label; --accent-grad fills the
   * things that are blocks of colour — buttons, the add control, the active
   * pill. The ramp is deep enough end to end for white text on it. */
  /* The 1718 teal (from the club card): a deep teal falling to near-black
     green. On a dark page the flat --accent is lifted so text and icons in it
     stay legible; blocks of colour use the real, deep gradient with white
     text on top. */
  --accent:#5DBFB2;      /* actions, active state, text on dark */
  --accent-ink:#FFFFFF;  /* text ON the gradient — deep enough for white */
  --accent-grad:linear-gradient(140deg,#1F6964 0%,#11504B 52%,#093532 100%);
  --accent-soft:rgba(93,191,178,.15);
  --accent-line:rgba(93,191,178,.45);
  /* A solid block of the accent with --accent-ink on it (an active chip, a
     tab, the toast): deep enough that white text clears 5:1, where the lifted
     --accent above is for text and icons on the dark page. */
  --accent-fill:#1F7A72;
  --gold:#D8B988;        /* the club card's gold — highlights only */

  --warn:#F5A623;
  --warn-soft:rgba(245,166,35,.14);
  --danger:#F4655A;
  --danger-soft:rgba(244,101,90,.14);
  --info:#63A2FF;
  --info-soft:rgba(99,162,255,.14);

  --shadow:0 16px 44px rgba(0,0,0,.5);
  --shadow-sm:0 3px 14px rgba(0,0,0,.36);
  --scrim:rgba(0,0,0,.72);
  --reveal:#EDEDEA;      /* the plate a slat wipe resolves to */

  /* The page wash: grey at the top shoulder, black at the foot, with a green
     bloom behind where the content starts. Fixed, so it stays put while a
     long menu scrolls over it rather than sliding away with the cards. */
  --page-grad:
    radial-gradient(1100px 560px at 82% -8%, rgba(31,105,100,.16), transparent 62%),
    radial-gradient(820px 460px at 8% 4%, rgba(255,255,255,.05), transparent 64%),
    linear-gradient(180deg, #212125 0%, #18181B 46%, #0E0E10 100%);
  --page-grain:.032;     /* the tooth over the wash */
  color-scheme:dark;
}

:root[data-theme="light"]{
  --bg:#F7F7F5;
  --surface:#FFFFFF;
  --surface-2:#F2F2EF;
  --surface-3:#E7E7E3;
  --line:rgba(16,16,14,.10);
  --line-2:rgba(16,16,14,.20);

  --fg:#16160F;          /* 16.9:1 on --bg */
  --fg-2:#55554E;        /*  7.6:1 */
  --fg-3:#7C7C74;        /*  4.6:1 */

  --accent:#11504B;      /* the 1718 teal — white on it passes AA */
  --accent-ink:#FFFFFF;
  --accent-grad:linear-gradient(140deg,#1F6964 0%,#11504B 52%,#093532 100%);
  --accent-soft:rgba(17,80,75,.10);
  --accent-line:rgba(17,80,75,.34);
  --accent-fill:#11504B;
  --gold:#B08C52;        /* the club card's gold, deepened for a light page */

  --warn:#9A5B00;
  --warn-soft:rgba(154,91,0,.11);
  --danger:#C0362B;
  --danger-soft:rgba(192,54,43,.10);
  --info:#1F55B8;
  --info-soft:rgba(31,85,184,.10);

  --shadow:0 12px 34px rgba(28,26,20,.13);
  --shadow-sm:0 2px 10px rgba(28,26,20,.09);
  --scrim:rgba(24,24,20,.46);
  --reveal:#16160F;

  /* Light keeps its paper feel — the same wash at these values would turn it
     grey and muddy, so it gets a whisper of one and no grain at all. */
  --page-grad:
    radial-gradient(1000px 520px at 84% -6%, rgba(17,80,75,.055), transparent 62%),
    linear-gradient(180deg, #FBFBF9 0%, #F5F5F2 100%);
  --page-grain:0;
  color-scheme:light;
}

:root{
  --ease:cubic-bezier(.16,1,.3,1);
  --tap:120ms;                     /* interaction feedback budget */

  --display:'Clash Display','Satoshi',system-ui,-apple-system,'Segoe UI',sans-serif;
  --sans:'Satoshi','Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
  --mono:'JetBrains Mono',ui-monospace,'SFMono-Regular',Consolas,monospace;

  --r-sm:8px;
  --r:12px;
  --r-lg:18px;
  --r-xl:26px;
  --rail:84px;
}

*{margin:0;padding:0;box-sizing:border-box;}

html{
  background:var(--bg);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  -webkit-text-size-adjust:100%;
}

/* The wash and its tooth.
 *
 * Both are pinned layers behind everything: the gradient on body::after, the
 * grain on body::before. Not `background-attachment:fixed` — Safari and
 * Chrome on macOS repaint a fixed background on every scroll frame, and the
 * page visibly shudders as you scroll. A position:fixed layer promoted with
 * translateZ(0) is painted once and only moved by the compositor. Attaching
 * the gradient to the scroll instead would drag the bloom off the top of a
 * long menu, and painting the grain into each panel would tile it at a
 * different offset in every one. Negative z-index keeps both under content
 * without needing a stacking context on anything else. */
body{
  background:var(--bg);
  color:var(--fg);
  font-family:var(--sans);
  font-size:15px;
  line-height:1.5;
  /* 100vh on a phone means "viewport with the URL bar hidden", so a fixed
     app shell gets pushed under the browser chrome and the bottom nav ends
     up off screen. dvh tracks the space that is actually visible. */
  height:100vh;
  height:100dvh;
  overflow:hidden;                 /* the shell owns scrolling */
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
  overscroll-behavior:none;
}

body::after{
  content:'';position:fixed;inset:0;z-index:-2;pointer-events:none;
  background-image:var(--page-grad);background-repeat:no-repeat;background-size:cover;
  transform:translateZ(0);
}
body::before{
  content:'';position:fixed;inset:0;z-index:-1;pointer-events:none;
  transform:translateZ(0);
  opacity:var(--page-grain);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)'/%3E%3C/svg%3E");
  background-size:180px 180px;
}

a{color:inherit;text-decoration:none;}
button{font:inherit;background:none;border:none;color:inherit;cursor:pointer;}
input,select,textarea{font:inherit;background:none;border:none;color:inherit;outline:none;}
img{display:block;max-width:100%;}
::selection{background:var(--accent-fill);color:var(--accent-ink);}

h1,h2,h3,h4{font-family:var(--display);font-weight:600;letter-spacing:-.022em;line-height:1.1;}

/* the micro-label used throughout */
.mono{
  font-family:var(--mono);
  font-size:.66rem;
  font-weight:500;
  letter-spacing:.11em;
  text-transform:uppercase;
}

:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:4px;}

*::-webkit-scrollbar{width:9px;height:9px;}
*::-webkit-scrollbar-track{background:transparent;}
*::-webkit-scrollbar-thumb{background:var(--surface-3);border-radius:5px;}
*::-webkit-scrollbar-thumb:hover{background:var(--line-2);}

.hidden{display:none !important;}

/* ══════ THEME TOGGLE ══════ */
.theme-btn{
  width:36px;height:36px;border-radius:50%;flex:none;
  display:grid;place-items:center;color:var(--fg-2);
  border:1px solid var(--line);background:var(--surface-2);
  transition:color var(--tap) var(--ease),background var(--tap) var(--ease),
             transform var(--tap) var(--ease);
}
.theme-btn:active{transform:scale(.9);}
.theme-btn:hover{color:var(--fg);}
.theme-btn svg{width:17px;height:17px;stroke:currentColor;fill:none;
  stroke-width:1.7;stroke-linecap:round;}
.theme-btn .i-sun{display:none;}
:root[data-theme="light"] .theme-btn .i-sun{display:block;}
:root[data-theme="light"] .theme-btn .i-moon{display:none;}

/* Colours cross-fade on a theme flip; transforms stay instant. */
.theming *,.theming *::before,.theming *::after{
  transition:background-color .3s var(--ease),border-color .3s var(--ease),
             color .3s var(--ease),fill .3s var(--ease) !important;
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
  }
}
