/* AgriGrok — one small stylesheet, no framework. */

:root {
  --bg: #f6f5ef;
  --surface: #ffffff;
  --surface-2: #efede4;
  --text: #1b261d;
  --muted: #5a6a5d;
  --border: #dedbcf;
  --accent: #2e7d32;
  --accent-strong: #1f5f2c;
  --accent-contrast: #ffffff;
  --focus: #f9a825;

  --phd: #b45309;
  --phd-bg: #fdf0dc;
  --job: #2e7d32;
  --job-bg: #e3f1e0;
  --event: #1565c0;
  --event-bg: #e2edfa;
  --soon: #c62828;

  --sea: #e4ece8;
  --land-bg: #d9d6ca;
  --land-stroke: #f6f5ef;
  --heat-0: #c9d8c2;
  --heat-1: #a9cf9b;
  --heat-2: #7fbf6b;
  --heat-3: #54a447;
  --heat-4: #33862f;
  --heat-5: #1b6522;
  --marker: #f59e0b;
  --marker-text: #1b261d;
  --city: #e65100;

  --radius: 14px;
  --shadow: 0 1px 2px rgb(20 40 20 / 6%), 0 4px 16px rgb(20 40 20 / 6%);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1411;
    --surface: #161d18;
    --surface-2: #1c251f;
    --text: #e6ede7;
    --muted: #9aab9d;
    --border: #2a352d;
    --accent: #66bb6a;
    --accent-strong: #81c784;
    --accent-contrast: #0f1411;
    --phd: #f0b35b;
    --phd-bg: #3a2a12;
    --job: #7ccf80;
    --job-bg: #17301a;
    --event: #74aef0;
    --event-bg: #14263d;
    --soon: #ef6b6b;
    --sea: #0c1210;
    --land-bg: #222a25;
    --land-stroke: #0c1210;
    --heat-0: #2b3a2e;
    --heat-1: #2f5a33;
    --heat-2: #37733a;
    --heat-3: #3f8e42;
    --heat-4: #4caf50;
    --heat-5: #7cd67f;
    --marker: #ffb300;
    --marker-text: #10160f;
    --city: #ff8a3d;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 6px 20px rgb(0 0 0 / 30%);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1411; --surface: #161d18; --surface-2: #1c251f; --text: #e6ede7; --muted: #9aab9d; --border: #2a352d;
  --accent: #66bb6a; --accent-strong: #81c784; --accent-contrast: #0f1411; --phd: #f0b35b; --phd-bg: #3a2a12;
  --job: #7ccf80; --job-bg: #17301a; --event: #74aef0; --event-bg: #14263d; --soon: #ef6b6b; --sea: #0c1210;
  --land-bg: #222a25; --land-stroke: #0c1210; --heat-0: #2b3a2e; --heat-1: #2f5a33; --heat-2: #37733a;
  --heat-3: #3f8e42; --heat-4: #4caf50; --heat-5: #7cd67f; --marker: #ffb300; --marker-text: #10160f; --city: #ff8a3d;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--accent-strong); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
h1 { font-family: var(--font-display); font-size: clamp(1.9rem, 4.2vw, 3rem); margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.35rem; margin: 0 0 .75rem; }
.h3, h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lead { font-size: 1.125rem; color: var(--muted); max-width: 62ch; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.plain { list-style: none; padding: 0; margin: 0; }
.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.i { width: 1em; height: 1em; vertical-align: -.15em; margin-right: .3em; flex: none; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 1.25rem; font-weight: 600; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.brand b { color: var(--accent); }
.brand-mark { width: 28px; height: 28px; }
.main-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.main-nav a { padding: 8px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.main-nav a:hover { color: var(--text); background: var(--surface-2); }
.main-nav a[aria-current="page"] { color: var(--accent-strong); background: var(--job-bg); }
.nav-search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
@media (max-width: 720px) {
  .header-row { flex-wrap: wrap; gap: 4px; padding-block: 8px; }
  .main-nav { width: 100%; margin-inline: -8px; }
  .main-nav a { padding: 6px 10px; font-size: .95rem; }
  .nav-search span { display: none; }
}

.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 0 0; margin: 0; font-size: .875rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; opacity: .6; }
.breadcrumbs a { color: var(--muted); }

/* Buttons & chips */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; background: var(--accent-strong); color: var(--accent-contrast); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--accent); color: var(--accent-contrast); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font: inherit; font-size: .9rem; cursor: pointer; }
.chip span { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip[aria-pressed="true"] span, .chip.is-active span { color: inherit; opacity: .75; }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; }
.b-phd { color: var(--phd); background: var(--phd-bg); }
.b-job { color: var(--job); background: var(--job-bg); }
.b-event { color: var(--event); background: var(--event-bg); }

/* Hero */
.hero { padding: 28px 0 8px; background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); border-bottom: 1px solid var(--border); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; color: var(--accent-strong); background: var(--job-bg); padding: 4px 12px 4px 10px; border-radius: 999px; margin: 0 0 14px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: live 1.8s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 22px 0; }
.stats div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.stats dt { font-size: .78rem; color: var(--muted); }
.stats dd { margin: 0; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats dd a { color: var(--text); text-decoration: none; }
.stats small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.quick-search { display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 8px; }
input, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-width: 0; width: 100%; }
input:focus, select:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); }
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 12px; }
  .hero-map { order: -1; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .quick-search { grid-template-columns: 1fr; }
}

/* Map */
.map { margin: 0; position: relative; }
.map-svg { display: block; width: 100%; height: auto; border-radius: var(--radius); background: var(--sea); border: 1px solid var(--border); }
.sea { fill: var(--sea); }
.land-bg path { fill: var(--land-bg); stroke: var(--land-stroke); stroke-width: .6; }
.country path { fill: var(--heat-0); stroke: var(--land-stroke); stroke-width: .8; transition: fill .2s; }
.country.heat-1 path { fill: var(--heat-1); }
.country.heat-2 path { fill: var(--heat-2); }
.country.heat-3 path { fill: var(--heat-3); }
.country.heat-4 path { fill: var(--heat-4); }
.country.heat-5 path { fill: var(--heat-5); }
.country:hover path, .country:focus-visible path, .country.is-hover path { fill: var(--marker); }
.country.is-current path { stroke: var(--text); stroke-width: 2; }
.country:focus-visible { outline: none; }
.markers .marker { cursor: pointer; }
.marker .core { fill: var(--marker); stroke: var(--surface); stroke-width: 1.5; }
.marker .pulse { fill: var(--marker); opacity: .7; transform-box: fill-box; transform-origin: center; animation: pulse 2.4s ease-out infinite; }
.marker .count { font: 700 11px var(--font); fill: var(--marker-text); text-anchor: middle; pointer-events: none; }
.marker.is-empty { display: none; }
.marker.is-hidden { display: none; }
@keyframes pulse { 0% { transform: scale(1); opacity: .65; } 80%, 100% { transform: scale(2.6); opacity: 0; } }
.city-dot { fill: var(--city); stroke: var(--surface); stroke-width: .8; animation: blink 3s ease-in-out infinite; pointer-events: none; }
.city-dot.is-hidden { display: none; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.result-dot { fill: var(--event); stroke: var(--surface); stroke-width: 1; }
.result-dot.t-phd { fill: var(--phd); } .result-dot.t-job { fill: var(--job); }
.origin-dot { fill: none; stroke: var(--soon); stroke-width: 2; }
.radius-ring { fill: color-mix(in srgb, var(--soon) 8%, transparent); stroke: var(--soon); stroke-width: 1.2; stroke-dasharray: 4 3; }
.map-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip.c-phd[aria-pressed="true"] { background: var(--phd); border-color: var(--phd); color: #fff; }
.chip.c-job[aria-pressed="true"] { background: var(--job); border-color: var(--job); color: #fff; }
.chip.c-event[aria-pressed="true"] { background: var(--event); border-color: var(--event); color: #fff; }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .8rem; color: var(--muted); margin-top: 8px; }
.legend-scale { display: inline-flex; }
.legend-scale i { width: 18px; height: 10px; display: block; }
.legend-scale .heat-1 { background: var(--heat-1); } .legend-scale .heat-2 { background: var(--heat-2); }
.legend-scale .heat-3 { background: var(--heat-3); } .legend-scale .heat-4 { background: var(--heat-4); }
.legend-scale .heat-5 { background: var(--heat-5); }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--city); margin-left: 8px; flex: none; }
.legend-group { display: inline-flex; align-items: center; gap: 6px; }
.map-tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 10px; font-size: .85rem; box-shadow: var(--shadow); max-width: 240px; transform: translate(-50%, calc(-100% - 12px)); }
.map-tooltip b { display: block; font-size: .95rem; }
.map-tooltip span { display: inline-block; margin-right: 8px; opacity: .85; }
.search .markers, .search .cities { display: none; }
@media (prefers-reduced-motion: reduce) {
  .marker .pulse, .city-dot, .live-dot { animation: none; }
  .marker .pulse { opacity: .25; transform: scale(1.6); }
}

/* Sections & cards */
.section { padding: 28px 0; }
.page-head { padding: 24px 0 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.more { font-weight: 600; text-decoration: none; white-space: nowrap; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.cards-list { grid-template-columns: 1fr; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.listing { display: flex; flex-direction: column; gap: 6px; position: relative; border-left: 4px solid var(--border); }
.listing.t-phd { border-left-color: var(--phd); }
.listing.t-job { border-left-color: var(--job); }
.listing.t-event { border-left-color: var(--event); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .85rem; }
.loc { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: relative; z-index: 1; }
.loc:hover { color: var(--text); }
.card-title { margin: 2px 0 0; font-size: 1.05rem; line-height: 1.35; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a::after { content: ""; position: absolute; inset: 0; }
.card-title a:hover { text-decoration: underline; }
.listing:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.card-title a:focus-visible { outline: none; }
.org { margin: 0; color: var(--muted); font-size: .92rem; }
.card-foot { margin: auto 0 0; padding-top: 6px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: .85rem; }
.card-foot > span { display: inline-flex; align-items: center; }
.soon { color: var(--soon); font-weight: 600; }
.src { font-size: .8rem; }
.dist { font-weight: 600; color: var(--accent-strong); }
.empty { padding: 20px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); background: var(--surface); }
.pager { display: flex; justify-content: space-between; align-items: center; margin: 24px 0 0; gap: 12px; }
.pager a { font-weight: 600; }

.country-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.country-grid a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text); }
.country-grid a:hover { border-color: var(--accent); }
.flag { font: 700 .72rem var(--font); background: var(--surface-2); color: var(--muted); border-radius: 6px; padding: 3px 6px; }
.cn { flex: 1; }
.cc { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent-strong); }

.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 8px 0 0; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.country-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.country-table th, .country-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.country-table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
.country-table tbody tr:last-child > * { border-bottom: 0; }
.status { font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); }
.st-ok { color: var(--job); background: var(--job-bg); }
.st-err { color: var(--soon); background: color-mix(in srgb, var(--soon) 12%, transparent); }
.st-skip { color: var(--muted); }

.country-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: center; }
@media (max-width: 860px) { .country-head { grid-template-columns: 1fr; } }

/* Detail page */
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 40px; padding: 20px 0 48px; }
.detail-main h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 20px 0; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.facts dt { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.summary { font-size: 1.05rem; max-width: 70ch; }
.tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags a { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); text-decoration: none; font-size: .85rem; }
.cta { margin: 24px 0 8px; }
.detail-side { border-left: 1px solid var(--border); padding-left: 28px; }
.mini-list { list-style: none; padding: 0; margin: 0 0 12px; }
.mini-list li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.mini-list a { text-decoration: none; font-weight: 500; }
@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; gap: 16px; }
  .detail-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 16px; }
}

/* Search */
.search-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; padding-bottom: 48px; }
.search-form { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 76px; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
.input-row { display: flex; gap: 6px; }
.input-row .btn { padding: 8px 12px; }
.hint { font-size: .8rem; color: var(--muted); margin: 4px 0 0; min-height: 1em; }
.search-map { margin-bottom: 12px; }
.result-count { font-weight: 600; }
@media (max-width: 860px) {
  .search-layout { grid-template-columns: 1fr; }
  .search-form { position: static; }
}

.prose { max-width: 72ch; }
.prose h2 { margin-top: 1.8em; }
.prose code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; word-break: break-word; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 40px; padding: 32px 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.footer-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.site-footer li { margin: 6px 0; }
@media (max-width: 640px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }
.search-map .map-svg { max-height: 440px; width: auto; margin-inline: auto; }
.search-map .map-legend { display: none; }
