/*
Theme Name: Daily Yarn
Description: Australia's news in 60 words. Card feed with category and state filters; swipe-style cards on phones.
Version: 1.1.0
Author: Daily Yarn
Requires PHP: 7.4
Text Domain: dailyyarn
*/

:root {
  /* Layout: one column of short news cards; a coloured stat panel stands in for a photo; full-screen swipe cards on phones */
  --ink: #14212b;
  --ink-soft: #4d5b66;
  --paper: #f3f5f4;
  --card: #ffffff;
  --line: #dde3e1;
  --accent: #d9481c;
  --wattle: #f2b630;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --c-national: #6b3fa0;
  --c-business: #1f5f8b;
  --c-politics: #3c4a8f;
  --c-tech: #0f7a6c;
  --c-sport: #b5361b;
  --c-entertainment: #a3296b;
  --c-environment: #4d7a1f;
  --c-world: #5b6570;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7ecea; --ink-soft: #a3b0ab; --paper: #0f1518; --card: #182126; --line: #27333a;
    --accent: #ff7a4d; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.55; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--wattle); outline-offset: 2px; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.top { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--line); }
.admin-bar .top { top: 32px; }
.bar { max-width: 960px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); }
.brand b { font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: -0.5px; line-height: 1; }
.brand b span { color: var(--accent); }
.brand small { color: var(--ink-soft); font-size: 13px; }
.date { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.filters { max-width: 960px; margin: 0 auto; padding: 0 16px 10px; display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.row::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); color: var(--ink); font: 600 13px var(--body); padding: 6px 12px; border-radius: 999px; text-decoration: none; }
.chip:hover { border-color: var(--ink-soft); }
.chip.on { background: var(--ink); color: var(--card); border-color: var(--ink); }
.row.states .chip { font-size: 12px; padding: 4px 10px; }
.row-label { flex: none; align-self: center; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); margin-right: 4px; }

/* Feed */
main { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; display: grid; grid-template-columns: 300px 1fr; overflow: hidden; }
.panel { position: relative; color: #fff; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; min-height: 230px; background: var(--cat, var(--c-national)); overflow: hidden; }
.panel canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .22; }
.panel > * { position: relative; }
.cat { font: 700 12px var(--body); text-transform: uppercase; letter-spacing: 1.5px; color: #fff; text-decoration: none; }
.stat { font-family: var(--display); font-weight: 800; font-size: 64px; line-height: .9; letter-spacing: -1px; overflow-wrap: anywhere; }
.stat-label { font-size: 13px; opacity: .92; max-width: 22ch; }
.text { padding: 18px 22px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.text h2 { font-family: var(--display); font-weight: 700; font-size: 26px; line-height: 1.12; margin: 0; text-wrap: balance; }
.text h2 a { color: inherit; text-decoration: none; }
.text h2 a:hover { text-decoration: underline; }
.meta { font-size: 12px; color: var(--ink-soft); display: flex; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.meta .who { font-weight: 600; color: var(--ink); }
.summary p { margin: 0; max-width: 65ch; }
.more { margin-top: auto; padding-top: 6px; font-size: 13px; color: var(--ink-soft); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.more a { font-weight: 600; text-decoration: none; }
.more a:hover { text-decoration: underline; }
.tags { display: flex; gap: 4px; }
.tags a { font-size: 11px; font-weight: 600; border: 1px solid var(--line); padding: 1px 6px; border-radius: 3px; color: var(--ink); text-decoration: none; }
.empty { text-align: center; color: var(--ink-soft); padding: 40px 0; }
.pager { display: flex; justify-content: space-between; gap: 12px; }
.pager a { font-weight: 600; text-decoration: none; }
footer.site { max-width: 960px; margin: 0 auto; padding: 0 16px 40px; font-size: 13px; color: var(--ink-soft); }
footer.site p { max-width: 70ch; }
.counter { display: none; }
.single-wrap { max-width: 960px; margin: 0 auto; padding: 20px 16px 0; }
.single-wrap a { font-weight: 600; text-decoration: none; }

/* Phone: one story per screen, swipe up */
@media (max-width: 700px) {
  html, body { height: 100%; }
  body.dy-feed { display: flex; flex-direction: column; overflow: hidden; height: 100vh; height: 100dvh; }
  .top { position: static; }
  .bar { padding: 10px 16px 6px; }
  .brand small, .date { display: none; }
  body.dy-feed main { flex: 1; min-height: 0; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; display: block; padding: 0; max-width: none; }
  body.dy-feed .card { scroll-snap-align: start; scroll-snap-stop: always; height: 100%; min-height: 0; overflow: hidden; border-radius: 0; border: 0; border-bottom: 1px solid var(--line); grid-template-rows: 30% 1fr; }
  .card { grid-template-columns: 1fr; }
  .panel { min-height: 180px; }
  body.dy-feed .panel { min-height: 0; }
  .stat { font-size: 52px; }
  .text { padding: 14px 16px 16px; }
  body.dy-feed .text { overflow: hidden; touch-action: pan-y; }
  body.dy-feed .panel { touch-action: pan-y; }
  .text h2 { font-size: 24px; }
  .summary p { font-size: 15.5px; }
  .more { border-top: 1px solid var(--line); padding-top: 10px; padding-right: 64px; }
  body.dy-feed footer.site { display: none; }
  body.dy-feed .pager { padding: 16px; scroll-snap-align: start; }
  .counter { display: block; position: fixed; right: 12px; bottom: 12px; background: var(--ink); color: var(--card); font: 600 12px var(--body); padding: 4px 9px; border-radius: 999px; font-variant-numeric: tabular-nums; }
  .admin-bar .top { top: 0; }
}
@media (prefers-reduced-motion: reduce) { main { scroll-behavior: auto; } }

/* Share button, corrections, newsletter and forms */
.share { font: 600 12px var(--body); background: none; border: 1px solid var(--line); color: var(--ink-soft); border-radius: 999px; padding: 3px 10px; cursor: pointer; margin-left: 6px; }
.share:hover { color: var(--ink); border-color: var(--ink-soft); }
.correction { font-size: 13px; color: var(--ink-soft); border-left: 3px solid #c9a227; padding-left: 8px; margin-top: 8px; }
.card.promo { background: var(--ink); color: var(--card); grid-template-columns: 1fr; border: 0; }
.promo-in { padding: 28px 24px; display: flex; flex-direction: column; justify-content: center; gap: 6px; max-width: 560px; }
.promo .kicker { font: 700 12px var(--body); letter-spacing: .08em; text-transform: uppercase; opacity: .7; margin: 0; }
.promo h2 { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1.05; margin: 0; }
.promo p { margin: 0 0 6px; }
.promo-single { max-width: 960px; margin: 24px auto; padding: 22px 20px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.promo-single h2 { font-family: var(--display); font-weight: 800; font-size: 28px; margin: 0 0 10px; }
.dy-form { display: grid; gap: 12px; max-width: 520px; }
.dy-form label { display: grid; gap: 4px; font: 600 14px var(--body); }
.dy-form input, .dy-form select, .dy-form textarea { font: 16px var(--body); padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }
.dy-form button { font: 700 15px var(--body); padding: 11px 16px; border: 0; border-radius: 6px; background: #b5361b; color: #fff; cursor: pointer; justify-self: start; }
.dy-form small { color: inherit; opacity: .7; font-size: 12px; }
.dy-sub.compact { grid-template-columns: 1fr auto; align-items: end; }
.dy-sub.compact small { grid-column: 1 / -1; }
.dy-sub .sr { position: relative; }
.dy-sub .sr { font-size: 0; }
.dy-sub .sr input { font-size: 16px; }
.dy-ok { font-weight: 600; }
footer.site .links a { color: inherit; }
@media (max-width: 700px) {
  body.dy-feed .card.promo { display: flex; align-items: center; }
  .dy-sub.compact { grid-template-columns: 1fr; }
}
