@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/unbounded-latin-ext-400-700.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/unbounded-latin-400-700.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: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-latin-ext-400-700.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-latin-400-700.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-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/newsreader-latin-ext-400-700.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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/newsreader-latin-400-700.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 {
  --bg: #F7F3EC;
  --surface: #FFFDF9;
  --surface-alt: #EFE9DE;
  --border: #E3DACB;
  --text: #10121E;
  --text-muted: #58454C;
  --accent: #7C2D32;
  --accent-hover: #642126;
  --on-accent: #FFFDF9;
  --sage: #7C2D32;
  --gold: #C57B72;
  --dot-shadow: rgba(16, 18, 30, 0.25);
  --badge-cat-bg: rgba(16, 18, 30, 0.86);
  --badge-cat-fg: #F7F3EC;
  --badge-yr-bg: rgba(255, 253, 249, 0.92);
  --badge-yr-fg: #10121E;
  --shadow: 0 2px 8px rgba(16, 18, 30, 0.07), 0 18px 42px -6px rgba(16, 18, 30, 0.16);
  --radius-lg: 24px;
  --radius-md: 14px;
  --font-display: 'Unbounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="ink"] {
  --bg: #14171B;
  --surface: #1C2026;
  --surface-alt: #252B33;
  --border: #2F3640;
  --text: #EFECE6;
  --text-muted: #A7A299;
  --accent: #DF7452;
  --accent-hover: #EC8666;
  --on-accent: #14171B;
  --sage: #7BA693;
  --gold: #D4A853;
  --dot-shadow: rgba(74, 107, 93, 0.35);
  --badge-cat-bg: rgba(30, 29, 26, 0.84);
  --badge-cat-fg: #F7F3EC;
  --badge-yr-bg: rgba(255, 253, 249, 0.9);
  --badge-yr-fg: #1E1D1A;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.app-shell {
  max-width: 680px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 18px max(40px, env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 3px -2px 0 var(--dot-shadow);
  display: inline-block;
}

.brand-dot.small {
  width: 9px;
  height: 9px;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.12rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--accent);
}

.day-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.nav-arrow {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.nav-arrow:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.day-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  padding: 2px 0;
}

.day-pills::-webkit-scrollbar {
  display: none;
}

.day-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s ease;
}

.day-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.story-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.story-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-alt);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.story-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-badges {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  gap: 8px;
}

.badge-category,
.badge-year {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

.badge-category {
  background: var(--badge-cat-bg);
  color: var(--badge-cat-fg);
}

.badge-year {
  background: var(--badge-yr-bg);
  color: var(--badge-yr-fg);
}

.story-body-wrap {
  padding: 24px 24px 26px;
}

.story-date-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.story-title {
  font-family: var(--font-display);
  font-size: clamp(1.18rem, 3.2vw, 1.48rem);
  line-height: 1.28;
  letter-spacing: -0.025em;
  margin: 0 0 18px;
  font-weight: 500;
}

.story-paragraphs p {
  margin: 0 0 14px;
  font-size: 1rem;
  line-height: 1.68;
  color: var(--text);
}

.story-paragraphs p:last-child {
  margin-bottom: 0;
}

.story-meta-bar {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.source-link:hover {
  color: var(--accent);
}

.source-prefix {
  opacity: 0.75;
}

.btn-primary,
.btn-secondary {
  border: none;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: background-color 0.18s ease, transform 0.12s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.full {
  width: 100%;
}

.calm-footer {
  margin-top: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
  padding: 8px 16px;
}

.calm-footer p {
  margin: 0;
}

.footer-links {
  margin-top: 12px;
}

.footer-links a {
  color: var(--accent);
  display: inline-block;
  padding: 6px 2px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 16, 18, 0.58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-sheet {
  width: 100%;
  max-width: 460px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-head h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.share-preview-wrap {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}

#shareCanvas {
  width: 100%;
  max-width: 310px;
  height: auto;
  border-radius: 10px;
  display: block;
}

.modal-actions {
  display: grid;
  gap: 10px;
}

.settings-list {
  display: grid;
  gap: 16px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-row strong {
  display: block;
  font-size: 0.94rem;
}

.setting-row small {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.setting-row small a {
  color: var(--accent);
}

.setting-links {
  display: block;
  margin-top: 6px;
}

.setting-links a {
  white-space: nowrap;
}

.segmented {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
}

.seg-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  z-index: 200;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.is-hidden {
  display: none !important;
}

@media (max-width: 520px) {
  .story-body-wrap {
    padding: 20px 18px 22px;
  }
  .story-meta-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-primary {
    width: 100%;
  }
}
