/* pypen application stylesheet.

   Extracted from the inline <style> in _shell.html on 2026-08-18. It was
   52.7KB and 1789 lines, re-parsed by the template engine on every request
   and re-sent in every response — 58% of the dashboard's bytes, and never
   cacheable by the browser. It contains no template syntax, so it belongs in
   a file. Page-specific rules still arrive via {% block extra_css %}.
*/
:root, html[data-theme="light"] {
  --on-accent: #fff;
  --accent-deep: color-mix(in srgb, var(--accent) 75%, #000);
  --paper: #f4ecd8;
  --paper-dark: #e9dfc5;
  --paper-shadow: #d6c9a5;
  --ink: #1b2a4a;
  --ink-soft: #394b6a;
  --ink-line: #2a3b5b33;
  --accent: #7a1f2b;
  --muted: #5a4b2e;
  --plate-top: #fff9e6;
  --chip-top: #fffaea;
  --noise-mix: multiply;
  --noise-opacity: 0.55;
  --bg-grad-1: radial-gradient(ellipse at 15% 10%, #ede2c4 0%, transparent 55%);
  --bg-grad-2: radial-gradient(ellipse at 85% 90%, #f7efd9 0%, transparent 50%);
  --card-shadow: 0 10px 30px -18px #00000055;
  /* The "raised plate" ring used by every active chip, tab and toggle. It was
     written out verbatim in five files; pure black reads as a smudge on the
     dark theme, so it is a token with a value per theme. */
  --plate-active: 0 0 0 1px var(--ink-line), 0 2px 6px -2px #00000055;
  /* An ink whose colour name has no hex mapping. #333 was 1.43:1 on the dark
     paper — effectively invisible. Unreachable with today's data (all 16
     colours map), but it is what a newly-named colour would fall to. */
  --ink-unknown: #6b6257;
  --plate-shadow: 0 1px 0 #fff inset, 0 4px 14px -8px #00000033;
}
html[data-theme="dark"] {
  /* White on the accent gradient is 2.55:1 at the top stop — the primary
     call to action failed AA in dark only. Dark ink on a shallower gradient
     is 7.10:1 at the top and 4.67:1 at the bottom. */
  --on-accent: #13161c;
  --accent-deep: color-mix(in srgb, var(--accent) 80%, #000);
  --paper: #13161c;
  --paper-dark: #1b1f28;
  --paper-shadow: #0b0d12;
  --ink: #ece2c8;
  --ink-soft: #b9ad92;
  --ink-line: #ece2c824;
  --accent: #e08a94;
  /* was #8b815f: 3.70:1 on --plate-top, below AA on every raised
     surface it is used on (nav pills, chips, meta lines). 4.63:1 now. */
  --muted: #9c9270;
  --plate-top: #252a35;
  --chip-top: #222735;
  --bg-grad-1: radial-gradient(ellipse at 15% 10%, #1f2430 0%, transparent 55%);
  --bg-grad-2: radial-gradient(ellipse at 85% 90%, #181c25 0%, transparent 50%);
  --card-shadow: 0 12px 32px -16px #000000aa;
  --plate-active: 0 0 0 1px var(--ink-line), 0 2px 8px -2px #00000099;
  --ink-unknown: #9a8f7e;
  --plate-shadow: 0 1px 0 #ffffff0d inset, 0 4px 16px -6px #00000088;
  --noise-opacity: 0.35;
  --noise-mix: overlay;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "EB Garamond", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  /* EB Garamond has a markedly smaller x-height than the Georgia/Liberation
     fallbacks this used to render in, so the old 19px now reads a size down.
     20.5px restores the apparent size and keeps the measure honest. */
  font-size: 20.5px;
  line-height: 1.58;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--ink);
  background: var(--bg-grad-1), var(--bg-grad-2), var(--paper);
  background-attachment: fixed;
  transition: background-color 0.4s ease, color 0.4s ease;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--ink); text-decoration: none; border-bottom: 1px dotted var(--ink-soft); }
a:hover { color: var(--accent); border-bottom-color: var(--accent); }
mark {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: inherit;
  padding: 0 0.15em;
  border-radius: 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
html[data-theme="dark"] mark {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
}
main { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1.5rem 3rem; }
section { margin-bottom: 5.5rem; }

body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.15  0 0 0 0 0.12  0 0 0 0 0.08  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: var(--noise-opacity);
  mix-blend-mode: var(--noise-mix);
  z-index: 0;
}
html[data-theme="dark"] body::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.95  0 0 0 0 0.85  0 0 0 0.08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
main, header, footer, .topbar { position: relative; z-index: 1; }

/* -------- Top bar (theme toggle + user nav) -------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 0.9rem 0.9rem 0.5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--paper) 90%, transparent) 0%,
    color-mix(in srgb, var(--paper) 75%, transparent) 65%,
    transparent 100%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.topbar > * { pointer-events: auto; }
.topbar.tucked {
  transform: translateY(-110%);
  opacity: 0;
}
.topbar.tucked > * { pointer-events: none; }

/* Corner menu button, absolute, doesn't push content */
.menu-corner {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 5;
}
main { position: relative; }
section[id], .section-head { scroll-margin-top: 5.5rem; }
.user-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.user-nav a {
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--plate-top), var(--paper-dark));
  box-shadow: var(--plate-shadow);
  transition: color 0.2s, border-color 0.2s, transform 0.15s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.user-nav a:hover {
  color: var(--ink);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.user-nav .signin {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: var(--on-accent);
  border-color: transparent;
}
.user-nav .signin:hover { color: var(--on-accent); }

.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--plate-top), var(--paper-dark));
  box-shadow: var(--plate-shadow);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.menu-btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.menu-btn svg { width: 18px; height: 18px; display: block; }
.menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Inline version — sits inside app-nav pill on wide screens */
.menu-btn.menu-in-nav {
  width: auto;
  height: auto;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0.4rem 0.9rem;
  margin-left: auto;
  color: var(--muted);
}
.menu-btn.menu-in-nav:hover {
  /* An icon has no baseline to underline, so it just gains ink. */
  transform: none;
  color: var(--ink);
  background: none;
  border: none;
}
.menu-btn.menu-in-nav svg { width: 20px; height: 20px; }

/* Hide the corner floater on wide screens when the in-nav version exists */
@media (min-width: 561px) {
  body:has(.menu-btn.menu-in-nav) .menu-corner { display: none; }
}

.menu-panel {
  position: fixed;
  top: 3.6rem;
  right: 0.9rem;
  z-index: 11;
  min-width: 240px;
  max-width: calc(100vw - 1.8rem);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: linear-gradient(180deg, var(--plate-top), var(--paper-dark));
  border: 1px solid var(--ink-line);
  border-radius: 10px;
  box-shadow: var(--plate-shadow), var(--card-shadow);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
}
.menu-panel.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.menu-panel .menu-label {
  font-family: "Inter", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.theme-choices {
  display: inline-flex;
  padding: 0.25rem;
  background: color-mix(in srgb, var(--chip-top) 80%, transparent);
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  gap: 0.2rem;
}
.theme-choices button {
  border: none;
  background: transparent;
  font-family: "Inter", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
}
.theme-choices button svg { width: 14px; height: 14px; }
.theme-choices button:hover { color: var(--ink); }
.theme-choices button.active {
  color: var(--ink);
  background: radial-gradient(circle at 50% 45%, var(--paper), var(--paper-dark));
  box-shadow: var(--plate-active);
}
/* Floating tooltip (used by calendar heatmap and pen-detail mini-gantt) */
.cal-tip {
  position: fixed;
  z-index: 50;
  padding: 0.5rem 0.75rem;
  background: linear-gradient(180deg, var(--plate-top), var(--paper-dark));
  border: 1px solid var(--ink-line);
  border-radius: 4px;
  box-shadow: var(--card-shadow);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  font-family: "Inter", sans-serif;
  font-size: 0.72rem;
  max-width: 260px;
}
.cal-tip.open { opacity: 1; }
.cal-tip .tip-date {
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.62rem;
}
.cal-tip .tip-ink {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 0.95rem;
  color: var(--ink);
  margin-top: 0.2rem;
  line-height: 1.1;
  font-style: italic;
}
.cal-tip .tip-pen {
  color: var(--ink-soft);
  margin-top: 0.15rem;
  font-size: 0.7rem;
}

/* Shortcut help modal */



.menu-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.9rem;
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
  min-height: 40px;
}
.menu-item:hover { color: var(--accent); border-color: var(--accent); }
.menu-item.signin {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: var(--on-accent);
  border-color: transparent;
}
.menu-item.signin:hover { color: var(--on-accent); }

/* -------- Hero -------- */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  border-bottom: 1px solid var(--ink-line);
  padding-bottom: 3rem;
}
.hero h1 {
  font-family: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.6rem, 9vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  margin: 0.25rem 0 1rem;
  color: var(--ink);
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.overline {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.72rem;
  color: var(--muted);
  border-bottom: 1px solid var(--muted);
  padding-bottom: 0.5rem;
  display: inline-block;
}
.lead {
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  max-width: 44rem;
  color: var(--ink-soft);
}
.lead strong { color: var(--ink); font-weight: 600; }

.plates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 2rem;
}
.plate {
  padding: 1.1rem 1rem 1rem;
  background: linear-gradient(180deg, var(--plate-top) 0%, var(--paper-dark) 100%);
  border: 1px solid var(--ink-line);
  border-radius: 2px;
  box-shadow: var(--plate-shadow);
  text-align: center;
}
.plate .num {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--ink);
  font-weight: 600;
}
.plate .lbl {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  margin-top: 0.4rem;
  color: var(--muted);
}

/* -------- Section headings -------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--ink-line);
  padding-bottom: 0.75rem;
}
.section-head h2 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}
.section-head h2 em { font-style: italic; color: var(--accent); font-weight: 400; }
.section-head .aside {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.page-head { padding-right: 90px; }
@media (max-width: 560px) {
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
  .section-head .aside { text-align: left; }
  .page-head { padding-right: 100px; }
}

/* -------- Currently inked -------- */
.inked-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}
.inked {
  --c: #333;
  position: relative;
  padding: 2rem 1.4rem 1.4rem;
  border-radius: 4px;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--c) 55%, transparent) 0%, transparent 55%),
    radial-gradient(80% 90% at 0% 100%, color-mix(in srgb, var(--c) 25%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, var(--plate-top) 0%, var(--paper-dark) 100%);
  border: 1px solid var(--ink-line);
  box-shadow: var(--plate-shadow), var(--card-shadow);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
html[data-theme="dark"] .inked {
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--c) 70%, transparent) 0%, transparent 55%),
    radial-gradient(80% 90% at 0% 100%, color-mix(in srgb, var(--c) 35%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, var(--plate-top) 0%, var(--paper-dark) 100%);
}
.inked:hover { transform: translateY(-2px); }
.inked .ribbon {
  position: absolute; top: 0; right: 0;
  background: var(--cbg, var(--c));
  color: var(--on-accent);
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding: 0.35rem 0.8rem;
  font-family: "Inter", sans-serif;
}
.inked .brand {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  color: var(--muted);
}
.inked .model {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.15;
  margin: 0.35rem 0 1rem;
}
.inked .nib {
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 1.2rem;
}
.inked .nib b { color: var(--ink); }
.inked .divider {
  height: 1px;
  background: linear-gradient(90deg, var(--c), transparent);
  margin-bottom: 1rem;
}
.inked .ink {
  font-style: italic;
  font-size: 1.1rem;
  color: var(--ink);
}
.inked .days {
  margin-top: 0.9rem;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.inked .blot {
  position: absolute;
  width: 180px; height: 180px;
  right: -60px; bottom: -80px;
  border-radius: 50%;
  background: var(--c);
  opacity: 0.18;
  filter: blur(18px);
}
.inked .pen-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(4px) saturate(0.9);
  opacity: 0.28;
  z-index: 0;
  transition: opacity 0.3s ease, filter 0.3s ease;
}
html[data-theme="dark"] .inked .pen-bg { opacity: 0.2; }
.inked:hover .pen-bg { opacity: 0.38; filter: blur(2px) saturate(1.05); }
html[data-theme="dark"] .inked:hover .pen-bg { opacity: 0.3; }
.inked .ribbon, .inked .brand, .inked .model, .inked .nib, .inked .divider, .inked .ink, .inked .days {
  position: relative; z-index: 1;
}

/* -------- Rotation -------- */
.rotations { display: grid; gap: 2rem; }
.rotation h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 500;
  margin: 0 0 0.75rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.rotation .prio {
  display: inline-block;
  min-width: 1.6rem;
  padding: 0.05rem 0.45rem;
  text-align: center;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.85rem;
  font-family: "Inter", sans-serif;
  letter-spacing: 0.05em;
  border-radius: 2px;
}
.rotation .meta {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.pen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
}
.pen-chip {
  padding: 0.7rem 0.85rem;
  background: linear-gradient(180deg, var(--chip-top), var(--paper-dark));
  border: 1px solid var(--ink-line);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.pen-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--card-shadow);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--ink-line));
}
.pen-chip .b { text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.65rem; color: var(--muted); }
.pen-chip .m {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.15;
}

/* -------- Ink library -------- */
.ink-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.ink-col {
  background: linear-gradient(180deg, var(--chip-top), var(--paper-dark));
  border: 1px solid var(--ink-line);
  border-radius: 2px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ink-col:hover { transform: translateY(-1px); box-shadow: var(--card-shadow); }
.ink-col .head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px dashed var(--ink-line);
  margin-bottom: 0.3rem;
}
.ink-col .dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  box-shadow:
    inset -3px -3px 6px rgba(0,0,0,0.35),
    inset 2px 2px 3px rgba(255,255,255,0.25),
    0 1px 2px rgba(0,0,0,0.25);
}
.ink-col .name {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 500;
}
.ink-col .count { margin-left: auto; font-size: 0.78rem; color: var(--muted); letter-spacing: 0.15em; }
.ink-col ul { list-style: none; margin: 0; padding: 0; }
.ink-col li {
  font-size: 0.92rem;
  padding: 0.15rem 0;
  color: var(--ink-soft);
}
.ink-col li::before {
  content: "·";
  display: inline-block;
  margin-right: 0.55rem;
  color: var(--muted);
}

/* -------- Timeline -------- */
.timeline { display: grid; gap: 0.35rem; }
.tl-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 0.8rem;
  align-items: center;
  font-size: 0.88rem;
  padding: 0.2rem 0;
  border-bottom: 1px dashed var(--ink-line);
}
.tl-bar {
  position: relative;
  height: 22px;
  background: color-mix(in srgb, var(--paper-dark) 50%, transparent);
  border-radius: 2px;
  overflow: hidden;
}
.tl-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--c, #333) 0%, color-mix(in srgb, var(--c, #333) 70%, var(--paper-dark)) 100%);
  display: flex;
  align-items: center;
  padding: 0 0.6rem;
  color: var(--on-accent);
  font-size: 0.75rem;
  font-family: "Inter", sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 1px #0006;
}
.tl-fill.current::after {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
  margin-left: 0.6rem;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, #333) 80%, #fff 0%);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.3); }
}
.tl-meta { font-size: 0.75rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* -------- Trophies -------- */
.trophies {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.trophy {
  padding: 1.3rem;
  background: linear-gradient(160deg, var(--chip-top) 0%, var(--paper-dark) 100%);
  border: 1px solid var(--ink-line);
  border-radius: 2px;
  border-top: 3px solid var(--accent);
}
.trophy .cat {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.7rem;
  color: var(--muted);
}
.trophy .winner {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.45rem;
  line-height: 1.15;
  margin: 0.35rem 0 0.55rem;
}
.trophy .stat { font-size: 0.85rem; color: var(--ink-soft); }
.trophy .stat b { color: var(--ink); }

/* -------- CTA -------- */
.cta-block {
  text-align: center;
  padding: 3.5rem 1rem;
  border-top: 1px solid var(--ink-line);
  border-bottom: 1px solid var(--ink-line);
  margin: 3rem 0 0;
}
.cta-block h2 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 500;
  margin: 0 0 0.8rem;
  letter-spacing: -0.01em;
}
.cta-block h2 em { font-style: italic; color: var(--accent); font-weight: 400; }
.cta-block p {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 32rem;
  margin: 0 auto 1.8rem;
}
.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, var(--plate-top), var(--paper-dark));
  color: var(--ink);
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  box-shadow: var(--plate-shadow);
  cursor: pointer;
  text-decoration: none;
  min-height: 52px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn-google:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: var(--plate-shadow), var(--card-shadow);
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.btn-google .g-logo {
  width: 22px; height: 22px;
  display: inline-block;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'><path fill='%23EA4335' d='M24 9.5c3.5 0 6.6 1.2 9.1 3.6l6.8-6.8C35.9 2.6 30.3 0 24 0 14.6 0 6.6 5.4 2.6 13.3l7.9 6.2C12.4 13.7 17.7 9.5 24 9.5z'/><path fill='%234285F4' d='M46.5 24.5c0-1.6-.2-3.2-.5-4.6H24v9.2h12.7c-.6 2.9-2.3 5.4-4.8 7.1l7.4 5.8c4.3-4 6.7-9.8 6.7-17.5z'/><path fill='%23FBBC05' d='M10.5 28.6c-.5-1.5-.8-3-.8-4.6s.3-3.1.8-4.6l-7.9-6.2C1 16.3 0 20 0 24s1 7.7 2.6 10.8l7.9-6.2z'/><path fill='%2334A853' d='M24 48c6.5 0 11.9-2.1 15.9-5.8l-7.4-5.8c-2.1 1.4-4.8 2.3-8.5 2.3-6.3 0-11.6-4.2-13.5-10l-7.9 6.2C6.6 42.6 14.6 48 24 48z'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
}

/* -------- Footer -------- */
footer {
  padding: 3rem 1.5rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--ink-line);
  margin-top: 2rem;
}
footer em { color: var(--ink-soft); }

/* Mobile */
@media (max-width: 560px) {
  body { font-size: 17px; }
  main { padding: 0.8rem 1rem 2rem; }
  section { margin-bottom: 3rem; }
  .tl-row { grid-template-columns: 1fr; gap: 0.3rem; }
  .tl-meta { text-align: left; }
  .plates { grid-template-columns: repeat(2, 1fr); }
  .plate .num { font-size: 2rem; }
  .user-nav a {
    padding: 0.5rem 0.7rem;
    font-size: 0.7rem;
  }
  .user-nav a.dashboard, .user-nav a.out-label { display: none; }
  .theme-toggle .seg { width: 34px; height: 34px; }
}
/* -------- App nav (authenticated) -------- */
.app-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  margin: 0 0 2.5rem;
  padding: 0.25rem;
  background: linear-gradient(180deg, var(--plate-top), var(--paper-dark));
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  box-shadow: var(--plate-shadow);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.app-nav::-webkit-scrollbar { display: none; }
.app-nav a {
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: none;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
@media (max-width: 560px) {
  .app-nav a { padding: 0.5rem 0.75rem; font-size: 0.7rem; letter-spacing: 0.1em; }
}
/* Hover used to drop a translucent red rounded rectangle behind the label,
   which read as a highlighter swipe in a design that otherwise speaks only in
   hairlines and plates. It also sat awkwardly next to the active state, which
   is a raised plate — two different colour washes, one meaning each.
   Now: the label darkens and a rule is drawn under it, inset to the text.
   Active stays the plate, so the two are never confused, and neither depends
   on colour alone. */
.app-nav a:hover {
  color: var(--ink);
  background:
    linear-gradient(var(--accent), var(--accent)) no-repeat
    50% calc(100% - 0.42rem) / calc(100% - 1.7rem) 1.5px;
}
.app-nav a.active:hover { background: radial-gradient(circle at 50% 45%, var(--paper) 0%, var(--paper-dark) 100%); }
.app-nav a.active {
  color: var(--ink);
  background: radial-gradient(circle at 50% 45%, var(--paper) 0%, var(--paper-dark) 100%);
  box-shadow: var(--plate-active);
}

/* -------- Page head -------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--ink-line);
}
.page-head h1 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}
.page-head h1 em { font-style: italic; color: var(--accent); font-weight: 400; }
.page-head .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* -------- Buttons -------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, var(--plate-top), var(--paper-dark));
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  box-shadow: var(--plate-shadow);
  cursor: pointer;
  text-decoration: none;
  min-height: 44px;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); color: var(--ink); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: var(--on-accent);
  border-color: transparent;
}
.btn.primary:hover { color: var(--on-accent); }
.btn.danger {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--ink-line));
  background: transparent;
  box-shadow: none;
}
.btn.danger:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}
.btn.small { padding: 0.4rem 0.75rem; font-size: 0.72rem; min-height: 36px; }

/* -------- Form -------- */
.form {
  max-width: 640px;
  display: grid;
  gap: 1.25rem;
}
.form .field { display: flex; flex-direction: column; gap: 0.4rem; }
.form .field[hidden], [hidden] { display: none !important; }
.form label {
  font-family: "Inter", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.form input[type="text"],
.form input[type="number"],
.form input[type="date"],
.form input[type="url"],
.form input[type="search"],
.form input[type="email"],
.form select,
.form textarea {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1rem;
  padding: 0.75rem 0.95rem;
  background: var(--chip-top);
  color: var(--ink);
  border: 1px solid var(--ink-line);
  border-radius: 4px;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 48px;
  width: 100%;
  color-scheme: light dark;
  font-variant-numeric: tabular-nums;
}
.form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23394b6a' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.95rem center;
  background-size: 12px 8px;
  padding-right: 2.4rem;
  cursor: pointer;
}
html[data-theme="dark"] .form select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23b9ad92' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
.form input[type="date"] {
  padding-right: 0.95rem;
}
.form input[type="date"]::-webkit-calendar-picker-indicator {
  filter: brightness(0.6);
  cursor: pointer;
  padding: 0.35rem;
  margin-right: -0.2rem;
}
html[data-theme="dark"] .form input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.85) brightness(0.9);
}
html[data-theme="dark"] .form input,
html[data-theme="dark"] .form select,
html[data-theme="dark"] .form textarea {
  background-color: color-mix(in srgb, var(--chip-top) 80%, transparent);
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.form input[type="checkbox"] {
  width: 20px; height: 20px;
  min-height: auto;
  cursor: pointer;
  accent-color: var(--accent);
}

/* Tom Select — match app theme */
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1rem;
  padding: 0.62rem 2.4rem 0.62rem 0.95rem;
  min-height: 48px;
  background: var(--chip-top);
  color: var(--ink);
  border: 1px solid var(--ink-line);
  border-radius: 4px;
  box-shadow: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23394b6a' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.95rem center;
  background-size: 12px 8px;
}
html[data-theme="dark"] .ts-wrapper.single .ts-control {
  background-color: color-mix(in srgb, var(--chip-top) 80%, transparent);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%23b9ad92' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
.ts-wrapper.focus .ts-control {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.ts-wrapper .ts-control > input {
  font-family: inherit;
  color: var(--ink);
}
.ts-dropdown {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1rem;
  background: var(--plate-top);
  color: var(--ink);
  border: 1px solid var(--ink-line);
  border-radius: 4px;
  box-shadow: 0 12px 30px -12px #00000055;
  margin-top: 4px;
  overflow: hidden;
}
html[data-theme="dark"] .ts-dropdown {
  background: var(--paper-dark);
}
.ts-dropdown .option {
  padding: 0.55rem 0.95rem;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px dashed color-mix(in srgb, var(--ink-line) 60%, transparent);
}
.ts-dropdown .option:last-child { border-bottom: none; }
.ts-dropdown .option.active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--ink);
}
.ts-dropdown .option:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.ts-dropdown .no-results {
  padding: 0.8rem 0.95rem;
  color: var(--muted);
  font-style: italic;
}
.ts-dropdown .create {
  padding: 0.55rem 0.95rem;
  color: var(--accent);
}
.ts-wrapper .ts-control > .item {
  padding: 0 0.1rem;
  color: var(--ink);
}
.ts-wrapper.disabled .ts-control { opacity: 0.7; }
.form .money-field {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.form .money-field > input {
  flex: 1 1 auto;
  min-width: 0;
}
.form .money-field > select {
  flex: 0 0 110px;
  width: 110px;
}
.form .inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.95rem;
  background: var(--chip-top);
  border: 1px solid var(--ink-line);
  border-radius: 4px;
  min-height: 48px;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  cursor: pointer;
}
html[data-theme="dark"] .form .inline-check {
  background: color-mix(in srgb, var(--chip-top) 80%, transparent);
}
.form .inline-check:has(input:focus) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.form .hint {
  font-weight: normal;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  font-size: 0.75rem;
  margin-left: 0.35rem;
}

/* -------- Segmented (radio-as-pills) -------- */
.segmented {
  display: inline-flex;
  padding: 0.25rem;
  background: var(--chip-top);
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  min-height: 48px;
  gap: 0.2rem;
  align-items: stretch;
  align-self: flex-start;
}
html[data-theme="dark"] .segmented {
  background: color-mix(in srgb, var(--chip-top) 80%, transparent);
}
.segmented label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1.1rem;
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  border-radius: 999px;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
  line-height: 1;
  white-space: nowrap;
}
.segmented label:hover { color: var(--ink); }
.segmented input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}
.segmented input[type="radio"]:checked + * , /* for RadioSelect renders */
.segmented label:has(input:checked) {
  color: var(--ink);
  background: radial-gradient(circle at 50% 45%, var(--paper) 0%, var(--paper-dark) 100%);
  box-shadow: var(--plate-active);
}
.segmented label:has(input:checked) { font-weight: 500; }
/* Django RadioSelect wraps each choice in a <div>; tame it */
.segmented > div { display: inline-flex; gap: 0.2rem; align-items: stretch; }
.segmented > div > div { display: inline-flex; }
.segmented > div > div > label { padding: 0.55rem 1.1rem; }

/* -------- Switch (checkbox-as-toggle) -------- */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0.95rem;
  background: var(--chip-top);
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  min-height: 48px;
  cursor: pointer;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1rem;
  color: var(--ink);
  user-select: none;
  align-self: flex-start;
}
html[data-theme="dark"] .switch {
  background: color-mix(in srgb, var(--chip-top) 80%, transparent);
}
.switch .switch-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}
.switch .track {
  position: relative;
  width: 46px; height: 26px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink-soft) 30%, transparent);
  transition: background 0.2s;
  flex-shrink: 0;
}
.switch .thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: left 0.2s ease, background 0.2s;
}
.switch:has(input:checked) .track { background: var(--accent); }
.switch:has(input:checked) .thumb { left: 23px; }
.switch:has(input:focus-visible) .track {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.form .row-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 520px) {
  .form .row-pair { grid-template-columns: 1fr; }
}
.form .checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
}
.form .checkbox input { width: auto; min-height: auto; }
.form .errors {
  color: var(--accent);
  font-size: 0.85rem;
  font-style: italic;
  margin-top: 0.25rem;
}
.form .actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* -------- List rows -------- */
.list {
  display: flex;
  flex-direction: column;
}
.list:first-child, .list:not(.group-head + .list + .list) { }
/* Base rules for the group heading. These lived only inside pens/list.html
   and inks/list.html, in two slightly different versions, so any other page
   using the class — pens/needs_photos.html did — rendered an unstyled block
   that the phone stylesheet then made sticky. */
.group-head {
  display: flex;
  /* Not space-between: the ink list puts a colour bead, the title and the
     count in here, and space-between flung all three to separate corners.
     Pack from the left and push only the count away. */
  align-items: center;
  gap: 0.7rem;
  margin: 2rem 0 0.5rem;
  padding: 0.35rem 0.1rem;
  border-bottom: 1px solid var(--ink-line);
}
.group-head h3 {
  font-family: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: 1.3rem;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}
.group-head h3 em { font-style: italic; color: var(--accent); font-weight: 400; }
/* The colour bead beside an ink group's heading. Lived in inks/list.html
   alongside that file's copy of .group-head; it is the ink's own colour, so
   it is deliberately not a token. */
.group-head .dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: inset -3px -3px 6px rgba(0,0,0,0.35),
              inset 2px 2px 3px rgba(255,255,255,0.2),
              0 1px 2px rgba(0,0,0,0.2);
}
.gmeta {
  margin-left: auto;
  font-family: "Inter", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.group-head + .list { border-top: none; }
.list-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0.2rem;
  border-bottom: 1px solid var(--ink-line);
}
.list-row .swatch {
  /* Centred in the row, the dot drifted to the middle of a two-line entry and
     read as belonging to the meta line rather than the title. Pin it to the
     first line, where the ink's name is. */
  align-self: start;
  margin-top: 0.42em;
  width: 14px; height: 14px; border-radius: 50%;
  box-shadow: inset -2px -2px 4px rgba(0,0,0,0.35), inset 1px 1px 2px rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.2);
}
.list-row .title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.2;
}
.list-row .meta {
  font-family: "Inter", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.2rem;
}
.list-row .row-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) {
  .list-row { grid-template-columns: auto 1fr; row-gap: 0.5rem; }
  .list-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
[data-listnav-item].kbd-focused {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 12%, transparent) 0%,
    transparent 70%);
  box-shadow: inset 3px 0 0 var(--accent);
  border-radius: 4px;
}

/* -------- Grid view (alternative ink/pen list) -------- */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--chip-top) 80%, transparent);
  overflow: hidden;
  flex: 0 0 auto;
}
.view-toggle .vt-btn {
  padding: 0.45rem 0.95rem;
  font-family: "Inter", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: none;
  cursor: pointer;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.view-toggle .vt-btn.on {
  color: var(--ink);
  background: radial-gradient(circle at 50% 45%, var(--paper), var(--paper-dark));
  box-shadow: 0 0 0 1px var(--ink-line);
}
.view-toggle .vt-btn:hover { color: var(--ink); }

/* Ink grid */
.ink-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
  margin: 0.5rem 0 2rem;
}
.ink-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--ink-line);
  box-shadow: var(--card-shadow);
  display: block;
  border-bottom: none !important;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ink-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -16px #00000077;
  border-bottom: none !important;
}
.ink-tile-swatch {
  position: absolute;
  inset: 0;
  background: var(--ink-bg, #333);
}
.ink-tile-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0.5rem 0.65rem 0.45rem;
  background: linear-gradient(180deg, transparent 0%, rgba(20,16,8,0.78) 70%);
  color: #f4ecd8;
  font-family: "Cormorant Garamond", Georgia, serif;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  line-height: 1.15;
}
.ink-tile-brand { font-size: 0.72rem; opacity: 0.85; letter-spacing: 0.02em; }
.ink-tile-name  { font-size: 1.0rem; }
.ink-tile-pip {
  position: absolute;
  top: 0.4rem; left: 0.4rem;
  font-family: "Inter", sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: rgba(20,16,8,0.65);
  color: #f4ecd8;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.ink-tile.used-up { opacity: 0.55; }
.ink-tile.used-up::after {
  content: ""; position: absolute; left: 8%; right: 8%; top: 50%;
  border-top: 2px solid rgba(20,16,8,0.85); transform: rotate(-12deg);
}
[data-listnav-item].ink-tile.kbd-focused {
  background: none;
  box-shadow: 0 0 0 3px var(--accent), var(--card-shadow);
}

/* Pen grid */
.pen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 0.5rem 0 2rem;
}
.pen-tile {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper-dark);
  border: 1px solid var(--ink-line);
  box-shadow: var(--card-shadow);
  display: block;
  border-bottom: none !important;
  transition: transform 0.15s, box-shadow 0.15s;
}
.pen-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -16px #00000077;
  border-bottom: none !important;
}
.pen-tile-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.pen-tile-img.styled { object-fit: contain; padding: 6px; }
.pen-tile-no-img {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.2rem;
  text-align: center;
  padding: 1rem;
  background:
    repeating-linear-gradient(45deg, transparent 0, transparent 8px, color-mix(in srgb, var(--ink) 4%, transparent) 8px, color-mix(in srgb, var(--ink) 4%, transparent) 9px),
    var(--paper-dark);
}
.pen-tile-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0.55rem 0.7rem;
  background: linear-gradient(180deg, transparent 0%, rgba(20,16,8,0.82) 70%);
  color: #f4ecd8;
  font-family: "Cormorant Garamond", Georgia, serif;
  text-shadow: 0 1px 3px rgba(0,0,0,0.75);
  line-height: 1.15;
}
.pen-tile-brand { font-size: 0.74rem; opacity: 0.85; }
.pen-tile-model { font-size: 1.1rem; }
.pen-tile-pip {
  position: absolute; top: 0.5rem; right: 0.5rem;
  min-width: 28px; height: 28px;
  padding: 0 0.5rem;
  background: rgba(20,16,8,0.78);
  color: #f4ecd8;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: "Inter", sans-serif;
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  backdrop-filter: blur(4px);
}
.pen-tile.defunct { opacity: 0.5; filter: grayscale(0.5); }
[data-listnav-item].pen-tile.kbd-focused {
  background: none;
  box-shadow: 0 0 0 3px var(--accent), var(--card-shadow);
}

.grid-section-head {
  font-family: "Inter", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.6rem 0 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.grid-section-head .dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block;
}

/* -------- Active inking big cards on usages page -------- */
.active-usages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

/* -------- Empty state -------- */
.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  border: 1px dashed var(--ink-line);
  border-radius: 4px;
}


/* ==========================================================================
   Responsive layer — added 2026-08-18.

   Before this, one layout served every screen: /pens/ was 12403px tall at
   1440px and 12519px at 390px, i.e. 3.7x the horizontal room bought nothing.
   The rules below give each end of the range its own shape — a bottom tab bar
   and single-column reading on the phone, multi-column density on the desk.
   Conventions follow ~/dotfiles/webkit/README.md section 3.
   ========================================================================== */

/* --- 0. Trapdoors the playbook names explicitly ------------------------- */

/* A fixed-content flex header caused body-wide horizontal scroll on the
   phone; clip it at the root and let headings shrink instead. */
html, body { overflow-x: clip; }
.page-head h1, .section-head h1, .section-head h2 { min-width: 0; overflow-wrap: break-word; }

/* Long prose is unreadable at 1300px. Cap the measure, not the container. */
.lede, .prose, .empty, .dash-hero p { max-width: 74ch; }

/* Device-specific wording: "tap" must never appear on a desktop.
   Inverted from the kit's (hover:hover) and (pointer:fine) test, which fails
   open: anything reporting pointer:none — headless browsers, some assistive
   setups, TV browsers — falls to the default, and the default was "Tap". Ask
   for a coarse pointer instead, so only something that really is a touchscreen
   gets touch wording and everything unknown gets the desktop word. */
.t-touch { display: none; }
.t-desk  { display: inline; }
@media (pointer: coarse) {
  .t-touch { display: inline; }
  .t-desk  { display: none; }
}

/* Vertical rhythm scaled to the viewport rather than fixed at phone size. */
section { margin-bottom: clamp(2.25rem, 5.5vw, 4.5rem); }
main { max-width: 1320px; padding: 1.2rem clamp(0.9rem, 3vw, 1.75rem) 3rem; }

/* --- 1. Phone: bottom tab bar ------------------------------------------- */

.tabbar { display: none; }

@media (max-width: 719px) {
  /* The pill nav overflowed its own container here — "Inkings" onwards sat
     off-screen with no affordance saying so. Replaced by the tab bar. */
  .app-nav { display: none; }

  .tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--ink-line);
    box-shadow: 0 -6px 24px -18px #00000066;
  }
  .tabbar a, .tabbar button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.18rem;
    min-height: 54px;
    padding: 0.45rem 0.2rem 0.5rem;
    border: none;
    background: none;
    color: var(--muted);
    font-family: "Inter", sans-serif;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar svg { width: 21px; height: 21px; display: block; }
  .tabbar a.active { color: var(--accent); }
  .tabbar a.active svg { stroke-width: 2.1; }
  /* Colour is never the sole carrier: the active tab also gets a rule. */
  .tabbar a.active::before {
    content: "";
    position: absolute;
    top: 0;
    width: 26px; height: 2px;
    border-radius: 0 0 2px 2px;
    background: var(--accent);
  }
  .tabbar a { position: relative; }

  /* Clear the bar so the last row is never trapped under it. */
  main { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

  /* The floating corner menu duplicated the tab bar's More button. */
  .menu-corner { display: none; }

  /* Horizontal strips scroll inside themselves, never the page. */
  .filter-bar, .view-toggle, .chips {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .filter-bar::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
  .filter-bar > * { flex-shrink: 0; }

  /* Group headings stay visible while scrolling a long list. */
  .group-head {
    position: sticky;
    top: 0;
    z-index: 3;
    margin-top: 1.5rem;
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

/* --- 2. Desk: use the width -------------------------------------------- */

@media (min-width: 720px) {
  /* Nav follows the page instead of scrolling away at the top. */
  .app-nav {
    position: sticky;
    top: 0.75rem;
    z-index: 12;
  }
}

@media (min-width: 900px) {
  /* The single change that collapses those 12000px pages: rows flow into
     columns. auto-fill (not auto-fit) keeps a short list left-aligned
     instead of stretching two entries across the whole window. */
  .list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    column-gap: 2.25rem;
    align-content: start;
    align-items: stretch;
  }
  /* Titles wrap to two lines unevenly; without this the hairline under a
     one-line row sits above its neighbours' and the grid looks ragged. */
  .list > .list-row { align-self: stretch; }
  /* Each column needs its own hairline, so the eye can find the column edge. */
  .list-row { padding-right: 0.6rem; }

  /* (detail pages already ship their own .pen-hero grid) */
}

@media (min-width: 1200px) {
  .list { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
}

/* Guests see no Edit/Delete column, so their rows pack tighter. */
@media (min-width: 900px) {
  body:not(.can-edit) .list {
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  }
}

/* --- 3. Contrast ------------------------------------------------------- */
/* #4d5d77-class greys fail AA on these panels; --muted is checked. Anything
   dimmer than --ink-soft on --paper-dark needs re-checking before use. */

/* --- 4. Group jump strip ------------------------------------------------ */
.jumpbar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  gap: 0.35rem;
  margin: 0 0 1.25rem;
  padding: 0.5rem 0.15rem;
  overflow-x: auto;
  scrollbar-width: none;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ink-line);
}
.jumpbar::-webkit-scrollbar { display: none; }
.jumpbar a {
  flex: 0 0 auto;
  font-family: "Inter", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  white-space: nowrap;
  background: color-mix(in srgb, var(--chip-top) 70%, transparent);
}
.jumpbar a:hover { color: var(--ink); border-color: var(--accent); }
/* Active chip carries weight and a ring, not colour alone. */
.jumpbar a.on {
  color: var(--ink);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* On a phone the strip sits under the sticky group heads, so give them room. */
@media (max-width: 719px) {
  .group-head { top: 46px; }
  /* 99px per pen was mostly padding. */
  .list-row { padding: 0.7rem 0.2rem; gap: 0.75rem; }
  .list-row .title { font-size: 1.1rem; }
  .pen-thumb { width: 44px; height: 44px; }
  .pen-row { grid-template-columns: 48px 1fr !important; }
}

/* --- 5. Dashboard composition ------------------------------------------ */
/* "<year> so far" and "Hall of fame" are each a couple of lines tall. Stacked,
   they cost two full screens of scroll on a desk for almost no content. */
@media (min-width: 900px) {
  .dash-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 3rem;
    align-items: start;
  }
  .dash-pair > section { margin-bottom: 0; }
}

/* --- 6. Key-mode toast -------------------------------------------------- */

/* --- 7. Numerals -------------------------------------------------------- */
/* EB Garamond ships oldstyle figures by default — the ones that hang below the
   baseline. Beautiful in a sentence, wrong in a catalogue whose subjects are
   called P135, M805, 149 and 823: a model number set in oldstyle reads as a
   typesetting mistake. So the app defaults to lining figures, and opts back
   into oldstyle only where the text is genuinely prose. */
body {
  font-variant-numeric: lining-nums proportional-nums;
}

/* Anything that stacks into a column aligns on tabular figures. */
.stat .num, .tile-number, .days, .gmeta, .year-meta, .year-label,
.list-row .meta, .cal-cell, .gantt-label, .kp-k,
table, td, th, time, .price, .meta-m {
  font-variant-numeric: lining-nums tabular-nums;
}

/* Running prose gets the figures the face was cut for. */
.lede, .dash-hero p, blockquote, .quote, footer em, .empty {
  font-variant-numeric: oldstyle-nums proportional-nums;
}

/* --- 8. Selection ------------------------------------------------------- */
/* Dragging over text on a site about fountain pens should look like ink
   sitting in paper, not like a browser default highlight. A wash of the
   accent, not a block of it, so the letterforms stay readable through it. */
::selection {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--ink);
  text-shadow: none;
}
html[data-theme="dark"] ::selection {
  background: color-mix(in srgb, var(--accent) 34%, transparent);
}

/* --- 9. Focus ----------------------------------------------------------- */
/* The app now ships link hints and a full keyboard layer, so where the focus
   sits has to be legible at a glance. One treatment everywhere, only for
   keyboard users, and it follows each element's own corner radius rather than
   drawing a rectangle around a pill. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
:where(.app-nav a, .tabbar a, .tabbar button, .jumpbar a, .menu-btn,
       .user-nav a, .btn, .fb-toggle, .vt-btn):focus-visible {
  outline-offset: 2px;
  border-radius: 999px;
}
.list-row:focus-within {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 8%, transparent) 0%, transparent 70%);
}
/* Never leave someone stranded with no visible focus because a rule above
   removed it. */
:focus-visible { outline-color: var(--accent); }

/* Skip link: the first tab stop on every page, invisible until it is wanted. */
.skip-link {
  position: fixed;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 90;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--ink-line);
  background: linear-gradient(180deg, var(--plate-top), var(--paper-dark));
  box-shadow: var(--card-shadow);
  font-family: "Inter", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  transform: translateY(-150%);
  opacity: 0;
}
.skip-link:focus-visible {
  transform: translateY(0);
  opacity: 1;
}

/* --- 10. Reduced motion ------------------------------------------------- */
/* Smooth scrolling, the card lifts, the HUD and the toast all animate. Someone
   who has asked their system to stop that should get a still page, not a
   slower one. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
}
