/* Lagerstätte — design system (from /aesthetic + /ux)
   Deep-black canvas, deep-blue reading panels, vivid accents as signal. */

:root {
  /* Surfaces */
  --root-bg:      #0F0F0F;   /* body, lists, top bar */
  --panel-bg:     #0D1B2A;   /* reader, cards, sheets, dialogs */
  --panel-bg-hi:  #0F2035;   /* raised panel / gradient top */
  --hairline:     #24252A;   /* dividers on the black canvas */
  --panel-line:   #1B2C40;   /* dividers inside blue panels */

  /* Accents (signal only) */
  --accent-orange: #FF8C1A;  /* unread, active tab, primary action */
  --accent-orange-press: #F06E00;
  --accent-aqua:   #38BDF8;  /* links, sync progress */
  --accent-lime:   #34D399;  /* success / all caught up */

  /* Type */
  --text:      #E8E8E8;      /* body minimum — never mid-grey */
  --text-dim:  #A9AFB8;      /* secondary: source, time (above platform min) */
  --text-faint:#7C828C;      /* tertiary, only where hierarchy allows */

  /* Metrics */
  --bar-h: 56px;
  --nav-h: 60px;
  --radius: 14px;
  --tap: 44px;               /* minimum touch target */

  --shadow-panel: 0 6px 20px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.03) inset;

  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* The `hidden` attribute must always win: our .iconbtn{display:grid} /
   .nav{display:flex} rules are author-level and would otherwise override the
   UA [hidden]{display:none}, leaving "hidden" controls (back button at a tab
   root, nav on the login screen) visible. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--root-bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  display: flex;
  flex-direction: column;
  /* respect notches / gesture bars */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

a { color: var(--accent-aqua); text-decoration: none; }

/* ---- Top app bar -------------------------------------------------------- */
.appbar {
  height: var(--bar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: var(--root-bg);
  border-bottom: 1px solid var(--hairline);
}
.appbar__title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .2px;
  margin: 0;
  flex: 1 1 auto;
}
.appbar__spacer { flex: 1 1 auto; }

/* ---- Icon buttons ------------------------------------------------------- */
.iconbtn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .12s ease, transform .06s ease;
}
.iconbtn:active { background: rgba(255,140,26,.16); transform: scale(.94); }
.iconbtn svg { width: 24px; height: 24px; display: block; }

/* ---- Primary button (rounded, gradient, real press) --------------------- */
.btn {
  appearance: none;
  border: 0;
  min-height: var(--tap);
  padding: 0 22px;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  color: #1A0E00;
  background: linear-gradient(180deg, #FFA23D 0%, var(--accent-orange) 55%, var(--accent-orange-press) 100%);
  box-shadow: 0 2px 0 rgba(0,0,0,.35), 0 1px 0 rgba(255,255,255,.25) inset;
  cursor: pointer;
  transition: transform .06s ease, filter .12s ease;
}
.btn:active { transform: translateY(1px) scale(.99); filter: brightness(.94); }
.btn[disabled] { opacity: .5; filter: grayscale(.3); cursor: default; }

/* ---- Main scroll region ------------------------------------------------- */
.main {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---- First-run / empty state ------------------------------------------- */
.state {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  gap: 6px;
}
.state__art { width: 96px; height: 96px; margin-bottom: 10px; filter: drop-shadow(0 8px 18px rgba(0,0,0,.5)); }
.state__title { font-size: 1.3rem; font-weight: 600; margin: 0; }
.state__body { color: var(--text-dim); max-width: 30ch; margin: 0 0 14px; }

/* Panel card (deep blue, raised) */
.card {
  width: 100%;
  max-width: 340px;
  background: linear-gradient(180deg, var(--panel-bg-hi), var(--panel-bg));
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}
.card .btn { width: 100%; text-align: center; }
.card__note { font-size: .82rem; color: var(--text-faint); margin: 0; }
.card__error {
  font-size: .85rem; margin: 0;
  color: #FF8A80;                 /* legible error red on the blue panel */
  text-align: left;
}

/* Ghost / secondary button (sign out): quiet, not the orange primary. */
.btn--ghost {
  color: var(--text);
  background: transparent;
  box-shadow: 0 0 0 1px var(--panel-line) inset;
}
.btn--ghost:active { filter: none; background: rgba(255,255,255,.05); }

/* ---- Form fields -------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.field__label { font-size: .82rem; font-weight: 600; color: var(--text-dim); }
.field__input {
  appearance: none;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-line);
  background: rgba(0,0,0,.28);
  color: var(--text);
  font: inherit;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field__input::placeholder { color: var(--text-faint); }
.field__input:focus {
  outline: none;
  border-color: var(--accent-aqua);
  box-shadow: 0 0 0 3px rgba(56,189,248,.22);
}

/* ---- Bottom navigation -------------------------------------------------- */
.nav {
  height: var(--nav-h);
  flex: 0 0 auto;
  display: flex;
  background: var(--root-bg);
  border-top: 1px solid var(--hairline);
}
.nav__item {
  appearance: none;
  border: 0;
  background: transparent;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-faint);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .2px;
  cursor: pointer;
  transition: color .12s ease;
}
.nav__item svg { width: 24px; height: 24px; }
.nav__item[aria-selected="true"] { color: var(--accent-orange); }
.nav__item:active { color: var(--accent-orange-press); }

/* ---- Sync status bar (persistent, under the app bar) ------------------- */
.syncbar {
  flex: 0 0 auto;
  padding: 5px 16px;
  font-size: .78rem;
  background: var(--root-bg);
  border-bottom: 1px solid var(--hairline);
}
.syncbar[data-tone="busy"] { color: var(--accent-aqua); }
.syncbar[data-tone="dim"]  { color: var(--text-dim); }
.syncbar[data-tone="err"]  { color: #FF8A80; }

/* ---- Feeds / list containers ------------------------------------------- */
.conn { padding: 12px 14px 28px; display: flex; flex-direction: column; gap: 6px; }
.listview { padding: 0 0 28px; }
.settings { padding: 14px 14px 32px; display: flex; flex-direction: column; gap: 14px; }

.sect {
  margin: 16px 2px 4px;
  font-size: .72rem; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--text-faint);
}
.hint { color: var(--text-dim); padding: 8px 2px; margin: 0; }

/* ---- Hero row (All articles) ------------------------------------------- */
.hero {
  appearance: none; border: 1px solid var(--panel-line); text-align: left;
  width: 100%; margin: 2px 0 6px;
  background: linear-gradient(180deg, var(--panel-bg-hi), var(--panel-bg));
  border-radius: var(--radius); box-shadow: var(--shadow-panel);
  padding: 14px 16px; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  transition: transform .06s ease, filter .12s ease;
}
.hero:active { transform: translateY(1px) scale(.995); filter: brightness(1.06); }
.hero__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.hero__label { font-size: 1.08rem; font-weight: 700; }
.hero__count { font-size: 1.5rem; font-weight: 800; color: var(--accent-orange); line-height: 1; }
.hero__sub { font-size: .8rem; color: var(--text-dim); }

/* ---- Rows (folders / feeds) -------------------------------------------- */
.rows, .arts { list-style: none; margin: 0; padding: 0; }
.row {
  appearance: none; border: 0; width: 100%; text-align: left;
  background: transparent; color: var(--text); font: inherit; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tap); padding: 4px 4px;
  border-bottom: 1px solid var(--hairline);
  transition: background .12s ease;
}
.row:active { background: rgba(255,255,255,.04); }
.row__label { flex: 1 1 auto; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.row__ico { width: 26px; display: grid; place-items: center; }
.row__ico svg { width: 22px; height: 22px; }

.avatar {
  width: 26px; height: 26px; flex: 0 0 auto; border-radius: 7px;
  display: grid; place-items: center;
  font-size: .82rem; font-weight: 800; color: #0A0A0A;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tile) 82%, white 18%), var(--tile));
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 1px 2px rgba(0,0,0,.4);
}

.badge {
  min-width: 22px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,140,26,.16); color: var(--accent-orange);
  font-size: .78rem; font-weight: 700; text-align: center;
}

/* ---- Segmented filter (All / Unread) ----------------------------------- */
.seg {
  display: flex; gap: 4px; margin: 10px 14px 6px; padding: 4px;
  background: rgba(0,0,0,.3); border: 1px solid var(--hairline); border-radius: 12px;
}
.seg__opt {
  appearance: none; border: 0; flex: 1 1 0; min-height: 34px; border-radius: 9px;
  background: transparent; color: var(--text-dim); font: inherit; font-weight: 600;
  cursor: pointer; transition: background .12s ease, color .12s ease;
}
.seg__opt.is-on {
  color: #1A0E00;
  background: linear-gradient(180deg, #FFA23D, var(--accent-orange));
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset;
}

/* ---- Article list rows ------------------------------------------------- */
/* The row body slides over a green "Read" reveal for swipe-left-to-mark-read;
   the body carries a solid background so the reveal only shows once it moves. */
.art {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--hairline);
}
.art__body {
  display: flex; align-items: stretch; gap: 4px;
  position: relative; z-index: 1;
  background: var(--root-bg);
  will-change: transform;
}
.art__action {
  position: absolute; inset: 0; z-index: 0;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 0 22px;
  background: var(--accent-lime); color: #06231A;
  font-weight: 700; font-size: .9rem;
}
.art__action svg { width: 22px; height: 22px; }
.art__open {
  appearance: none; border: 0; background: transparent; color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px;
  padding: 11px 2px 11px 4px; transition: background .12s ease;
}
.art__open:active { background: rgba(255,255,255,.04); }
.art__title { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.art--unread .art__title::before {
  content: ""; display: inline-block;
  width: 8px; height: 8px; margin-right: 8px; border-radius: 50%;
  background: var(--accent-orange); vertical-align: middle;
}
.art:not(.art--unread) .art__title { color: var(--text-dim); font-weight: 500; }
.art__meta { font-size: .8rem; color: var(--text-dim); }
.art__star {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  width: var(--tap); min-width: var(--tap); display: grid; place-items: center;
  border-radius: 10px; transition: background .12s ease, transform .06s ease;
}
.art__star:active { transform: scale(.9); background: rgba(255,140,26,.14); }
.art__star svg { width: 22px; height: 22px; }

/* ---- Reader ------------------------------------------------------------ */
.reader {
  margin: 12px 12px 24px;
  background: linear-gradient(180deg, var(--panel-bg-hi), var(--panel-bg));
  border: 1px solid var(--panel-line); border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  padding: 18px 18px 0; overflow: hidden;
}
.reader__head { padding-bottom: 12px; border-bottom: 1px solid var(--panel-line); }
.reader__title { margin: 0 0 6px; font-size: 1.32rem; font-weight: 700; line-height: 1.25; }
.reader__meta { margin: 0; font-size: .82rem; color: var(--text-dim); }
.reader__content { padding: 4px 0 8px; line-height: 1.62; color: var(--text); overflow-wrap: anywhere; }
.reader__content img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; }
.reader__content p { margin: 0 0 1em; }
.reader__content h1, .reader__content h2, .reader__content h3 { line-height: 1.25; margin: 1.2em 0 .5em; }
.reader__content a { color: var(--accent-aqua); text-decoration: underline; }
.reader__content pre {
  background: rgba(0,0,0,.35); border: 1px solid var(--panel-line); border-radius: 8px;
  padding: 12px; overflow-x: auto; font-size: .88rem;
}
.reader__content code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9em; }
.reader__content blockquote {
  margin: 1em 0; padding: 2px 0 2px 14px; border-left: 3px solid var(--accent-aqua);
  color: var(--text-dim);
}
.reader__content figure { margin: 12px 0; }
.reader__content figcaption { font-size: .8rem; color: var(--text-dim); text-align: center; }
.reader__content table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.reader__content td, .reader__content th { border: 1px solid var(--panel-line); padding: 6px 8px; text-align: left; }
.reader__orig { display: inline-block; margin: 4px 0 14px; font-weight: 600; }
.reader__actions {
  position: sticky; bottom: 0; margin: 0 -18px; padding: 10px 18px;
  display: flex; gap: 10px;
  background: linear-gradient(180deg, rgba(13,27,42,0), var(--panel-bg) 40%);
  border-top: 1px solid var(--panel-line);
}
.ractn {
  appearance: none; flex: 1 1 0; min-height: var(--tap); border-radius: 11px;
  border: 1px solid var(--panel-line); background: rgba(0,0,0,.25);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .06s ease, background .12s ease;
}
.ractn svg { width: 20px; height: 20px; }
.ractn:active { transform: translateY(1px) scale(.99); }
.ractn[aria-pressed="true"] { color: var(--accent-orange); border-color: rgba(255,140,26,.5); }
.ractn.is-on { color: var(--accent-orange); }

/* ---- Settings ---------------------------------------------------------- */
.card--set { max-width: none; gap: 10px; }
.card__head { margin: 0 0 2px; font-size: 1rem; font-weight: 700; }
.card code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .86em; color: var(--accent-aqua);
}
select.field__input { cursor: pointer; }
.setdiv { height: 1px; background: var(--panel-line); margin: 6px 0 2px; }

/* ---- Empty / caught-up states ------------------------------------------ */
.state--pad { min-height: auto; padding: 48px 24px; }
.caughtup { margin-bottom: 12px; }
.caughtup svg { width: 72px; height: 72px; }

/* ---- Skeletons --------------------------------------------------------- */
.rows--skel { padding-top: 6px; }
.skel { display: flex; align-items: center; gap: 12px; min-height: var(--tap);
        padding: 6px 4px; border-bottom: 1px solid var(--hairline); }
.skel__ico { width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto; }
.skel__lines { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; }
.skel__line { height: 11px; border-radius: 6px; width: 82%; }
.skel__line--short { width: 46%; }
.skel__ico, .skel__line {
  background: linear-gradient(90deg, #16171B 25%, #202228 37%, #16171B 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skel__ico, .skel__line { animation: none; } }

/* Screen-reader only */
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
      overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
