/* ============================================================================
   Lorn Halcyon — dark, cinematic, minimal.
   Colours live in the :root block below; change them there and the whole
   site follows.
   ========================================================================== */

:root {
  --bg:          #0a0b0d;
  --bg-raised:   #131519;
  --border:      #23262c;
  --text:        #e9e7e2;
  --text-muted:  #969ba3;
  --accent:      #d0a15a;   /* warm brass */
  --accent-dim:  #8d6c3a;

  --wrap:        1200px;
  --radius:      10px;
  --font-body:   -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: ui-serif, Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 24px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 24px; top: 12px;
  z-index: 10;
  background: var(--bg-raised);
  padding: 10px 16px;
  border-radius: var(--radius);
}

/* Shown only when the page is opened as a file:// URL — see app.js. */
.local-notice {
  margin: 0;
  padding: 12px 24px;
  text-align: center;
  font-size: 0.85rem;
  color: #f0d9b0;
  background: #3a2c14;
  border-bottom: 1px solid var(--accent-dim);
}

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

.site-header {
  padding: 88px 0 56px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  /* faint vignette so the page opens like a frame fading up */
  background:
    radial-gradient(80% 120% at 50% 0%, rgba(208, 161, 90, 0.08), transparent 65%);
}

.site-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  margin: 0 0 14px;
}

.tagline {
  margin: 0 auto 28px;
  max-width: 46ch;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.btn {
  display: inline-block;
  padding: 11px 26px;
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn:hover, .btn:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: #10110f;
}

/* --- Big player ------------------------------------------------------------
   Opened by the grid thumbnails. Sized so the screen is as large as the page
   can give it without the title and description falling off the bottom: the
   width is capped by the viewport height as well as its width. ------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox[hidden] { display: none; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 6, 0.92);
  backdrop-filter: blur(8px);
}

.lightbox-panel {
  position: relative;
  width: min(1100px, 94vw, calc((88vh - 170px) * 16 / 9));
  max-height: 94vh;
  overflow-y: auto;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 22px;
  background: none;
  border: 0;
  padding: 2px 8px;
  font-size: 2rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.16s ease;
}
.lightbox-close:hover,
.lightbox-close:focus-visible { color: var(--accent); }

#lightbox-body .player {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}

#lightbox-body h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  margin: 20px 0 6px;
}

.lightbox-meta {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.lightbox-description {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 78ch;
}

/* --- Map of filming locations ---------------------------------------------
   The map is a plain inline SVG built from country outlines in map-data.js —
   no mapping library, no tile server, nothing loaded from a third party. ---- */

#map-section { padding: 64px 24px 0; }

.section-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

.map {
  position: relative;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.map-svg {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
  /* Zoomed-in land is clipped to the frame rather than spilling over it. */
  overflow: hidden;
  /* Let a one-finger vertical swipe scroll the page as usual; two fingers
     pinch and pan the map. Without this the map would trap the whole page. */
  touch-action: pan-y;
}

.map-svg.is-dragging { cursor: grabbing; }

/* --- Zoom controls -------------------------------------------------------- */

.map-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-controls button {
  min-width: 30px;
  padding: 5px 7px;
  background: rgba(10, 11, 13, 0.82);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.1;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.map-controls button:hover:not(:disabled) {
  border-color: var(--accent-dim);
  color: var(--accent);
}

.map-controls button:disabled {
  opacity: 0.35;
  cursor: default;
}

.map-land path {
  fill: #232831;
  stroke: #3b434f;
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

/* --- City labels ----------------------------------------------------------
   Reference points so the map still reads as somewhere once you've zoomed past
   the country borders. Never interactive — clicks fall through to the map. */

.map-cities { pointer-events: none; }

.city-dot { fill: #6b7482; }

.city-label {
  fill: #8b94a2;
  font-family: var(--font-body);
  font-size: 14.5px;
  letter-spacing: 0.02em;
  paint-order: stroke;
  stroke: rgba(19, 21, 25, 0.85);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.pin { cursor: pointer; }

/* Written beside a pin once the map is zoomed in far enough that the land
   around it has nothing else to say. */
.pin-label {
  fill: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  pointer-events: none;
  user-select: none;
  paint-order: stroke;
  stroke: rgba(19, 21, 25, 0.9);
  stroke-width: 3.5px;
  stroke-linejoin: round;
}

.pin.is-selected .pin-label { fill: var(--accent); }

.pin-hit {
  fill: transparent;
  pointer-events: all;
}

.pin-halo {
  fill: rgba(208, 161, 90, 0.16);
  stroke: rgba(208, 161, 90, 0.5);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transition: fill 0.18s ease, stroke 0.18s ease, r 0.18s ease;
}

/* Pins in the Berlin area sit close enough to overlap, so the active one
   grows a little to separate itself. */
.pin:hover .pin-halo,
.pin:focus-visible .pin-halo,
.pin.is-hover .pin-halo,
.pin.is-selected .pin-halo { r: 10.5; }

.pin-dot {
  fill: var(--accent);
  transition: fill 0.18s ease;
}

/* --- Cluster pins ---------------------------------------------------------
   Drawn when several pins would land on top of each other at the current zoom.
   Clicking one zooms in far enough to break it apart. ---------------------- */

.pin-cluster-ring {
  fill: rgba(208, 161, 90, 0.22);
  stroke: var(--accent);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  transition: fill 0.18s ease;
}

.pin-count {
  fill: #f4e3c6;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  pointer-events: none;
  user-select: none;
}

.pin--cluster:hover .pin-cluster-ring,
.pin--cluster:focus-visible .pin-cluster-ring,
.pin--cluster.is-hover .pin-cluster-ring,
.pin--cluster.is-selected .pin-cluster-ring {
  fill: rgba(208, 161, 90, 0.45);
}

/* A cluster of films shot at the same spot can't be split by zooming, so it
   opens the list instead — shown with a dashed ring. */
.pin--stuck .pin-cluster-ring { stroke-dasharray: 4 3; }

.pin:hover .pin-halo,
.pin:focus-visible .pin-halo,
.pin.is-hover .pin-halo,
.pin.is-selected .pin-halo {
  fill: rgba(208, 161, 90, 0.34);
  stroke: var(--accent);
}

.pin:hover .pin-dot,
.pin.is-hover .pin-dot,
.pin.is-selected .pin-dot { fill: #f4e3c6; }

.pin.is-selected .pin-halo { stroke-width: 2; }

.pin:focus { outline: none; }
.pin:focus-visible .pin-dot { fill: #f4e3c6; }

.map-panel h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.3rem;
  margin: 18px 0 4px;
}

.map-panel p {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 0.93rem;
}

.map-place {
  color: var(--accent) !important;
  font-size: 0.78rem !important;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Shown before any pin has been chosen: the same locations as a plain list,
   so the pins aren't the only way to reach a film. */
.map-hint {
  margin: 0 0 14px !important;
  font-size: 0.8rem !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-index {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
  /* Fifteen entries would run well past the map, so the list scrolls. */
  max-height: 430px;
  overflow-y: auto;
}

.map-index li { border-bottom: 1px solid var(--border); }

.map-index button {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 11px 4px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  cursor: pointer;
  transition: color 0.16s ease, padding-left 0.16s ease;
}

.map-index-place {
  color: var(--text-muted);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.map-index button:hover,
.map-index button:focus-visible {
  color: var(--accent);
  padding-left: 10px;
}

.map-back {
  background: none;
  border: 0;
  padding: 0;
  margin-top: 18px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}
.map-back:hover { color: var(--accent); }

.map-alts {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.map-alts button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.map-alts button:hover { color: #f4e3c6; }

@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; gap: 28px; }
}

/* --- Section heads --------------------------------------------------------- */

#videos { padding: 72px 24px 24px; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  margin: 0;
}


/* --- Video grid ----------------------------------------------------------- */

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 40px 28px;
}

.card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.18rem;
  margin: 16px 0 6px;
  line-height: 1.35;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.card time {
  display: block;
  margin-top: 10px;
  color: #7b8189;
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --- Player: a poster image that swaps to a real iframe on click ----------
   Loading 15 YouTube iframes up front costs megabytes and slows the page to a
   crawl. Instead each card shows a thumbnail until you click it. ------------ */

.player {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: var(--bg-raised);
  border-radius: var(--radius);
  overflow: hidden;
}

.player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.facade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: block;
}

.facade img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, opacity 0.3s ease;
  opacity: 0.88;
}

/* The thumbnail below is semi-transparent, which makes it its own stacking
   context painted at z-index 0 — so the play button needs a z-index to sit
   above it rather than behind it. */
.facade::before,
.facade::after { z-index: 1; }

.facade::after {
  /* play triangle */
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  transform: translate(-38%, -50%);
  border-style: solid;
  border-width: 15px 0 15px 25px;
  border-color: transparent transparent transparent var(--text);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
  transition: border-left-color 0.2s ease;
}

.facade::before {
  /* circular scrim behind the triangle */
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 74px;
  height: 74px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(10, 11, 13, 0.62);
  border: 1px solid rgba(233, 231, 226, 0.5);
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.5);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.facade:hover img,
.facade:focus-visible img { transform: scale(1.04); opacity: 1; }

.facade:hover::before,
.facade:focus-visible::before {
  background: rgba(208, 161, 90, 0.9);
  border-color: var(--accent);
}
.facade:hover::after,
.facade:focus-visible::after { border-left-color: #10110f; }

.facade:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

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

.site-footer {
  margin-top: 96px;
  padding: 48px 0 64px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.site-footer p { margin: 4px 0; }

.footer-label {
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 12px !important;
}

.footer-email a {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
  padding-bottom: 2px;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.footer-email a:hover,
.footer-email a:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.footer-email { margin-bottom: 18px !important; }

.footer-legal {
  margin-top: 22px !important;
  color: #7b8189;
  font-size: 0.8rem;
}

/* --- Small screens -------------------------------------------------------- */

@media (max-width: 640px) {
  .wrap { padding-inline: 18px; }
  .site-header { padding: 56px 0 40px; }
  #map-section { padding: 44px 18px 0; }
  #videos { padding: 52px 18px 16px; }
  .map { padding: 8px; }
  .grid { grid-template-columns: 1fr; gap: 34px; }
  .facade::before { width: 60px; height: 60px; }

  /* On a phone the big player takes the full width and the panel scrolls;
     the extra top padding leaves room for the close button above it. */
  .lightbox { padding: 52px 14px 14px; }
  .lightbox-panel { width: 100%; max-height: none; }
  .lightbox-close { top: 8px; right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}
