/* ===========================================================
   IPM Climate Hub Ukraine — "Польовий альманах" design system
   Editorial field-guide system: ruled grid, mono specimen labels,
   expressive Cyrillic serif display, ink-on-paper.
   =========================================================== */

:root {
  /* Brand palette */
  --green:        #1F5C3D;
  --green-dark:   #163F2A;
  --green-darker: #102E1F;
  --leaf:         #7FB069;
  --harvest:      #E0A458;
  --terra:        #C77B47;
  --bg:           #F4F1E8;  /* warm paper */
  --paper-2:      #ECE8DB;  /* deeper paper band */
  --ink:          #19231A;
  --muted:        #5A6B57;

  --card:         #FBFAF4;  /* card paper, slightly lifted from bg */
  --line:         rgba(25, 35, 26, 0.14);   /* hairline rule */
  --line-soft:    rgba(25, 35, 26, 0.08);
  --line-strong:  rgba(25, 35, 26, 0.30);

  --green-soft:   rgba(31, 92, 61, 0.06);
  --leaf-soft:    rgba(127, 176, 105, 0.16);
  --harvest-soft: rgba(224, 164, 88, 0.18);
  --terra-soft:   rgba(199, 123, 71, 0.14);

  --leaf-acc:     #6FA557;
  --harvest-acc:  #D9962F;
  --terra-acc:    #C0703C;

  /* Typography */
  --font-display: "Spectral", Georgia, serif;     /* overridden by tweak */
  --font-body:    "Manrope", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;

  --radius:    11px;    /* softened (tweakable) */
  --radius-sm: 9px;
  --radius-lg: 16px;
  --section-y: 96px;
  --gap:       0px;      /* grids use rules, not gaps, by default */

  --maxw: 1280px;
  --pad: 40px;
}

body[data-density="compact"] { --section-y: 64px; }
body[data-density="regular"] { --section-y: 96px; }
body[data-density="comfy"]   { --section-y: 132px; }

body[data-accent="soft"] {
  --leaf-acc: #8CB277; --harvest-acc: #E0A85A; --terra-acc: #CC8559;
}
body[data-accent="balanced"] {
  --leaf-acc: #6FA557; --harvest-acc: #D9962F; --terra-acc: #C0703C;
}
body[data-accent="bold"] {
  --leaf-acc: #538B3B; --harvest-acc: #C9840F; --terra-acc: #AC5A26;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
  line-height: 1.62;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.04;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 em, h2 em, h3 em { font-style: italic; font-weight: 400; color: var(--green); }

body[data-head="unbounded"] h1,
body[data-head="unbounded"] h2,
body[data-head="unbounded"] h3 { font-weight: 600; letter-spacing: -0.03em; line-height: 1.0; }
body[data-head="unbounded"] h1 em,
body[data-head="unbounded"] h2 em { font-style: normal; font-weight: 400; }

p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad); }
section { padding: var(--section-y) 0; }
section[id], [id] { scroll-margin-top: 118px; }

.mono { font-family: var(--font-mono); }

/* ---------- Mono kicker / section marker (the "eyebrow") ---------- */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--green);
}
.eyebrow > span { min-width: 0; }
.eyebrow::before {
  content: "";
  width: 30px; height: 0; flex: none;
  border-top: 1px solid currentColor;
  opacity: 0.6;
}

/* section header */
.section-head { min-width: 0; max-width: 820px; margin-bottom: 56px; }
.section-head h2 { font-size: clamp(32px, 4.6vw, 54px); margin: 22px 0 0; }
.section-head > p, .section-head > .rich-text { margin-top: 20px; color: var(--muted); font-size: 19px; max-width: 60ch; }

.rich-text > * + * { margin-top: .75em; }
.rich-text ul, .rich-text ol { padding-left: 1.4em; }
.rich-text a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.lead { font-size: 19px; color: var(--muted); }

/* Top rule that spans the column — editorial divider */
.col-rule { border: 0; border-top: 1.5px solid var(--ink); margin: 0; opacity: 0.85; }
.hair { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ---------- Buttons (squared, utilitarian) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1.5px solid transparent;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-darker); }
.btn-harvest { background: var(--harvest-acc); color: var(--green-darker); }
.btn-harvest:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--green); color: #fff; border-color: var(--green); }
.btn-light { background: var(--bg); color: var(--green); }
.btn-light:hover { background: #fff; }

/* ---------- Header: masthead ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line-strong);
}
.utility-bar {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  padding: 7px 0; border-bottom: 1px solid var(--line);
}
.utility-bar > *, .header-inner > * { min-width: 0; }
.utility-bar .u-right { display: flex; align-items: center; gap: 18px; min-width: 0; }
.utility-bar .u-right > * { min-width: 0; }
.header-inner { display: flex; align-items: center; gap: 28px; height: 76px; }
.brand { display: flex; align-items: center; gap: 13px; flex-shrink: 0; }
.brand-logo { height: 46px; width: auto; display: block; }
.brand-div { width: 1px; height: 36px; background: var(--line-strong); flex-shrink: 0; }
.footer-logo-chip { background: #fff; border-radius: 10px; padding: 8px 12px; display: inline-flex; align-items: center; }
.footer-logo-chip img { height: 40px; width: auto; display: block; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
  background: var(--green); color: var(--bg);
  display: grid; place-items: center;
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.05; }
.brand-text .b1 { font-family: var(--font-display); font-weight: 600; font-size: 19px; color: var(--ink); letter-spacing: -0.01em; }
.brand-text .b2 { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 2px; }

.main-nav { display: flex; align-items: center; gap: 2px; min-width: 0; margin-left: auto; }
.main-nav a {
  min-width: 0;
  padding: 8px 12px; font-family: var(--font-mono); font-size: 12.5px; font-weight: 500;
  letter-spacing: 0.02em; color: var(--ink); transition: color .15s;
}
.main-nav a:hover { color: var(--green); text-decoration: underline; text-underline-offset: 4px; }

.header-tools { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.lang-switch {
  display: inline-flex; border: 1px solid var(--line-strong); border-radius: 2px; overflow: hidden;
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
}
.lang-switch button { border: none; background: transparent; color: var(--muted); padding: 6px 11px; transition: background .15s, color .15s; }
.lang-switch button.active { background: var(--green); color: #fff; }

.burger { display: none; background: transparent; border: 1px solid var(--line-strong); border-radius: 2px; width: 44px; height: 44px; place-items: center; }
.burger svg { width: 22px; height: 22px; color: var(--ink); }

/* ---------- Photo placeholder — soft image plate ---------- */
.ph {
  position: relative;
  min-width: 0;
  background: linear-gradient(158deg, #e9ecdf 0%, #dde2cf 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: var(--green); padding: 30px; min-height: 200px; gap: 13px;
}
/* A real photo fills the plate. Absolute so the image's own aspect ratio can never
   drive the plate's height — the layout keeps the size the mockup defines. */
.ph > .ph-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.ph .ph-ico { width: 30px; height: 30px; opacity: 0.45; margin: 0; }
.ph .ph-ico svg { width: 100%; height: 100%; }
.ph .ph-cap { font-family: var(--font-mono); font-size: 11.5px; font-weight: 400; color: var(--muted); max-width: 300px; line-height: 1.5; letter-spacing: 0.01em; }
.ph .ph-tag {
  position: absolute; top: 13px; left: 13px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--green); background: rgba(255,255,255,0.7);
  border: 1px solid var(--line); padding: 4px 9px; border-radius: 6px;
}
.ph.dark { background: linear-gradient(158deg, #21563b 0%, #16331f 100%); color: #fff; border-color: rgba(255,255,255,0.12); }
.ph.dark .ph-ico { color: #cfe6c0; opacity: 0.6; }
.ph.dark .ph-cap { color: rgba(255,255,255,0.74); }
.ph.dark .ph-tag { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.2); color: #cfe6c0; }

/* ---------- Cards (ledger paper) ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: background .2s ease, border-color .2s ease;
}
.card:hover { border-color: var(--line-strong); }

.icon-badge {
  width: 46px; height: 46px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--green-soft); border: 1px solid var(--line); color: var(--green);
}
.icon-badge svg { width: 23px; height: 23px; stroke-width: 1.7; }

.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Footer ---------- */
.site-footer { background: var(--green-darker); color: rgba(255,255,255,0.82); }
.site-footer a { color: rgba(255,255,255,0.82); }
.site-footer a:hover { color: #fff; }

/* reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
}

.mobile-nav { display: none; }

@media (max-width: 1080px) {
  .main-nav { display: none; }
  .burger { display: grid; }
  .header-tools .cta-start { display: none; }
  /* The nav is what pushed the tools to the right edge; once it is hidden the tools have to
     claim that space themselves, otherwise the burger floats mid-header. */
  .header-tools { margin-left: auto; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  :root { --pad: 22px; --section-y: 60px; }
  .btn { white-space: normal; }
  .utility-bar .u-left { display: none; }
  .brand-div { display: none; }
  .brand-text .b2 { display: none; }
  .brand-logo { height: 40px; }
}
@media (max-width: 460px) {
  /* Keep the platform name on phones. The mockup dropped the whole block here, which left only
     the institute emblem — and PROGRESS is a separate brand, so it must stay named. Shrink the
     brand instead of dropping either half of it: both the emblem and the name stay. */
  .brand { min-width: 0; flex-shrink: 1; gap: 9px; }
  .brand-text { min-width: 0; }
  .brand-logo { height: 34px; }
  .brand-text .b1 { min-width: 0; font-size: 15px; }
  .header-inner { gap: 12px; }
}
