/* ============================================================
   ROB COUPER — PORTFOLIO v2  ·  "Contour Lines"
   Production stylesheet. Design tokens first, then components.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

/* ---------- Design tokens ---------- */

:root {
  /* Light — "Paper & Tussock" */
  --bg: #FAF9F6;
  --surface: #FFFFFF;
  --surface-2: #F1EFE9;
  --line: #E5E1D8;

  --text: #26232E;
  --muted: #6F6B7C;
  --heading: #1D1A26;

  --accent: #6D4AC4;
  --accent-strong: #5936AB;
  --accent-soft: #EFEAFB;
  --on-accent: #FFFFFF;

  --amber: #B97A1E;
  --amber-soft: #F7ECD9;
  --dot-pending: #A9A5B4;

  --hero-a: #EFEAFB;
  --hero-b: #FAF9F6;
  --contour: rgba(109, 74, 196, 0.16);

  --shadow: 0 2px 8px rgba(30, 25, 45, 0.06), 0 12px 32px rgba(30, 25, 45, 0.08);
  --shadow-lift: 0 4px 12px rgba(30, 25, 45, 0.10), 0 20px 48px rgba(30, 25, 45, 0.14);

  --radius: 18px;
  --radius-sm: 12px;

  --globe-sea: #D8E8F0;
  --globe-land: #D0D9C7;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0F1116;
  --surface: #161923;
  --surface-2: #1D2130;
  --line: #272C3D;

  --text: #E9E7F1;
  --muted: #9B97AB;
  --heading: #F5F3FB;

  --accent: #A78BFA;
  --accent-strong: #C3B1FF;
  --accent-soft: #241F3A;
  --on-accent: #14101F;

  --amber: #F0B35E;
  --amber-soft: #2E2617;
  --dot-pending: #565B6E;

  --hero-a: #1A1530;
  --hero-b: #0F1116;
  --contour: rgba(167, 139, 250, 0.14);

  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 4px 12px rgba(0, 0, 0, 0.45), 0 20px 48px rgba(0, 0, 0, 0.5);

  --globe-sea: #1A2A3A;
  --globe-land: #4A5C4A;

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #0F1116; --surface: #161923; --surface-2: #1D2130; --line: #272C3D;
    --text: #E9E7F1; --muted: #9B97AB; --heading: #F5F3FB;
    --accent: #A78BFA; --accent-strong: #C3B1FF; --accent-soft: #241F3A; --on-accent: #14101F;
    --amber: #F0B35E; --amber-soft: #2E2617; --dot-pending: #565B6E;
    --hero-a: #1A1530; --hero-b: #0F1116; --contour: rgba(167, 139, 250, 0.14);
    --shadow: 0 2px 8px rgba(0,0,0,.35), 0 12px 32px rgba(0,0,0,.35);
    --shadow-lift: 0 4px 12px rgba(0,0,0,.45), 0 20px 48px rgba(0,0,0,.5);
    --globe-sea: #1A2A3A; --globe-land: #4A5C4A;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

* { margin: 0; padding: 0; box-sizing: border-box; }
/* Defensive: [hidden] must always win, even over classes that set display */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  background: var(--bg);
  color: var(--text);
  transition: background-color .3s ease, color .3s ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  color: var(--heading);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 600;
}

h1 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
h3 { font-size: 1.25rem; }

p + p { margin-top: 1em; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

img { max-width: 100%; display: block; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

.eyebrow {
  font-family: 'Space Grotesk', sans-serif;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .6rem;
}

.muted { color: var(--muted); }

.accent { color: var(--accent); }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}

/* Fix #4: brand + toggle share row 1; nav wraps to its own row below them.
   On wide screens it's all one row (brand · nav · toggle-last). */
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 64px;
  flex-wrap: wrap;
  padding-top: .5rem;
  padding-bottom: .5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--heading);
  order: 1;
}

.brand img {
  width: 50px; height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.theme-toggle {
  order: 2;               /* sits right after the brand in DOM flow… */
  margin-left: auto;      /* …pushed to the far right of the first row */
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: .4rem .8rem;
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: border-color .2s ease;
  white-space: nowrap;
}
.theme-toggle:hover { border-color: var(--accent); }

.site-nav {
  order: 3;
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}

.site-nav a {
  font-family: 'Space Grotesk', sans-serif;
  font-size: .95rem;
  font-weight: 500;
  color: var(--text);
  padding: .45rem .95rem;
  border-radius: 999px;
  transition: background .2s ease, color .2s ease;
}

.site-nav a:hover { background: var(--surface-2); color: var(--heading); }
.site-nav a.active { background: var(--accent); color: var(--on-accent); }

/* Wide screens: single row — brand, nav (pushed right), toggle last */
@media (min-width: 761px) {
  .site-nav { margin-left: auto; }
  .theme-toggle { margin-left: .4rem; order: 4; }
}

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

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--hero-a) 0%, var(--hero-b) 70%);
  padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5.5rem);
}

.hero-compact { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(2rem, 4vw, 3rem); }
.hero-compact h1 { font-size: clamp(2rem, 5vw, 3rem); }

.hero-contours {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.hero-contours path {
  fill: none;
  stroke: var(--contour);
  stroke-width: 1.5;
}

.hero .wrap {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 3rem;
  align-items: center;
}

.hero-compact .wrap { grid-template-columns: 1fr; }

/* Fix #7: plain kicker pill — no pulse dot */
.hero-kicker {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .3rem 1rem;
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow);
}

.hero-kicker .pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  animation: pulse 2.4s ease infinite;
  margin-right: 0.5rem;
}

.hero-sub {
  margin-top: 1.2rem;
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 34rem;
}

.hero-ctas { margin-top: 2rem; display: flex; gap: .8rem; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: .95rem;
  padding: .7rem 1.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--accent-strong); color: var(--on-accent); box-shadow: var(--shadow-lift); }
.btn-ghost { border-color: var(--line); color: var(--heading); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero-photo {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lift);
  transform: rotate(2deg);
  transition: transform .35s ease;
}
.hero-photo:hover { transform: rotate(0deg) scale(1.015); }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 5; }
.hero-photo figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 1.6rem 1rem .7rem;
  font-size: .8rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(15, 12, 25, .75));
}

/* ---------- Sections & cards ---------- */

.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section-alt { background: var(--surface-2); }

.section-head { max-width: 40rem; margin-bottom: 2.5rem; }
.section-head p { color: var(--muted); margin-top: .5rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.4rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease;
  display: flex;
  flex-direction: column;
  color: var(--text);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); color: var(--text); }
.card img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.card-body { padding: 1.3rem 1.4rem 1.5rem; flex: 1; }
.card-body h3 { margin-bottom: .4rem; }
.card-body p { font-size: .95rem; color: var(--muted); }
.card-tag {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: .18rem .7rem;
  margin-bottom: .7rem;
}
.card-tag.tag-soon { color: var(--muted); background: var(--surface-2); }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}
.split .photo {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.split .photo img { width: 100%; object-fit: cover; aspect-ratio: 4 / 3; }

.topic-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.topic-list li {
  background: var(--accent-soft);
  color: var(--accent);
  font-family: 'Space Grotesk', sans-serif;
  font-size: .85rem;
  font-weight: 500;
  border-radius: 999px;
  padding: .25rem .9rem;
}

/* ---------- Footer (fix #12: signoff line, no extra height) ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.4rem 0;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}
.site-footer a { font-weight: 500; }
.site-footer .signoff {
  font-size: .75rem;
  opacity: .75;
  margin-top: .15rem;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: .06em;
}

/* ============================================================
   TRAVEL PAGE
   ============================================================ */

/* ---------- Password gate (fix #6) ---------- */

.travel-gate {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--hero-a) 0%, var(--hero-b) 80%);
  padding: 2rem 1.25rem;
}

.gate-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 2.6rem 2.4rem;
  max-width: 26rem;
  width: 100%;
  text-align: center;
}
.gate-globe { font-size: 3rem; margin-bottom: .6rem; }
.gate-card h2 { margin-bottom: .3rem; }
.gate-card form {
  margin-top: 1.4rem;
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  justify-content: center;
}
.gate-card input {
  flex: 1 1 160px;
  font: inherit;
  padding: .65rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .2s ease;
}
.gate-card input:focus { border-color: var(--accent); }
.gate-error { color: var(--amber); font-size: .88rem; margin-top: .8rem; animation: shake .35s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--amber) 50%, transparent); }
  50% { box-shadow: 0 0 0 7px transparent; }
}

/* ---------- Globe hero ---------- */

.globe-hero {
  position: relative;
  background: linear-gradient(180deg, var(--hero-a) 0%, var(--hero-b) 100%);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.globe-hero .wrap { position: relative; z-index: 2; padding-top: 3rem; text-align: center; display: block; }
.globe-hero .hero-sub { margin-inline: auto; }

#globe-mount {
  position: relative;
  width: 70%; /* 70% width on desktop */
  height: min(58vh, 560px);
  margin: 0 auto; /* Center the globe horizontally */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  overflow: hidden;          /* fix #2: nothing bleeds outside the mount */
  touch-action: pan-y;       /* mobile: vertical page scroll still works */
}
#globe-mount:active { cursor: grabbing; }
#globe-mount canvas { outline: none; }

.globe-fallback {
  text-align: center;
  color: var(--muted);
  max-width: 26rem;
  padding: 2rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.globe-legend {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 1.6rem;
  flex-wrap: wrap;
  padding: 0 1rem 1.6rem;
  font-size: .85rem;
  color: var(--muted);
}
.globe-legend span { display: inline-flex; align-items: center; gap: .45rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-dot.reported { background: var(--amber); }
.legend-dot.pending { background: var(--dot-pending); }

/* ---------- Timeline (fix #5: chronological L→R, custom scrollbar) ---------- */

.timeline-section { padding: 2.5rem 0 1rem; }

.timeline-rail-wrap { position: relative; }

.timeline-rail {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 1.2rem .4rem .8rem;
  scrollbar-width: none;               /* native bar hidden… */
  scroll-snap-type: none; /* Disable snap scrolling (if enabled) */
}
.timeline-rail::-webkit-scrollbar { display: none; }

.timeline-rail::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: calc(50% - .5rem);
  height: 2px;
  background: var(--line);
  z-index: 0;
  pointer-events: none;
}

/* …replaced by a slim custom progress-style scrollbar */
.timeline-scrollbar {
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: .2rem .4rem 0;
  position: relative;
  cursor: pointer;
}
.timeline-scrollbar .thumb {
  position: absolute;
  top: 0; bottom: 0;
  border-radius: 999px;
  background: var(--accent);
  min-width: 36px;
  transition: background .2s ease;
}
.timeline-scrollbar:hover .thumb,
.timeline-scrollbar.dragging .thumb { background: var(--accent-strong); }

.trip-chip {
  position: relative;
  z-index: 1;
  scroll-snap-align: center;
  flex: 0 0 210px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  padding: 0;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.trip-chip:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.trip-chip img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.trip-chip .chip-body { padding: .65rem .8rem .8rem; }
.trip-chip .chip-date {
  font-family: 'Space Grotesk', sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.trip-chip .chip-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: .95rem;
  color: var(--heading);
  line-height: 1.3;
}

.trip-chip.pending { opacity: .55; filter: saturate(.4); }
.trip-chip.pending:hover { opacity: .8; }

.trip-chip.selected {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 30%, transparent), var(--shadow-lift);
  opacity: 1;
  filter: none;
}
.trip-chip.selected .chip-date { color: var(--amber); }

/* ---------- Report panel ---------- */

.report-panel {
  margin: 2rem 0 4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: reportIn .4s ease;
}
@keyframes reportIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.report-head {
  padding: 2.2rem 2.4rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem 1.2rem;
}
.report-head h2 { flex: 1 1 auto; }
.report-meta {
  font-family: 'Space Grotesk', sans-serif;
  font-size: .85rem;
  color: var(--muted);
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
}
.report-meta .pin::before { content: '📍 '; }
.report-meta .cal::before { content: '🗓 '; }

.report-body { padding: 1.2rem 2.4rem 2.4rem; max-width: 46rem; }
.report-body h2, .report-body h3 { margin: 1.6em 0 .5em; color: var(--accent); font-size: 1.25rem; }
.report-body img {
  border-radius: var(--radius-sm);
  margin: 1.2rem 0;
  box-shadow: var(--shadow);
  cursor: zoom-in;
}

.report-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .7rem;
  padding: 1.4rem 2.4rem 0;
}
.report-gallery img {
  border-radius: var(--radius-sm);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
  cursor: zoom-in;
  transition: transform .2s ease, box-shadow .2s ease;
}
.report-gallery img:hover { transform: scale(1.03); box-shadow: var(--shadow); }

.report-pending {
  padding: 3rem 2.4rem;
  text-align: center;
  color: var(--muted);
}
.report-pending .big { font-size: 2.2rem; margin-bottom: .6rem; }

/* ---------- Lightbox (fix #3) ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 8, 16, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lbIn .25s ease;
}
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }

.lightbox img {
  max-width: min(92vw, 1400px);
  max-height: 88vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  user-select: none;
}

.lightbox button {
  position: absolute;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease;
  backdrop-filter: blur(6px);
}
.lightbox button:hover { background: rgba(255,255,255,.2); }
.lb-close { top: 1.2rem; right: 1.2rem; font-size: 1.2rem; }
.lb-prev { left: 1.2rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1.2rem; top: 50%; transform: translateY(-50%); }

.lb-counter {
  position: absolute;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.75);
  font-family: 'Space Grotesk', sans-serif;
  font-size: .85rem;
  letter-spacing: .08em;
}

/* ---------- Responsive ---------- */

@media (max-width: 880px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 2rem; }
  .hero-photo { max-width: 420px; }
  .split { grid-template-columns: 1fr; gap: 1.6rem; }
  #globe-mount { width: 100%; margin: 0; }
}

/* Fix #4: below this width the nav wraps under brand+toggle row */
@media (max-width: 760px) {
  .site-nav { flex-basis: 100%; justify-content: flex-start; padding-bottom: .2rem; }
  #globe-mount { width: 100%; margin: 0; }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .brand span { display: none; }
  .site-nav a { padding: .4rem .7rem; font-size: .88rem; }
  #globe-mount { height: 46vh; }
  .trip-chip { flex-basis: 165px; }
  .report-head, .report-body { padding-left: 1.3rem; padding-right: 1.3rem; }
  .report-gallery { padding-left: 1.3rem; padding-right: 1.3rem; }
  .legend-hint { display: none; }
  .lightbox button { width: 44px; height: 44px; }
  .lb-prev { left: .5rem; }
  .lb-next { right: .5rem; }
  #globe-mount { width: 100%; margin: 0; }
}
