/* Fonts, colours (light and dark), the page, buttons and the top bar. */

/* Self-hosted fonts (SIL Open Font License, see fonts/) */
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-display: swap; font-weight: 200 800; src: url(../fonts/bricolage-grotesque-latin-opsz-normal.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; }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-display: swap; font-weight: 200 800; src: url(../fonts/bricolage-grotesque-latin-ext-opsz-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Newsreader'; font-style: normal; font-display: swap; font-weight: 200 800; src: url(../fonts/newsreader-latin-opsz-normal.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; }
@font-face { font-family: 'Newsreader'; font-style: normal; font-display: swap; font-weight: 200 800; src: url(../fonts/newsreader-latin-ext-opsz-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Newsreader'; font-style: italic; font-display: swap; font-weight: 200 800; src: url(../fonts/newsreader-latin-opsz-italic.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; }

:root {
  --paper: #FAFAFA;
  --card: #FFFFFF;
  --ink: #111111;
  --muted: #666666;
  --line: #E4E4E4;
  --strong: #111111;
  --soft: #F0F0F0;
  --dotted: #8C8C8C;
  --on-strong: #FFFFFF;
  --accent: #E77B54;
  --on-accent: #111111;
  --mark: rgba(231, 123, 84, .22);
  --danger: #B3261E;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 24px -12px rgba(0, 0, 0, .16);
  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --text: 'Newsreader', Georgia, 'Times New Roman', serif;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E0E0E;
    --card: #181818;
    --ink: #EDEDED;
    --muted: #A0A0A0;
    --line: #2A2A2A;
    --strong: #EDEDED;
    --soft: #222222;
    --dotted: #7A7A7A;
    --on-strong: #0E0E0E;
    --accent: #E77B54;
    --on-accent: #111111;
    --mark: rgba(231, 123, 84, .30);
    --danger: #F2897A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0E0E0E; --card: #181818; --ink: #EDEDED; --muted: #A0A0A0; --line: #2A2A2A;
  --strong: #EDEDED; --soft: #222222; --dotted: #7A7A7A; --on-strong: #0E0E0E; --accent: #E77B54; --on-accent: #111111;
  --mark: rgba(231, 123, 84, .30); --danger: #F2897A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--display);
  font-optical-sizing: auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px 64px; outline: none; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.loading { color: var(--muted); padding: 48px 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1px solid transparent; background: none; cursor: pointer;
  font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap;
}
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-primary { background: var(--strong); color: var(--on-strong); }
.btn-primary:hover { opacity: .86; }
.btn-quiet { border-color: var(--line); background: var(--card); }
.btn-quiet:hover { border-color: var(--muted); }
.btn-danger { color: var(--danger); }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .55; cursor: progress; }
.link-btn { background: none; border: 0; padding: 4px 2px; cursor: pointer; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
.link-btn:hover { color: var(--ink); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1180px; width: 100%; margin: 0 auto; padding: 8px 16px; min-height: 52px;
}
/* On home the title has the top row to itself, with the buttons beside it. */
body[data-view="home"] .topbar { position: absolute; top: 0; left: 0; right: var(--side-w, 0px); width: auto; z-index: 5; pointer-events: none; }
body[data-view="home"] .topbar > * { pointer-events: auto; }
body[data-view="home"] .home { padding-top: 12px; }
body[data-view="home"] .home-title { padding-right: 84px; }
@media (min-width: 701px) { body[data-view="home"] .home-title { padding-right: 200px; } }
/* phones: the title fits on one line beside the buttons */
@media (max-width: 700px) {
  body[data-view="home"] .home-title { font-size: clamp(32px, 10.5vw, 44px); }
  body[data-view="home"] .home-head { margin-bottom: 14px; }
}
.brand {
  font-weight: 700; font-size: 17px; text-decoration: none; letter-spacing: -.01em;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-new svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; margin-left: -4px; }
body[data-view="home"] .brand { visibility: hidden; }
.top-right { display: flex; align-items: center; gap: 6px; }
.account { display: flex; align-items: center; gap: 10px; }
.account:empty { display: none; }
.theme-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
}
.theme-btn:hover { color: var(--ink); background: var(--soft); }
.theme-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-btn svg .fill { fill: currentColor; stroke: none; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--soft); color: var(--strong); font-weight: 700;
}
/* loading from Google Drive: a ring turns around the account circle */
.avatar.is-syncing { position: relative; color: var(--muted); }
.avatar.is-syncing::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid transparent; border-top-color: var(--strong); border-right-color: var(--strong);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 280px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 8px;
}
.menu-who { margin: 6px 10px 2px; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.menu-note { margin: 0 10px 8px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.menu-item {
  display: block; width: 100%; text-align: left; padding: 10px; border: 0; background: none;
  border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 14px;
}
.menu-item:hover { background: var(--soft); }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; }
