/* Loxworth Data Room: design tokens and base styles. Every value here is a decision: change it here, not in a page.
   docs/UI-GUIDELINE.md (section 17) says what each token is for; docs/design/v2/DIRECTION.md says why.
   Regions are told apart by tone, not boxes: --paper the page, --paper-2 one step back, --paper-3 pressed.
   --forest is the one accent (gold in the dark theme). Two shadows only: --lift-1 and --lift-2.
   Widths: phone up to 640px, tablet up to 1024px, read from the app's own width (@container app); pages
   without the app frame (sign-in, share links) use @media at the same widths. */

@font-face { font-family: "Sofia Pro"; src: url("/public/fonts/sofia-pro-300.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Sofia Pro"; src: url("/public/fonts/sofia-pro-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Sofia Pro"; src: url("/public/fonts/sofia-pro-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("/public/fonts/fraunces-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

/* theme:light */
:root {
  color-scheme: light;
  /* Surfaces: paper tinted toward the forest, not beige. Three steps: the page, one step back, pressed. */
  --paper: #fbfbf8;        /* the page */
  --paper-2: #f3f4ef;      /* one step back: the detail panel, the search box, home tiles */
  --paper-3: #e7eae2;      /* pressed, the segmented track, the preview well */
  --hover: #f0f2ec;        /* a row or a quiet button under the pointer */
  --line: #e6e8e1;         /* hairlines inside a table */
  --line-strong: #d3d8cd;  /* edges of secondary buttons and chips */
  --field: #ffffff;        /* inside a text box */
  --field-edge: #87927f;   /* the edge of a text box: 3 to 1 against the page */
  --raised: #ffffff;       /* menus, dialogs, sheets */
  --tile: #f1f3ed;         /* a button tile on a phone sheet */

  /* Ink: forest, never pure black. */
  --ink: #142219;
  --ink-2: #48544b;        /* secondary text */
  --ink-3: #66726a;        /* captions, column heads */

  /* One accent, used for the thing to do next. */
  --forest: #1d4a33;
  --forest-press: #163b28;
  --on-accent: #ffffff;    /* text on the accent */
  --accent-soft: #e2ece4;  /* a selected row, the drop target */
  --accent-line: #8fb39b;
  --gold: #c9a24e;         /* brand mark and rare emphasis only */
  --gold-ink: #7a5c1a;

  /* Meaning. Muted on purpose; state is carried by words as well as colour. */
  --ok: #24663f;
  --ok-bg: #e3efe6;
  --warn: #8a5a0c;
  --warn-bg: #f6eed8;
  --stop: #a3321f;
  --stop-bg: #f8e6e1;
  --select: #d5e5d9;       /* selected text */
  --stage: #101a14;        /* behind a file being looked at */
  --veil: rgba(16, 30, 22, 0.36);

  /* Elevation: two levels, tinted toward the forest, one light from above. */
  --lift-1: 0 1px 2px rgba(20, 34, 25, 0.06), 0 8px 20px -6px rgba(20, 34, 25, 0.16);
  --lift-2: 0 2px 6px rgba(20, 34, 25, 0.08), 0 28px 56px -16px rgba(20, 34, 25, 0.32);
  --mark-ring: rgba(255, 255, 255, 0.14);
  --chart: #1d4a33;
  --chart-soft: rgba(29, 74, 51, 0.1);
  --focus-ring: rgba(29, 74, 51, 0.16);
  --tap: rgba(29, 74, 51, 0.08);

  /* The left rail: forest, the brand's own colour, in both themes. */
  --rail: #183a2a;
  --rail-ink: #e6ede6;
  --rail-ink-2: #a3b8aa;
  --rail-hover: rgba(255, 255, 255, 0.06);
  --rail-current: rgba(255, 255, 255, 0.11);
  --rail-line: rgba(255, 255, 255, 0.09);

  /* File and folder glyphs: a page with a coloured label, a sage folder. */
  --g-page: #ffffff;
  --g-edge: #c3cabe;
  --folder: #9fb3a4;
  --folder-tab: #7f9886;
  --folder-badge: #1d4a33;

  /* People: six muted grounds for initials, each with its ink. */
  --p1: #dfe9df;
  --p1-ink: #1d4a33;
  --p2: #e5e3f1;
  --p2-ink: #3f3a78;
  --p3: #f3e4d6;
  --p3-ink: #7a4313;
  --p4: #dde9f1;
  --p4-ink: #1f4f73;
  --p5: #f1dfe4;
  --p5-ink: #7a2440;
  --p6: #ece7d3;
  --p6-ink: #5e5120;

  /* File kinds: the coloured label on a file glyph, so a list can be scanned by kind. */
  --k-pdf: #c2412d;
  --k-doc: #2f63b0;
  --k-sheet: #1f7a4a;
  --k-slides: #c46a1a;
  --k-image: #7d4fb0;
  --k-video: #b03b73;
  --k-sound: #1f7281;
  --k-archive: #8a7448;
  --k-mail: #2f63b0;
  --k-code: #4f5a8c;
  --k-drawing: #94631a;
  --k-font: #66726a;
}
/* theme:end */

/* The dark theme, built from the brand: deep forest, paper text, gold for the thing to do next.
   It follows the computer's setting unless the person chose a theme in Settings. The two blocks
   below must stay the same; a test compares them. */
/* theme:dark */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121a15;
  --paper-2: #17201a;
  --paper-3: #1e2923;
  --hover: #1a241e;
  --line: #222d26;
  --line-strong: #33423a;
  --field: #0e1511;
  --field-edge: #5f6e64;
  --raised: #19231d;
  --tile: #233029;
  --ink: #eef0e8;
  --ink-2: #b7c0b7;
  --ink-3: #8d998f;
  --forest: #d6b468;
  --forest-press: #e3c582;
  --on-accent: #142219;
  --accent-soft: #1f3428;
  --accent-line: #4d6e58;
  --gold: #d6b468;
  --gold-ink: #e3c582;
  --ok: #8fd0a6;
  --ok-bg: #183026;
  --warn: #e8c67c;
  --warn-bg: #362c14;
  --stop: #f2a594;
  --stop-bg: #3e1f19;
  --select: #2f4f3d;
  --stage: #0a110d;
  --veil: rgba(0, 0, 0, 0.55);
  --lift-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 20px -6px rgba(0, 0, 0, 0.5);
  --lift-2: 0 2px 6px rgba(0, 0, 0, 0.4), 0 28px 56px -16px rgba(0, 0, 0, 0.7);
  --mark-ring: #33423a;
  --chart: #6fa984;
  --chart-soft: rgba(111, 169, 132, 0.14);
  --focus-ring: rgba(214, 180, 104, 0.28);
  --tap: rgba(214, 180, 104, 0.12);
  --rail: #0a0f0c;
  --rail-ink: #e4eae3;
  --rail-ink-2: #8c9d92;
  --rail-hover: rgba(255, 255, 255, 0.04);
  --rail-current: rgba(255, 255, 255, 0.08);
  --rail-line: rgba(255, 255, 255, 0.06);
  --g-page: #26302a;
  --g-edge: #4a584f;
  --folder: #5f7867;
  --folder-tab: #4a6153;
  --folder-badge: #d6b468;
  --p1: #23392c;
  --p1-ink: #b9dcc4;
  --p2: #2c2a44;
  --p2-ink: #c9c4f0;
  --p3: #3a2c1f;
  --p3-ink: #efc69b;
  --p4: #1f3242;
  --p4-ink: #a9cdec;
  --p5: #3c2129;
  --p5-ink: #f0b3c4;
  --p6: #35301c;
  --p6-ink: #e4d69c;
  --k-pdf: #f08a76;
  --k-doc: #86b2ee;
  --k-sheet: #7fcf9c;
  --k-slides: #eda766;
  --k-image: #c4a0e8;
  --k-video: #ea98c0;
  --k-sound: #7ccbd8;
  --k-archive: #cdb98a;
  --k-mail: #86b2ee;
  --k-code: #aab3e6;
  --k-drawing: #e3b565;
  --k-font: #8d998f;
}
/* theme:end */
@media (prefers-color-scheme: dark) {
  /* theme:dark-auto */
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #121a15;
    --paper-2: #17201a;
    --paper-3: #1e2923;
    --hover: #1a241e;
    --line: #222d26;
    --line-strong: #33423a;
    --field: #0e1511;
    --field-edge: #5f6e64;
    --raised: #19231d;
    --tile: #233029;
    --ink: #eef0e8;
    --ink-2: #b7c0b7;
    --ink-3: #8d998f;
    --forest: #d6b468;
    --forest-press: #e3c582;
    --on-accent: #142219;
    --accent-soft: #1f3428;
    --accent-line: #4d6e58;
    --gold: #d6b468;
    --gold-ink: #e3c582;
    --ok: #8fd0a6;
    --ok-bg: #183026;
    --warn: #e8c67c;
    --warn-bg: #362c14;
    --stop: #f2a594;
    --stop-bg: #3e1f19;
    --select: #2f4f3d;
    --stage: #0a110d;
    --veil: rgba(0, 0, 0, 0.55);
    --lift-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 20px -6px rgba(0, 0, 0, 0.5);
    --lift-2: 0 2px 6px rgba(0, 0, 0, 0.4), 0 28px 56px -16px rgba(0, 0, 0, 0.7);
    --mark-ring: #33423a;
    --chart: #6fa984;
    --chart-soft: rgba(111, 169, 132, 0.14);
    --focus-ring: rgba(214, 180, 104, 0.28);
    --tap: rgba(214, 180, 104, 0.12);
    --rail: #0a0f0c;
    --rail-ink: #e4eae3;
    --rail-ink-2: #8c9d92;
    --rail-hover: rgba(255, 255, 255, 0.04);
    --rail-current: rgba(255, 255, 255, 0.08);
    --rail-line: rgba(255, 255, 255, 0.06);
    --g-page: #26302a;
    --g-edge: #4a584f;
    --folder: #5f7867;
    --folder-tab: #4a6153;
    --folder-badge: #d6b468;
    --p1: #23392c;
    --p1-ink: #b9dcc4;
    --p2: #2c2a44;
    --p2-ink: #c9c4f0;
    --p3: #3a2c1f;
    --p3-ink: #efc69b;
    --p4: #1f3242;
    --p4-ink: #a9cdec;
    --p5: #3c2129;
    --p5-ink: #f0b3c4;
    --p6: #35301c;
    --p6-ink: #e4d69c;
    --k-pdf: #f08a76;
    --k-doc: #86b2ee;
    --k-sheet: #7fcf9c;
    --k-slides: #eda766;
    --k-image: #c4a0e8;
    --k-video: #ea98c0;
    --k-sound: #7ccbd8;
    --k-archive: #cdb98a;
    --k-mail: #86b2ee;
    --k-code: #aab3e6;
    --k-drawing: #e3b565;
    --k-font: #8d998f;
  }
  /* theme:end */
}

:root {
  --font: "Sofia Pro", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* The same in both themes: the brand green behind a company without its own colour, the white
     behind logos, QR codes and pages of a document, and the text on the dark stage. */
  --brand-green: #1d4a33;
  --white: #ffffff;
  --stage-ink: #f3efe2;

  /* Type scale. Contrast comes from size, not from bold everywhere: big titles, 14px work text, 12 and 13 for
     what is secondary. Fraunces (--t-40 italic) is a signature for three moments only: signing in, an empty
     folder, and the drop. */
  --t-xs: 0.75rem;         /* 12 column heads, captions */
  --t-sm: 0.8125rem;       /* 13 secondary columns, metadata, breadcrumbs */
  --t-md: 0.875rem;        /* 14 rows and body on a computer, buttons, tabs */
  --t-16: 1rem;            /* 16 section headings, phone rows, every input */
  --t-lg: 1.125rem;        /* 18 the detail panel's file name, dialog titles */
  --t-title: 1.25rem;      /* 20 an empty screen */
  --t-22: 1.375rem;        /* 22 a page title on a phone */
  --t-xl: 1.5rem;          /* 24 a key figure */
  --t-28: 1.75rem;         /* 28 page and folder titles */
  --t-2xl: 2rem;           /* 32 a code to copy by hand */
  --t-40: 2.5rem;          /* 40 Fraunces italic: sign in, an empty folder, the drop */

  /* Spacing: multiples of 4. */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* Radius by role. Nothing rounder, except a count in a pill and an avatar. */
  --r-s: 4px;              /* tags, inner parts */
  --r-control: 6px;        /* rows, rail items, chips */
  --r-m: 8px;              /* buttons, fields, menus, the search box */
  --r-panel: 10px;         /* the phone's sheet */
  --r-l: 12px;             /* dialogs, tiles, the preview well */
  --r-xl: 16px;            /* the drop zone of an empty folder */
  --r-pill: 999px;

  /* Icons: three sizes. */
  --ic-s: 16px;
  --ic-m: 20px;
  --ic-l: 24px;

  /* The page frame: content uses the full width up to --frame, then centres, with --gut at each side. */
  --frame: 1680px;
  --gut: 32px;
  --edge: max(var(--gut), calc((100% - var(--frame)) / 2));
  --rail-w: 248px;         /* the forest rail */
  --panel-w: 360px;        /* the detail panel */
  --top-h: 56px;           /* the top bar, and the head of the detail panel beside it */
  --crumb: 20px;           /* the breadcrumb's line above a title, kept on every page so titles sit level */
  --row: 40px;             /* list row height on a computer (files.js rowHeight says the same) */
  --row-touch: 60px;       /* on a phone */
  --tr: 44px;              /* a line in a table of people, links, sign-ins */
  --hit: 44px;             /* the least a finger can be asked to hit */

  /* Motion: three durations and two curves. Quick for a press, the middle one for things that
     arrive or leave, the long one for a sheet or a tick drawing itself. The second curve settles
     like something with a little weight; it never passes its target by more than two in a hundred. */
  --m1: 120ms;
  --m2: 200ms;
  --m3: 320ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --spring: cubic-bezier(0.3, 1.06, 0.5, 1);
  --quick: var(--m1);      /* the names the first screens used */
  --calm: var(--m2);
  /* The v2 motion names: a press, something small arriving (a menu, a checkbox), something moving in
     (the detail panel, a dialog), and a sheet or the drop zone opening. What leaves uses --ease-in at
     about 70% of the time it took to arrive. */
  --m-press: 90ms;
  --m-fast: 140ms;
  --m-move: 220ms;
  --m-sheet: 300ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
}
/* Compact: more rows on the screen for people who live in long lists. */
:root[data-density="compact"] { --row: 32px; --tr: 36px; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: var(--tap); scrollbar-color: var(--line-strong) var(--paper); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-md)/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--t-28); font-weight: 600; letter-spacing: -0.022em; line-height: 1.15; }
h2 { font-size: var(--t-lg); font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
a { color: var(--forest); text-underline-offset: 2px; }
a:hover { color: var(--forest-press); }
button, a, input, select, textarea, label, summary { touch-action: manipulation; }
button { font-family: var(--font); }
::selection { background: var(--select); }

/* Focus, one system. Buttons and links: one ring, keyboard only. Fields: the border turns to the accent
   with one soft halo; the transparent outline is what Windows' high-contrast mode draws instead. */
:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.field:focus-visible, .search input:focus-visible, .fpick :focus-visible {
  outline: 2px solid transparent; outline-offset: 0;
  border-color: var(--forest); box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Buttons: one family in three heights (.btn-sm and .btn-lg are in app.css with the places that use them).
   Primary is the one thing to do next; quiet is text only. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 var(--s4);
  border: 1px solid var(--line-strong); border-radius: var(--r-m);
  background: var(--raised); color: var(--ink);
  font: 600 var(--t-md)/1 var(--font); white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color var(--m-press) linear, border-color var(--m-press) linear, transform var(--m-press) var(--ease-out);
}
.btn .ic { width: 18px; height: 18px; }
.btn:hover { background: var(--hover); color: var(--ink); }
.btn:active { background: var(--paper-3); transform: scale(0.97); }
.btn[aria-pressed="true"] { background: var(--paper-3); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--forest); border-color: transparent; color: var(--on-accent); }
.btn-primary:hover { background: var(--forest-press); border-color: transparent; color: var(--on-accent); }
.btn-primary:active { background: var(--forest-press); }
.btn-quiet { border-color: transparent; background: none; color: var(--ink-2); }
.btn-stop { color: var(--stop); }
.btn-stop:hover { background: var(--stop-bg); }

.field {
  width: 100%; height: 40px; padding: 0 var(--s3);
  border: 1px solid var(--field-edge); border-radius: var(--r-m);
  background: var(--field); color: var(--ink); font: 400 1rem/1 var(--font); /* 16px stops phones zooming in */
  transition: border-color var(--m1) var(--ease), box-shadow var(--m1) var(--ease);
}

/* Touch, every page: fields 44px high (F3); a button's tap grows to 44 by 44 (T1). */
@media (pointer: coarse) {
  .field:not(textarea) { height: var(--hit); }
  .btn { position: relative; }
  .btn::after { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, var(--hit)); height: max(100%, var(--hit)); transform: translate(-50%, -50%); }
}

/* The Loxworth lockup as drawn (emblem and name), then the product name in the same typeface.
   The lockup comes in two inks; the page shows the one that reads on its background. */
.wordmark { display: inline-flex; align-items: center; gap: var(--s3); color: var(--ink); text-decoration: none; white-space: nowrap; }
.wordmark img { height: 26px; width: auto; flex: none; }
.wordmark i { padding-left: var(--s3); border-left: 1px solid var(--line-strong); color: var(--ink-2); font: normal 300 1.0625rem/26px var(--font); letter-spacing: 0.01em; }
.on-dark { display: none; }
:root[data-theme="dark"] .on-dark { display: inline; }
:root[data-theme="dark"] .on-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .on-dark { display: inline; }
  :root:not([data-theme="light"]) .on-light { display: none; }
}

.note { padding: var(--s3) var(--s4); border-radius: var(--r-control); font-size: var(--t-sm); }
.note-stop { background: var(--stop-bg); color: var(--stop); }
.note-warn { background: var(--warn-bg); color: var(--warn); }
.note-ok { background: var(--ok-bg); color: var(--ok); }
[hidden] { display: none !important; }

/* Motion is off when the computer asks for less of it, or when the person said so in Settings. */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after { transition: none !important; animation: none !important; }

/* Line icons, for every page (the app, sign-in, share links): thin strokes, no fill, the colour of the text. */
.ic { width: var(--ic-m); height: var(--ic-m); flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
