@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap");

:root {
  color-scheme: light;
  --bg: #fff8ed;
  --panel: #fffdf8;
  --text: #25241f;
  --muted: #6f6b61;
  --line: #e8ddca;
  --accent: #ed7b2c;
  --accent-strong: #c9530e;
  --green: #315f4d;
  --soft: #f7ead4;
  --soft-green: #e7f0e8;
  --shadow: 0 16px 48px rgba(81, 55, 25, .10);
  --radius: 28px;
}

:root.dark {
  color-scheme: dark;
  --bg: #171611;
  --panel: #211f19;
  --text: #f8f1e6;
  --muted: #aaa397;
  --line: #3a362e;
  --accent: #ff9b52;
  --accent-strong: #ffb57c;
  --green: #9dc7ad;
  --soft: #31251c;
  --soft-green: #1e2d25;
  --shadow: 0 16px 48px rgba(0, 0, 0, .26);
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 90% -5%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 3px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(13px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 13px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 14px;
  background: var(--accent);
  color: #2a190c;
  font-size: 1.5rem;
  font-weight: 800;
}
.brand span:last-child { display: grid; line-height: 1.05; }
.brand small { color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.brand strong { font-family: "Fraunces", Georgia, serif; font-size: 1.22rem; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn, .text-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
.icon-btn { width: 42px; height: 42px; border-radius: 50%; font-size: 1.15rem; }
.text-btn { border-radius: 999px; padding: 9px 14px; font-weight: 700; }

main { width: min(780px, 100%); margin: 0 auto; padding: 24px 16px 86px; }
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(26px, 7vw, 48px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(145deg, var(--panel), var(--soft));
  box-shadow: var(--shadow);
}
.hero::after {
  position: absolute;
  right: -70px;
  bottom: -110px;
  width: 250px;
  height: 250px;
  border: 44px solid color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}
.kicker { margin: 0 0 12px; color: var(--accent-strong); font-size: .76rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.hero h1 {
  max-width: 650px;
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.2rem, 9vw, 4.5rem);
  line-height: .98;
  letter-spacing: -.045em;
}
.hero h1 em { color: var(--green); font-style: normal; }
.hero-copy { max-width: 610px; margin: 20px 0 0; color: var(--muted); font-size: clamp(1rem, 3.2vw, 1.12rem); line-height: 1.6; }
.hero-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.primary-btn, .secondary-btn, .load-more {
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, opacity .18s ease;
}
.primary-btn { border: 0; background: var(--accent); color: #25170c; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 26%, transparent); }
.primary-btn:hover, .load-more:hover { transform: translateY(-2px); }
.secondary-btn, .load-more { border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.secondary-btn.active { background: var(--text); color: var(--bg); }
button:disabled { cursor: wait; opacity: .58; }
.edition-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 25px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
}
.live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #4fa56f; box-shadow: 0 0 0 4px color-mix(in srgb, #4fa56f 16%, transparent); }

.filters { display: flex; gap: 8px; overflow-x: auto; padding: 20px 2px 15px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}
.chip.active { border-color: var(--text); background: var(--text); color: var(--bg); }
.status {
  margin: 4px 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
}
.status[data-tone="success"] { border-color: color-mix(in srgb, var(--green) 38%, var(--line)); color: var(--green); }
.status[data-tone="error"] { border-color: #d67b73; color: #a43d34; }
.feed { display: grid; gap: 20px; }
.story-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.image-link { display: block; }
.image-wrap { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: linear-gradient(135deg, var(--soft), var(--soft-green)); }
.story-image { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .5s ease; }
.story-card:hover .story-image { transform: scale(1.025); }
.story-card.image-failed .image-wrap { display: none; }
.category {
  position: absolute;
  left: 14px;
  bottom: 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(24, 23, 19, .79);
  color: #fff;
  backdrop-filter: blur(8px);
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.story-body { padding: 20px; }
.meta { display: flex; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: .75rem; font-weight: 650; }
.source { color: var(--green); font-weight: 800; }
.location::before { margin-right: 7px; content: "•"; }
.story-body h2 { margin: 10px 0; font-family: "Fraunces", Georgia, serif; font-size: clamp(1.5rem, 5.6vw, 2.1rem); line-height: 1.08; letter-spacing: -.022em; }
.story-body h2 a { color: inherit; text-decoration: none; }
.summary { margin: 0; color: var(--muted); line-height: 1.65; }
.why { margin-top: 17px; padding: 14px 15px; border-left: 4px solid var(--accent); border-radius: 0 14px 14px 0; background: var(--soft); }
.why strong { color: var(--accent-strong); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.why p { margin: 5px 0 0; line-height: 1.5; }
.card-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; }
.read-link { color: var(--accent-strong); font-weight: 800; text-decoration: none; }
.save-btn {
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 1.45rem;
}
.save-btn.saved { background: var(--soft); color: var(--accent-strong); }
.load-more { display: block; margin: 26px auto; }
.pull-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 90vw;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-radius: 0 0 16px 16px;
  background: var(--text);
  color: var(--bg);
  font-size: .8rem;
  transform: translate(-50%, -110%);
  transition: transform .18s ease;
}
.pull-indicator.visible { transform: translate(-50%, 0); }
.pull-indicator span { transition: transform .18s ease; }
.pull-indicator.ready span { transform: rotate(180deg); }
.skeleton { overflow: hidden; height: 470px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.skeleton span, .skeleton i { display: block; background: linear-gradient(90deg, var(--soft), color-mix(in srgb, var(--panel) 70%, var(--soft)), var(--soft)); background-size: 220% 100%; animation: shimmer 1.25s infinite; }
.skeleton span { height: 55%; }
.skeleton i { width: 82%; height: 18px; margin: 18px 20px 0; border-radius: 10px; }
.skeleton i:nth-child(3) { width: 65%; }
.skeleton i:nth-child(4) { width: 48%; }
@keyframes shimmer { to { background-position: -220% 0; } }
.empty { display: grid; gap: 7px; padding: 40px 20px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }
.empty strong { color: var(--text); font-family: "Fraunces", Georgia, serif; font-size: 1.35rem; }
.about { display: flex; gap: 16px; margin-top: 42px; padding: 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.about > span { color: var(--accent); font-size: 2rem; }
.about h2 { margin: 0 0 6px; font-family: "Fraunces", Georgia, serif; font-size: 1.3rem; }
.about p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.55; }
footer { display: flex; justify-content: space-between; gap: 16px; width: min(780px, 100%); margin: 0 auto; padding: 0 18px calc(28px + env(safe-area-inset-bottom)); color: var(--muted); font-size: .75rem; }
footer button { padding: 0; border: 0; background: none; color: inherit; cursor: pointer; text-decoration: underline; }

@media (min-width: 920px) {
  main, footer { width: min(1140px, 100%); }
  .feed { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .story-card.featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.35fr 1fr; }
  .story-card.featured .image-wrap { height: 100%; min-height: 480px; aspect-ratio: auto; }
  .story-card.featured .story-body { display: flex; flex-direction: column; justify-content: center; padding: 38px; }
  .story-card.featured .story-body h2 { font-size: 2.7rem; }
}

@media (max-width: 480px) {
  .topbar { padding-left: 14px; padding-right: 14px; }
  .brand { gap: 9px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 13px; }
  .brand strong { font-size: 1.08rem; }
  main { padding-left: 12px; padding-right: 12px; }
  .hero { padding: 26px 20px; }
  .kicker { font-size: .68rem; letter-spacing: .09em; }
  .hero h1 { font-size: clamp(2rem, 11vw, 2.7rem); line-height: 1.01; }
  .hero-copy { font-size: .96rem; }
  .hero-actions { display: grid; grid-template-columns: 1fr; }
  .primary-btn, .secondary-btn { width: 100%; padding-left: 12px; padding-right: 12px; }
  .edition-meta { display: grid; font-size: .68rem; }
  .story-body { padding: 18px; }
  .story-body h2 { font-size: 1.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
