/* Limerance design tokens and base styles.
   Source of truth for colour, type and spacing on every new screen.
   Light and dark twins follow the system; data-theme="light|dark" on <html> overrides. */

@import url("/static/fonts/fonts.css");

:root {
  color-scheme: light dark;

  --font-prose: "Spectral", Georgia, "Times New Roman", serif;
  --font-ui: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;

  /* light twin */
  --field: #ECE9E1;      /* the desk the sheet sits on */
  --sheet: #FBFAF7;      /* the paper */
  --sheet-edge: #DED9CE;
  --sheet-shadow: #E4E0D6;
  --tray: #E6E3DA;
  --ink: #1B1A17;
  --ink-2: #4A4843;      /* prose that steps back */
  --muted: #6C6A63;      /* labels, 4.6:1 on sheet */
  --faint: #9A978F;      /* hints, decoration only */
  --rule: #D5D1C6;
  --wash: #EFE8D2;       /* drag highlight */
  --white: #FFFFFF;

  /* thread palette, picked per thread by the writer */
  --thread-ultramarine: #2F3F9E;
  --thread-rust: #C2552A;
  --thread-moss: #3E7A4E;
  --thread-plum: #7A3E7A;
  --thread-ochre: #B08A1E;
  --thread-teal: #1F6F7A;

  --radius: 6px;
  --radius-pill: 18px;
  --prose-size: 21px;
  --prose-leading: 1.72;
  --sheet-pad-x: 104px;
  --sheet-pad-top: 88px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --field: #0F1113;
    --sheet: #16181B;
    --sheet-edge: #24272B;
    --sheet-shadow: transparent;
    --tray: #1B1E22;
    --ink: #ECE8DF;
    --ink-2: #A6A29A;
    --muted: #8E8B84;
    --faint: #5C5A54;
    --rule: #2A2D31;
    --wash: rgba(227, 199, 107, 0.18);
    --white: #0F1113;
    --thread-ultramarine: #7AA2FF;
    --thread-rust: #FF9A62;
    --thread-moss: #8FD694;
    --thread-plum: #D08BD0;
    --thread-ochre: #E3C76B;
    --thread-teal: #6FC7D2;
  }
}
:root[data-theme="dark"] {
  --field: #0F1113;
  --sheet: #16181B;
  --sheet-edge: #24272B;
  --sheet-shadow: transparent;
  --tray: #1B1E22;
  --ink: #ECE8DF;
  --ink-2: #A6A29A;
  --muted: #8E8B84;
  --faint: #5C5A54;
  --rule: #2A2D31;
  --wash: rgba(227, 199, 107, 0.18);
  --white: #0F1113;
  --thread-ultramarine: #7AA2FF;
  --thread-rust: #FF9A62;
  --thread-moss: #8FD694;
  --thread-plum: #D08BD0;
  --thread-ochre: #E3C76B;
  --thread-teal: #6FC7D2;
}

* { box-sizing: border-box; }
html { background: var(--field); }
body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* The sheet */
.lim-sheet {
  background: var(--sheet);
  border: 1px solid var(--sheet-edge);
  box-shadow: 0 1px 0 var(--sheet-shadow);
  padding: var(--sheet-pad-top) var(--sheet-pad-x) 120px;
  font-family: var(--font-prose);
  font-size: var(--prose-size);
  line-height: var(--prose-leading);
  color: var(--ink);
}
@media (max-width: 720px) {
  :root { --sheet-pad-x: 24px; --sheet-pad-top: 48px; --prose-size: 19px; }
}

/* Labels: small caps in the UI face */
.lim-label {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

/* Buttons. Every button and button-like link in the app is a .lim-pill,
   with at most one modifier. Pages set layout (margins, width) on their
   own classes, never the pill's padding, height or colours, so all
   buttons line up and look alike.
     .lim-pill            outlined, the default
     .lim-pill--solid     the one primary action in a group
     .lim-pill--quiet     no border, for low-key actions in dense UI
     .lim-pill--danger    destructive (delete, empty, forget)
     .lim-pill--small     30px tall, for chips and in-card actions
     .lim-pill--field     40px, beside a form field in the same row
     .lim-pill--large     48px, signed-out calls to action
   A pill holding an svg icon gets a little less left padding so the
   icon and label sit optically centred. */
.lim-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, opacity 120ms ease;
}
.lim-pill:has(> svg:first-child) { padding-left: 12px; }
.lim-pill svg { flex: none; }
.lim-pill:hover { background: var(--tray); border-color: var(--muted); }
.lim-pill:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.lim-pill[aria-pressed="true"], .lim-pill[aria-current="page"] { border-color: var(--ink); }
.lim-pill--solid { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.lim-pill--solid:hover { background: var(--ink); color: var(--sheet); border-color: var(--ink); opacity: 0.86; }
.lim-pill--quiet { border-color: transparent; background: transparent; color: var(--muted); }
.lim-pill--quiet:hover { background: var(--tray); border-color: transparent; color: var(--ink); }
.lim-pill--danger { color: var(--thread-rust); }
.lim-pill--danger:hover { border-color: var(--thread-rust); }
.lim-pill--small { height: 30px; padding: 0 12px; font-size: 12px; gap: 6px; }
/* --field matches a .lim-input's 40px, for a button in the same row as a
   field; --large is the call to action on the signed-out pages. */
.lim-pill--field { height: 40px; }
.lim-pill--large { height: 48px; padding: 0 24px; font-size: 15px; }
.lim-pill:disabled, .lim-pill[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* Form fields. Inputs, selects and textareas share one look: 40px tall
   (textareas grow), the same border, radius and focus ring. */
.lim-input, .lim-select, .lim-textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.4;
}
.lim-input, .lim-select { height: 40px; }
.lim-textarea { padding: 10px 12px; min-height: 80px; resize: vertical; }
/* The select draws its own chevron in the text colour (two gradient
   triangles, so it follows dark mode), instead of the browser's arrow. */
.lim-select {
  padding-right: 34px;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
}
.lim-input::placeholder, .lim-textarea::placeholder { color: var(--faint); }
.lim-input:focus, .lim-select:focus, .lim-textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--wash); }
.lim-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lim-field > .lim-label { display: block; }

/* Ink brackets around a clicked sentence */
.lim-bracket-open, .lim-bracket-close {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  border: 1.5px solid var(--ink);
  vertical-align: -0.2em;
}
.lim-bracket-open { border-right: 0; margin-right: 6px; }
.lim-bracket-close { border-left: 0; margin-left: 6px; }

/* Warm wash for a drag-selected span */
.lim-wash { background: var(--wash); box-shadow: 0 0 0 4px var(--wash); border-radius: 2px; }

/* The drifting position dot */
.lim-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); opacity: 0.35; }

/* Fork marker */
.lim-fork { display: inline-block; width: 8px; height: 8px; border: 2px solid var(--thread, var(--ink)); background: var(--sheet); transform: rotate(45deg); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Utility: hide an element completely. Trays and popovers on every page use it. */
.hidden { display: none !important; }
