/* Sanchaya brand colours (from the logo and covers) */
:root {
  --navy: #1d3570;
  --navy-dark: #12224a;
  --orange: #f0841c;
  --orange-dark: #d9700c;
  --yellow: #f7c600;
  --bg: #f5f7fb;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #d1d5db;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--navy); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.center { text-align: center; justify-content: center; }

/* Buttons */
.btn { display: inline-block; padding: 11px 24px; border: 2px solid var(--orange); border-radius: 999px; background: var(--orange); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.btn-ghost { background: transparent; border-color: #fff; color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.12); border-color: #fff; }
.btn-line { background: #fff; border-color: var(--navy); color: var(--navy); }
.btn-line:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-danger { background: #fff; border-color: #dc2626; color: #dc2626; }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-small { padding: 5px 14px; font-size: 14px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* Header and footer */
.site-header { background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; padding-bottom: 10px; }
.logo { height: 54px; width: auto; }
.site-footer { background: var(--navy-dark); color: #e5e7eb; padding: 32px 0; font-size: 14px; }
.footer-row { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.site-footer .muted { color: #9ca3af; }

/* Home: latest issue */
.hero { background: linear-gradient(135deg, var(--navy-dark), var(--navy)); color: #fff; border-bottom: 6px solid var(--yellow); }
.hero-row { display: flex; gap: 48px; align-items: center; padding-top: 48px; padding-bottom: 48px; }
.hero-cover img { width: 280px; border-radius: 6px; box-shadow: 0 20px 40px rgba(0,0,0,.4); transition: transform .3s; }
.hero-cover:hover img { transform: translateY(-6px) rotate(-1deg); }
.hero-text h1 { font-size: clamp(30px, 5vw, 50px); margin: 8px 0 12px; line-height: 1.1; }
.hero-text p { max-width: 560px; opacity: .88; }
.tag { background: var(--yellow); color: var(--navy-dark); font-weight: 700; font-size: 13px; padding: 4px 12px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }

/* Home: archive */
.archive { padding-top: 48px; padding-bottom: 48px; }
.archive-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.archive-head h2, .more h2, .about h2 { margin: 0; color: var(--navy); font-size: 28px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 16px; text-decoration: none; color: var(--text); }
.chip:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.year { scroll-margin-top: 90px; }
.year h3 { color: var(--navy); border-bottom: 2px solid var(--yellow); display: inline-block; margin: 36px 0 20px; }
.about { background: #fff; padding: 40px 0; }
.about p { max-width: 820px; }
.empty { padding: 64px 16px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 28px; }
.card { text-decoration: none; text-align: center; }
.card img { aspect-ratio: 600 / 849; width: 100%; object-fit: cover; border-radius: 6px; box-shadow: 0 6px 16px rgba(0,0,0,.12); transition: transform .25s, box-shadow .25s; }
.card:hover img { transform: translateY(-6px); box-shadow: 0 14px 28px rgba(0,0,0,.2); }
.card span { display: block; margin-top: 10px; font-weight: 600; color: var(--navy); }

/* Issue page */
.issue { padding-top: 20px; padding-bottom: 48px; }
.crumbs { font-size: 14px; color: var(--muted); }
.issue h1 { color: var(--navy); margin: 8px 0; font-size: clamp(26px, 4vw, 38px); line-height: 1.2; }
.lead { color: var(--muted); max-width: 820px; margin-top: 0; }
.book-frame { height: 82vh; min-height: 420px; background: #e9edf5; border-radius: 10px; margin: 20px 0 0; }
.book-frame ._df_book { width: 100%; height: 100%; }
.book-frame noscript img { max-height: 100%; margin: 0 auto; }
.more { margin-top: 48px; }
.more h2 { margin-bottom: 20px; }

/* Admin */
body.admin { background: #eef1f6; }
.admin-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 24px; background: var(--navy-dark); color: #fff; border-bottom: 4px solid var(--yellow); }
.admin-bar a { color: #fff; text-decoration: none; }
.admin-bar nav { display: flex; flex-wrap: wrap; gap: 18px; font-size: 15px; }
.admin-bar nav a:hover { color: var(--yellow); }
.admin-main { padding-top: 28px; padding-bottom: 48px; }
.box { background: #fff; border-radius: 10px; padding: 28px; box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.box h1 { margin-top: 0; color: var(--navy); font-size: 24px; }
.box.narrow { max-width: 420px; margin: 40px auto; }
.box-logo { height: 46px; width: auto; margin: 0 auto 16px; }
.box-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.box-head h1 { margin: 0; }
.box label, .form label { display: block; margin-bottom: 18px; font-weight: 600; }
.box label small { font-weight: 400; color: var(--muted); }
.box input:not([type=file]), .box textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.box input[type=file] { display: block; margin: 8px 0; }
.box input:focus, .box textarea:focus { outline: 2px solid var(--orange); border-color: var(--orange); }
.slug { display: flex; align-items: center; gap: 4px; font-weight: 400; color: var(--muted); flex-wrap: wrap; }
.slug input { flex: 1; min-width: 160px; margin-top: 0 !important; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.thumb { width: 110px; border-radius: 4px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; color: var(--muted); text-transform: uppercase; border-bottom: 2px solid #e5e7eb; padding: 8px; }
.table td { border-bottom: 1px solid #eef0f3; padding: 8px; vertical-align: middle; }
.table img { width: 48px; border-radius: 3px; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.row-actions form { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: 10px; padding: 16px 20px; box-shadow: 0 4px 14px rgba(0,0,0,.06); border-top: 4px solid var(--orange); color: var(--muted); font-size: 14px; }
.stat span { display: block; font-size: 24px; font-weight: 700; color: var(--navy); line-height: 1.3; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.seo-box { border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px 20px 4px; margin: 0 0 20px; min-width: 0; }   /* min-width: 0 lets it shrink on phones */
.table-wrap { overflow-x: auto; }
.box input[type=file] { font-size: 15px; padding: 6px 0; min-height: 40px; max-width: 100%; }
.box label.radio input { width: 20px; height: 20px; flex: none; }
.seo-box legend { font-weight: 700; color: var(--navy); padding: 0 6px; }
.box label > small.count, .box label > small.redirects { display: block; margin-top: 4px; }
.count.over { color: #b45309 !important; }
.redirects { color: var(--navy) !important; }
.serp { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; font-family: Arial, sans-serif; max-width: 640px; }
.serp-url { color: #202124; font-size: 13px; word-break: break-all; }
.serp-title { color: #1a0dab; font-size: 19px; line-height: 1.3; margin: 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serp-desc { color: #4d5156; font-size: 14px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stats-link { margin: -8px 0 20px; text-align: right; font-weight: 600; }
.box input.short { max-width: 220px; }
.box label.radio { font-weight: 400; display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.box label.radio input { width: auto; margin: 0; }
.steps { padding-left: 20px; color: var(--muted); }
.steps li { margin-bottom: 6px; }
.report { background: #eef6ff; border-radius: 6px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.flash { padding: 12px 16px; border-radius: 6px; margin: 0 0 16px; }
.flash.ok { background: #dcfce7; color: #166534; }
.flash.err { background: #fee2e2; color: #991b1b; }

/* Phones */
@media (max-width: 700px) {
  .hero-row { flex-direction: column; text-align: center; gap: 24px; padding-top: 32px; padding-bottom: 32px; }
  .hero-cover img { width: 200px; }
  .hero .actions { justify-content: center; }
  .logo { height: 40px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .book-frame { height: 75vh; }
  .two { grid-template-columns: 1fr; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
  .row-actions { flex-direction: column; }
  .box { padding: 20px 16px; }
  .seo-box { padding: 12px 12px 2px; }
  .admin-main { padding-left: 10px; padding-right: 10px; }
  .table td, .table th { padding: 8px 4px; }
  .stats-link { text-align: left; }
}
