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

:root {
  color-scheme: light;
  --ink: #201d18;
  --ink-soft: #55524a;
  --paper: #ffffff;
  --paper-2: #faf8f4;
  --clay: #b5652f;
  --clay-dark: #8f4d20;
  --sky: #3f6a7a;
  --sky-dark: #2c4c58;
  --line: #e7e2d8;
  --warn-bg: #fdf3e2;
  --warn-border: #dfa254;
  --warn-text: #7a4a12;
  --good-bg: #e6ede0;
  --good-text: #3d6338;
}

* { box-sizing: border-box; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Work Sans", "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Animated mountains/valley/river/glacier scene (see common.js) — fixed behind the whole
   page: a generative canvas landscape, not a photo or someone else's video. */
#fx-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  display: block;
}

/* Very subtle grain texture over the whole page, on top of the scene, for depth. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url('bg-noise.svg') repeat;
  opacity: .02;
  mix-blend-mode: multiply;
}

::selection { background: var(--clay); color: #fff; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 3px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: #d8cdb6; }

h1, h2, h3, .brand { font-family: "Fraunces", Georgia, serif; }

a { color: var(--sky-dark); }

/* ---------- Header ---------- */

header.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.brand .peak { font-size: 1.3rem; }

nav.site-nav { display: flex; gap: 22px; flex-wrap: wrap; }

nav.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  padding: 4px 0;
  position: relative;
}

nav.site-nav a::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--clay); border-radius: 2px;
  transform: scaleX(0); transform-origin: left;
  transition: transform .2s ease;
}

nav.site-nav a:hover { color: var(--ink); }
nav.site-nav a:hover::after,
nav.site-nav a.active::after { transform: scaleX(1); }
nav.site-nav a.active { color: var(--ink); }

.lang-switch {
  display: flex;
  gap: 6px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-soft);
  align-items: center;
}

.lang-switch a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 2px 5px;
  border-radius: 2px;
}

.lang-switch a:hover { color: var(--ink); background: var(--paper-2); }
.lang-switch a.active { color: var(--ink); font-weight: 700; }
.lang-switch span.sep { color: var(--line); }

/* ---------- Layout ---------- */

main {
  max-width: 1080px;
  margin: 20px auto 40px;
  padding: 36px 28px 100px;
  background: rgba(255,255,255,.88);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  border-radius: 10px;
  box-shadow: 0 30px 70px -36px rgba(20,17,13,.3);
  position: relative;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  color: #fff;
  padding: 76px 36px 44px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-bottom: 8px;
  background: linear-gradient(160deg, var(--sky-dark), var(--clay-dark));
  box-shadow: 0 18px 40px -16px rgba(20,17,13,.45);
}

.hero.photo {
  background-size: cover;
  background-position: 50% 45%;
  isolation: isolate;
}

.hero.photo::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,24,26,.1) 0%, rgba(20,17,13,.85) 100%);
  z-index: -1;
}

@media (prefers-reduced-motion: no-preference) {
  .hero.photo { animation: kenburns 26s ease-in-out infinite alternate; }
  @keyframes kenburns {
    from { background-size: 104% auto; background-position: 50% 38%; }
    to   { background-size: 114% auto; background-position: 52% 48%; }
  }
}

.eyebrow {
  font-family: "Work Sans", sans-serif;
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: .85;
}

.hero h1 {
  margin: .5em 0 .4em;
  font-weight: 600;
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  line-height: 1.12;
  max-width: 14ch;
}

.hero p {
  margin: 0;
  max-width: 46ch;
  font-size: 1.05rem;
  opacity: .96;
  line-height: 1.55;
}

.page-title {
  font-size: clamp(1.8rem, 4.4vw, 2.6rem);
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--ink);
  line-height: 1.1;
}

.page-lede {
  color: var(--ink-soft);
  max-width: 62ch;
  margin: 0 0 40px;
  font-size: 1.08rem;
  line-height: 1.6;
}

/* ---------- Homepage cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--line);
  margin: 40px 0;
  border: 1px solid var(--line);
}

.card {
  background: var(--paper);
  padding: 26px 24px;
  transition: background .18s ease;
}

.card:hover { background: var(--paper-2); }

.card h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 600;
}

.card p { margin: 0; font-size: .93rem; color: var(--ink-soft); }

/* ---------- Editorial sections ---------- */

.section {
  border-top: 1px solid var(--line);
  padding: 40px 0;
}

.section:last-of-type { padding-bottom: 8px; }

.section h2 {
  color: var(--ink);
  margin: 0 0 16px;
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);
  font-weight: 600;
  line-height: 1.25;
}

.section h3 {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 6px;
  font-family: "Work Sans", sans-serif;
}

.section p { margin: 0 0 14px; max-width: 72ch; }
.section p:last-child { margin-bottom: 0; }

/* ---------- Tables ---------- */

table.fact-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: .91rem;
}

table.fact-table th, table.fact-table td {
  text-align: left;
  padding: 11px 14px 11px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.fact-table th {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---------- Notes / callouts ---------- */

.note {
  background: var(--warn-bg);
  border-left: 3px solid var(--warn-border);
  color: var(--warn-text);
  padding: 13px 18px;
  font-size: .9rem;
  margin: 16px 0;
  border-radius: 2px;
}

.note strong { color: var(--ink); }
.note.risk { background: #f7e6dc; border-left-color: var(--clay-dark); color: #8a3e13; }
.note.risk strong { color: inherit; }

.contact-box {
  background: var(--sky-dark);
  color: #fff;
  padding: 28px 30px;
  margin: 28px 0 0;
  border-radius: 4px;
}

.contact-box a { color: #ffe0bf; font-weight: 600; }

/* ---------- Badges / tags ---------- */

.badge, .status-tag {
  display: inline-block;
  font-family: "Work Sans", sans-serif;
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 9px;
  border-radius: 3px;
  margin-left: 8px;
  vertical-align: middle;
}

.badge { background: var(--sky); color: #fff; }
.badge.risk { background: var(--clay-dark); }
.status-tag.confirmed { background: var(--good-bg); color: var(--good-text); }
.status-tag.draft { background: var(--warn-bg); color: var(--warn-text); }

/* ---------- Map ---------- */

#pamir-map {
  height: 420px;
  border: 1px solid var(--line);
  margin-bottom: 8px;
}

/* ---------- Footer ---------- */

footer.site-footer {
  text-align: center;
  padding: 34px 16px 20px;
  color: var(--ink-soft);
  font-size: .82rem;
  border-top: 1px solid var(--line);
  margin-top: 60px;
}

/* ---------- Quick actions (hero links) ---------- */

.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }

.quick-actions a {
  color: #fff;
  text-decoration: none;
  padding: 10px 18px;
  font-size: .88rem;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 2px;
  transition: background .15s ease, border-color .15s ease;
}

.quick-actions a:hover { background: rgba(255,255,255,.14); border-color: #fff; }

/* ---------- Photo galleries (editorial: first photo featured) ---------- */

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 3px;
  margin: 20px 0;
}

.photo-gallery figure {
  margin: 0;
  position: relative;
  overflow: hidden;
  background: var(--paper-2);
}

.photo-gallery figure:first-child {
  grid-column: span 2;
}

.photo-gallery img {
  width: 100%;
  height: 210px;
  object-fit: cover;
  display: block;
  background: var(--line);
  transition: transform .5s ease;
  cursor: zoom-in;
}

.photo-gallery figure:first-child img { height: 320px; }

.photo-gallery figure:hover img { transform: scale(1.045); }

.photo-gallery figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: .72rem;
  color: #fff;
  padding: 22px 12px 9px;
  background: linear-gradient(0deg, rgba(10,9,7,.72) 0%, rgba(10,9,7,0) 100%);
}

.photo-gallery figcaption a { color: #f0e9dc; }

@media (max-width: 520px) {
  .photo-gallery figure:first-child { grid-column: span 2; }
  .photo-gallery figure:first-child img { height: 240px; }
}

/* ---------- Scroll reveal ---------- */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .55s cubic-bezier(.2,.7,.3,1), transform .55s cubic-bezier(.2,.7,.3,1);
  }
  .reveal.visible { opacity: 1; transform: none; }
  body { animation: page-in .4s ease both; }
  @keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,13,10,.94);
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox figure { margin: 0; max-width: min(90vw, 920px); }
.lightbox img { width: 100%; max-height: 78vh; object-fit: contain; display: block; }
.lightbox figcaption { color: #e8e2d6; font-size: .85rem; text-align: center; margin-top: 12px; }
.lightbox figcaption a { color: #cfc7b6; }
.lightbox-close {
  position: absolute; top: 18px; right: 22px;
  background: rgba(255,255,255,.1); color: #fff; border: none;
  width: 40px; height: 40px; border-radius: 50%; font-size: 1.4rem; line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,.22); }

@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  nav.site-nav { gap: 14px; }
  main { padding-top: 32px; }
  .hero { padding: 52px 22px 32px; }
}
