/* The look of his website (www.nicolasfranzpattillo.com; ~/Developer/webSite, src/scss/styles.scss),
   shared by every page: the Roboto font, the site's colour tokens and the navbar. Loaded before each
   page's own <style>; a page maps its own names (--bg, --fg, ...) onto these tokens.
   Theme: the device's setting, unless he picked one with the sun/moon (public/theme.js sets
   data-theme on <html> before the page paints; the map page reads the same attribute).
   Also put in front of the map page (kp's, server.js): so the navbar's rules are all under .site-nav,
   and the tokens are --site-* names the map does not use. */

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/roboto-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;
}

/* the website's Klise-derived tokens; --site-err and --site-card are the app's own */
:root {
  --site-font: "Roboto", "Helvetica Neue", "Segoe UI", sans-serif;
  --site-mono: "Consolas", "Ubuntu Mono", "SF Mono", monospace;
  --site-bg: #ffffff; --site-bg-rgb: 255, 255, 255;
  --site-text: #434648; --site-heading: #0d122b; --site-muted: #6b7886; --site-border: #ececec;
  --site-link: #003fff; --site-accent: #ff5277; --site-hover: #b71a78; --site-code-bg: #f6f6f6;
  --site-err: #b3261e; --site-card: #ffffff;
  --nav-h: 52px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --site-bg: #222222; --site-bg-rgb: 34, 34, 34;
    --site-text: #c7bebe; --site-heading: #eaeaea; --site-muted: #767f87; --site-border: #34363d;
    --site-link: #ff5277; --site-code-bg: #131418; --site-err: #ff8a80; --site-card: #272727;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --site-bg: #222222; --site-bg-rgb: 34, 34, 34;
  --site-text: #c7bebe; --site-heading: #eaeaea; --site-muted: #767f87; --site-border: #34363d;
  --site-link: #ff5277; --site-code-bg: #131418; --site-err: #ff8a80; --site-card: #272727;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

/* the app's own pages (body class "site"), not the map */
html:has(body.site) { background: var(--site-bg); }
body.site { -webkit-font-smoothing: antialiased; font-kerning: normal; -webkit-text-size-adjust: 100%; }
body.site ::selection { background: var(--site-accent); color: var(--site-heading); }
.site h1, .site h2, .site h3 { color: var(--site-heading); }

/* ---- the navbar: page background, a 1px line under it, the links in lower case on the right
   (the current one darker, with a 2px accent line), the sun/moon on the left; "add paper" as a pill.
   It hides while scrolling down and comes back scrolling up (public/nav.js: class nav-hidden). */
.site-nav { position: sticky; top: 0; z-index: 50; flex: none; background: var(--site-bg); border-bottom: 1px solid var(--site-border);
  padding-top: env(safe-area-inset-top, 0px); font: 16px/1.2 var(--site-font); -webkit-font-smoothing: antialiased;
  transition: transform 320ms ease-in-out; }
body.nav-hidden .site-nav { transform: translateY(-110%); }
@media (prefers-reduced-motion: reduce) { .site-nav { transition: none; } }
.site-nav .nav-in { display: flex; align-items: center; gap: 4px; max-width: 900px; min-height: var(--nav-h); margin: 0 auto;
  padding: 0 max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px)); }
.site-nav button, .site-nav li { all: unset; box-sizing: border-box; }
.site-nav .nav-links { display: flex; align-items: center; gap: 2px; margin: 0 0 0 auto; padding: 0; list-style: none; }
.site-nav .nav-links li { display: block; }
.site-nav .nav-links a { display: block; position: relative; padding: 17px 9px 15px; color: var(--site-muted); opacity: .85;
  letter-spacing: .3px; text-decoration: none; transition: color .15s ease; }
.site-nav .nav-links a:hover { color: var(--site-heading); opacity: 1; }
.site-nav .nav-links a.active { color: var(--site-heading); opacity: 1; font-weight: 600; }
.site-nav .nav-links a.active::after { content: ""; position: absolute; left: 9px; right: 9px; bottom: 0; height: 2px; background: var(--site-accent); }
.site-nav .nav-count { display: inline-block; min-width: 1.5em; margin-left: 4px; padding: 0 .4em; border-radius: 999px; vertical-align: 1px;
  background: var(--site-accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 1.6; text-align: center; letter-spacing: 0; }
.site-nav .nav-count[hidden] { display: none; }
/* the website's filter pill */
.site-nav .nav-add { display: inline-flex; align-items: center; min-height: 34px; margin-left: 10px; padding: 0 .85rem; border: 1px solid var(--site-border);
  border-radius: 999px; color: var(--site-muted); background: none; font: 700 .75rem/1 var(--site-font); text-transform: uppercase;
  letter-spacing: .4px; text-decoration: none; white-space: nowrap; cursor: pointer; transition: color .15s ease, border-color .15s ease; }
.site-nav .nav-add:hover, .site-nav .nav-add[aria-expanded="true"] { color: var(--site-accent); border-color: var(--site-accent); }
/* icon buttons, drawn as CSS masks in the text colour (as the website's sun/moon) */
.site-nav .nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none;
  color: var(--site-muted); cursor: pointer; border-radius: 8px; transition: color .15s ease; }
.site-nav .nav-icon:hover { color: var(--site-heading); }
.site-nav button:focus-visible, .site-nav a:focus-visible { outline: 2px solid var(--site-accent); outline-offset: 2px; }
.site-nav .nav-icon::before { content: ""; display: block; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.site-nav .nav-theme { --icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg>'); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-nav .nav-theme { --icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>'); }
}
:root[data-theme="dark"] .site-nav .nav-theme { --icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>'); }
.site-nav .nav-menu { display: none; --icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/></svg>'); }
body.nav-open .site-nav .nav-menu { --icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round"><line x1="5" y1="5" x2="19" y2="19"/><line x1="19" y1="5" x2="5" y2="19"/></svg>'); }

/* phone width: the links move into a full-screen menu (frosted, as on the website) behind the hamburger */
@media (max-width: 639.98px) {
  .site-nav .nav-menu { display: inline-flex; }
  .site-nav .nav-add { margin-left: auto; }
  .site-nav .nav-links { display: none; }
  body.nav-open { overflow: hidden; }
  body.nav-open .site-nav .nav-links { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; margin: 0;
    position: fixed; top: calc(var(--nav-h) + 1px + env(safe-area-inset-top, 0px)); right: 0; bottom: 0; left: 0; overflow-y: auto;
    background: rgba(var(--site-bg-rgb), .86); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
  body.nav-open .site-nav .nav-links a { font-size: 1.35rem; padding: .5rem 1rem; }
  body.nav-open .site-nav .nav-links a.active::after { left: 1rem; right: 1rem; }
}

/* on the map page (kp's, with the navbar put in front by server.js): sign out lives in settings, and the
   navbar already leaves room for the status bar */
.site-nav ~ header #signout { display: none; }
.site-nav ~ header { padding-top: 10px; }

/* ---- the add paper modal (public/add-paper.js), over any page, the map too: so its rules are all under
   .add-modal. The blur is on ::backdrop, with plain colours: older Safari gives it no custom properties.
   Phone width: the whole screen. */
html:has(.add-modal[open]) { overflow: hidden; }
.add-modal, .add-modal * { box-sizing: border-box; }
.add-modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; background: none;
  color: var(--site-text); font: 17px/1.6 var(--site-font); -webkit-font-smoothing: antialiased; overflow-y: auto; overscroll-behavior: contain; }
.add-modal[open] { display: flex; }
.add-modal::backdrop { background: rgba(0, 0, 0, .28); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.add-modal .am-in { width: 100%; max-width: 640px; margin: auto; padding: 16px 20px 20px; background: var(--site-bg);
  border: 1px solid var(--site-border); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .22); overflow-wrap: anywhere; }
.add-modal .am-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.add-modal h2 { margin: 0; font-size: 1.3rem; line-height: 1.3; font-weight: 600; color: var(--site-heading); }
.add-modal .am-close { flex: none; width: 44px; height: 44px; min-height: 44px; margin-right: -10px; padding: 0; background: none; border: 0; color: var(--site-muted); }
.add-modal .am-close:hover { color: var(--site-heading); }
.add-modal .am-close::before { content: ""; display: block; width: 18px; height: 18px; margin: auto; background: currentColor;
  --icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round"><line x1="5" y1="5" x2="19" y2="19"/><line x1="19" y1="5" x2="5" y2="19"/></svg>');
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.add-modal [hidden] { display: none !important; }
.add-modal a { color: var(--site-link); }
.add-modal button { font: inherit; font-weight: 600; min-height: 44px; padding: 8px 14px; border: 0; border-radius: 8px; background: var(--site-link); color: var(--site-bg); cursor: pointer; }
.add-modal button.quiet { background: transparent; color: var(--site-link); border: 1px solid var(--site-border); font-weight: 500; }
.add-modal button.am-close { padding: 0; background: none; color: var(--site-muted); }
.add-modal button:disabled { opacity: .6; cursor: wait; }
.add-modal button.danger { background: var(--site-err); color: var(--site-bg); }
.add-modal .am-text p { margin: 0 0 .6rem; }
.add-modal .am-text .am-title { font-weight: 600; color: var(--site-heading); }
.add-modal input[type=text], .add-modal input[type=url], .add-modal input:not([type]), .add-modal textarea, .add-modal select { display: block; font: inherit; font-size: 17px;
  width: 100%; max-width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--site-border); border-radius: 8px; background: var(--site-bg); color: var(--site-text); }
.add-modal input[type=file] { display: block; width: 100%; font: inherit; font-size: 17px; padding: 6px 0; max-width: 100%; border: 0; border-radius: 0; background: none; color: var(--site-muted); }
.add-modal textarea { resize: vertical; }
.add-modal .field { display: block; margin: 0 0 10px; color: var(--site-muted); font-size: .9rem; }
.add-modal .field > span { display: block; margin-bottom: 3px; }
.add-modal .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.add-modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.add-modal .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.add-modal .check { display: block; min-height: 1.3em; margin-top: 3px; font-size: .85rem; color: var(--site-muted); }
.add-modal .source p { margin: 0 0 8px; }
.add-modal .source button { margin-left: .3rem; }
.add-modal .check.bad, .add-modal .formmsg.bad { color: var(--site-err); }
.add-modal .formmsg { min-height: 0; margin: 8px 0 0; font-size: .95rem; color: var(--site-muted); }
.add-modal .formmsg:empty { display: none; }
.add-modal .done { margin: 12px 0 0; }
/* the second step replaces the first: Cancel in the accept form brings it back */
.add-modal #ap-form:has(~ #ap-accept form.accept) { display: none; }
/* Share (public/share.js): first what (ticks), then how (one choice per piece) */
.add-modal .sh-item { margin: 0 0 12px; color: var(--site-muted); font-size: .95rem; }
.add-modal .sh-list { margin: 0 0 14px; border-top: 1px solid var(--site-border); }
.add-modal .sh-opt { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 0; border-bottom: 1px solid var(--site-border); cursor: pointer; }
.add-modal .sh-opt input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--site-link); }
.add-modal .sh-words { display: flex; flex-direction: column; line-height: 1.3; }
.add-modal .sh-label { color: var(--site-heading); font-weight: 500; }
.add-modal .sh-meta { font-size: .85rem; color: var(--site-muted); }
.add-modal .sh-how { margin: 0; padding: 10px 0 12px; border: 0; border-bottom: 1px solid var(--site-border); }
.add-modal .sh-how legend { float: left; width: 100%; padding: 0; margin: 0 0 6px; color: var(--site-heading); font-weight: 500; }
.add-modal .sh-seg { clear: both; display: flex; flex-wrap: wrap; gap: 6px; }
.add-modal .sh-seg label { position: relative; display: inline-flex; cursor: pointer; }
.add-modal .sh-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.add-modal .sh-seg span { display: inline-flex; align-items: center; min-height: 40px; padding: 4px 14px; border: 1px solid var(--site-border); border-radius: 999px;
  font-size: .95rem; color: var(--site-text); }
.add-modal .sh-seg input:checked + span { background: var(--site-link); border-color: var(--site-link); color: var(--site-bg); }
.add-modal .sh-seg input:focus-visible + span { outline: 2px solid var(--site-link); outline-offset: 2px; }
.add-modal .sh-seg.one input:checked + span { background: transparent; color: var(--site-text); border-style: dashed; }
.add-modal .sh-each { margin: 0 0 4px 34px; }
.add-modal .sh-allnone { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.add-modal .sh-allnone .sh-meta { flex: 1; }
.add-modal button.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.add-modal .sh-hl { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-top: 1px solid var(--site-border); cursor: pointer; }
.add-modal .sh-hl input { flex: none; width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--site-link); }
.add-modal .sh-quote { font-family: Georgia, "Times New Roman", serif; font-size: .95rem; color: var(--site-text); }
.add-modal .sh-how .sh-seg + .sh-seg { margin-top: 8px; }
.add-modal .sh-link { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--site-border); }
.add-modal .sh-link h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 500; color: var(--site-heading); }
.add-modal .sh-link .meta { margin: 0 0 10px; font-size: .9rem; color: var(--site-muted); }
.add-modal .sh-link .sh-seg { margin-bottom: 10px; }
.add-modal .sh-linkout input { margin: 10px 0 8px; }
.add-modal .sh-linkout .meta { margin-top: 6px; }
.add-modal img.sh-card { display: block; width: 100%; max-width: 420px; margin: 0 auto 12px; border: 1px solid var(--site-border); border-radius: 10px; }
.add-modal .sh-cardopts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
@media (min-width: 640px) { .add-modal { padding: 24px 16px; } }
@media (max-width: 639.98px) {
  .add-modal .am-in { max-width: none; min-height: 100%; margin: 0; border: 0; border-radius: 0; box-shadow: none;
    padding: max(10px, env(safe-area-inset-top, 0px)) 16px max(20px, env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 520px) { .add-modal .row2, .add-modal .row3 { grid-template-columns: 1fr; } }

/* swipe a row left for its action (public/swipe.js): the row scrolls sideways and snaps open or shut */
.swipe { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.swipe::-webkit-scrollbar { display: none; }
.swipe > .swipe-body { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; }
.swipe > .swipe-act { flex: 0 0 104px; scroll-snap-align: end; margin: 0; padding: 0 8px; border: 0; border-radius: 0; background: var(--site-err); color: #fff; font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; }
.swipe > .swipe-act:disabled { opacity: .6; }
/* the map's lists, as in Tinder (public/map-swipe.js): a pane each side of the card; past a quarter of the row it snaps to a pane and acts */
.judge { display: flex; margin-bottom: 8px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.judge::-webkit-scrollbar { display: none; }
.judge > .card { flex: 0 0 100%; min-width: 0; margin-bottom: 0; scroll-snap-align: start; scroll-snap-stop: always; }
.judge > .judge-pane { flex: 0 0 50%; display: flex; align-items: center; padding: 0 20px; color: #fff; font-size: 1rem; font-weight: 600; }
.judge > .judge-want { justify-content: flex-start; scroll-snap-align: start; background: var(--site-link); }
.judge > .judge-ignore { justify-content: flex-end; scroll-snap-align: end; background: var(--site-muted); }
