/* ================================================================
   1010 Drones — Client Portal
   Type system: Rajdhani (display) · Inter (body) · IBM Plex Mono (data)
   Brand color is injected at runtime as --brand from Airtable.
   ================================================================ */

:root {
  --brand: #ff6a00;          /* fallback; overwritten per client */
  --brand-ink: #ffffff;      /* text color on brand; computed in JS */
  --ink: #171a1f;
  --ink-soft: #3c4048;
  --mut: #6c7078;
  --paper: #fafaf8;
  --card: #ffffff;
  --line: #e6e4de;
  --strip: #16181d;
  --strip-ink: #eceae4;
  --f-disp: "Rajdhani", "Arial Narrow", sans-serif;
  --f-body: "Inter", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 6px;
  --container: 1200px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
}

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

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

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------------------------------- loader ---------------------------------- */

#loader {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
}
#loader p { color: var(--mut); font-size: 12px; letter-spacing: 0.14em; }

.loader-mark {
  width: 34px; height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loader-mark.small { width: 20px; height: 20px; border-width: 2px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------- not found ---------------------------------- */

#notFound {
  max-width: 560px;
  margin: 0 auto;
  padding: 22vh 24px 0;
  text-align: center;
}
#notFound .nf-eyebrow {
  font-size: 12px; letter-spacing: 0.16em; color: var(--brand); margin: 0 0 10px;
}
#notFound h1 {
  font-family: var(--f-disp);
  font-weight: 700; font-size: 28px; line-height: 1.2;
  text-transform: uppercase; letter-spacing: 0.02em;
  margin: 0 0 12px;
}
#notFound p:last-child { color: var(--mut); }

/* ---------------------------------- 1 · top bar ---------------------------------- */

#topbar {
  height: 76px;
  background: var(--brand);
  color: var(--brand-ink);
  display: flex; align-items: center;
  gap: 14px;
  padding: 0 16px;
}

#clientLogo {
  max-height: 44px; max-width: 130px;
  object-fit: contain;
  flex: 0 0 auto;
}

#jobTitle {
  font-family: var(--f-disp);
  font-weight: 700;
  font-size: clamp(17px, 4vw, 24px);
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#projectSwitchWrap { flex: 0 0 auto; }

#projectSwitch {
  appearance: none; -webkit-appearance: none;
  font-family: var(--f-mono); font-size: 12px;
  color: var(--brand-ink);
  background:
    linear-gradient(45deg, transparent 50%, currentColor 50%) calc(100% - 15px) 55% / 5px 5px no-repeat,
    linear-gradient(-45deg, transparent 50%, currentColor 50%) calc(100% - 10px) 55% / 5px 5px no-repeat,
    rgba(0, 0, 0, 0.12);
  border: 1px solid currentColor;
  border-radius: var(--radius);
  padding: 7px 30px 7px 10px;
  max-width: 46vw;
  cursor: pointer;
}
#projectSwitch option { color: #171a1f; background: #fff; }

/* ---------------------------------- 2 · hero ---------------------------------- */

#heroWrap {
  margin: 0;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 72vh;
  background: #dddbd4;
  overflow: hidden;
}
#heroImage { width: 100%; height: 100%; object-fit: cover; }

@media (min-width: 720px) {
  #heroWrap { aspect-ratio: 16 / 8.5; }
}

/* ---------------------------------- flight strip (signature) ---------------------------------- */

#flightStrip { background: var(--strip); color: var(--strip-ink); }

.strip-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex; flex-wrap: wrap;
  gap: 10px 34px;
  align-items: center;
}

.strip-item { display: flex; align-items: baseline; gap: 10px; min-width: 0; }

.strip-label {
  font-family: var(--f-disp);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--brand);
}

.strip-item .mono {
  font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#flightSelect {
  appearance: none; -webkit-appearance: none;
  font-family: var(--f-mono); font-size: 13px;
  color: var(--strip-ink);
  background:
    linear-gradient(45deg, transparent 50%, currentColor 50%) calc(100% - 13px) 55% / 5px 5px no-repeat,
    linear-gradient(-45deg, transparent 50%, currentColor 50%) calc(100% - 8px) 55% / 5px 5px no-repeat,
    transparent;
  border: 1px solid #3a3e46;
  border-radius: var(--radius);
  padding: 5px 28px 5px 9px;
  cursor: pointer;
}
#flightSelect option { color: #171a1f; background: #fff; }
#flightSelect:disabled {
  background-image: none;
  padding-right: 9px;
  border-color: transparent;
  opacity: 1;
  cursor: default;
}

/* ---------------------------------- layout ---------------------------------- */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 8px 16px 48px;
}

section { margin-top: 34px; }

.section-head {
  font-family: var(--f-disp);
  font-weight: 700;
  font-size: 21px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.tick {
  width: 10px; height: 10px;
  background: var(--brand);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  flex: 0 0 auto;
}

.head-count {
  font-size: 12px; font-weight: 400;
  color: var(--mut);
  letter-spacing: 0.08em;
  margin-left: auto;
}

/* ---------------------------------- about / notes ---------------------------------- */

#aboutSection { margin-top: 26px; }

.job-desc { margin: 0; max-width: 68ch; color: var(--ink-soft); }

.flight-notes {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  padding: 12px 14px;
  max-width: 68ch;
}
.flight-notes::before {
  content: "FLIGHT NOTES";
  display: block;
  font-size: 10px; letter-spacing: 0.16em;
  color: var(--mut);
  margin-bottom: 6px;
}

/* ---------------------------------- media loading / empty ---------------------------------- */

.media-loading {
  margin-top: 34px;
  display: flex; align-items: center; gap: 12px;
  color: var(--mut); font-size: 12px; letter-spacing: 0.14em;
}

.media-empty {
  margin-top: 34px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 34px 20px;
  text-align: center;
}
.media-empty .mono {
  margin: 0 0 6px;
  font-size: 12px; letter-spacing: 0.16em; color: var(--brand);
}
.media-empty p:last-child { margin: 0; color: var(--mut); }

/* ---------------------------------- 3 · videos ---------------------------------- */

#videoList { display: grid; gap: 20px; }

#videoList video {
  width: 100%;
  border-radius: var(--radius);
  background: #000;
  aspect-ratio: 16 / 9;
}

/* ---------------------------------- 4 · photo grid ---------------------------------- */

.photo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 560px)  { .photo-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 860px)  { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1080px) { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1400px) { .photo-grid { grid-template-columns: repeat(5, 1fr); } }

.photo-cell {
  padding: 0; border: 0;
  background: #e3e1da;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  cursor: pointer;
}
.photo-cell img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, opacity 0.3s ease;
  opacity: 0;
}
.photo-cell img.loaded { opacity: 1; }

@media (hover: hover) {
  .photo-cell:hover img { transform: scale(1.04); }
}

/* ---------------------------------- accordions (5 & 6) ---------------------------------- */

.acc {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}

.acc-head {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: none; border: 0;
  cursor: pointer;
  font: inherit; color: inherit;
  text-align: left;
}

.acc-title {
  font-family: var(--f-disp);
  font-weight: 700;
  font-size: 19px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 10px;
}

.chev {
  width: 9px; height: 9px;
  border-right: 2px solid var(--mut);
  border-bottom: 2px solid var(--mut);
  transform: rotate(45deg);
  transition: transform 0.25s ease;
  flex: 0 0 auto;
  margin-right: 3px;
}
.acc-head[aria-expanded="true"] .chev { transform: rotate(-135deg); }

.acc-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}
.acc-body.open { grid-template-rows: 1fr; }
.acc-inner { overflow: hidden; padding: 0 16px; }
.acc-body.open .acc-inner { padding-bottom: 16px; }

/* ---------------------------------- 5 · ortho + compare ---------------------------------- */

.ortho-tools {
  display: flex; flex-wrap: wrap;
  align-items: center; gap: 12px;
  margin-bottom: 14px;
}

.ghost-btn {
  font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink);
  background: none;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.ghost-btn[aria-pressed="true"] {
  background: var(--strip);
  color: var(--strip-ink);
  border-color: var(--strip);
}

#compareControls { display: flex; gap: 12px; flex-wrap: wrap; }
#compareControls label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--mut);
}
#compareControls select {
  font-family: var(--f-mono); font-size: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 6px 8px;
  color: var(--ink);
}

#orthoSingle { margin: 0; }
#orthoImage, #compareStage {
  width: 100%;
  border-radius: var(--radius);
  background: #e3e1da;
}

#compareStage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  touch-action: none;
  user-select: none;
}
@media (min-width: 720px) { #compareStage { aspect-ratio: 16 / 9; } }

#compareStage img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* Full-size overlay clipped with clip-path so both images stay pixel-aligned */
#compareClip {
  position: absolute; inset: 0;
  clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0);
}

#compareHandle {
  position: absolute; top: 0; bottom: 0;
  left: var(--pos, 50%);
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  cursor: ew-resize;
}
.handle-grip {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  display: flex; align-items: center; justify-content: center;
}
.handle-grip::before {
  content: "\2194";
  font-size: 17px;
  color: var(--ink);
}

.compare-tag {
  position: absolute; bottom: 10px;
  font-size: 11px;
  letter-spacing: 0.1em;
  background: rgba(22, 24, 29, 0.82);
  color: var(--strip-ink);
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
}
.tag-left { left: 10px; }
.tag-right { right: 10px; }

/* ---------------------------------- 6 · 3D model ---------------------------------- */

#modelFrameWrap iframe {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 0;
  border-radius: var(--radius);
  background: #e3e1da;
}
@media (min-width: 720px) { #modelFrameWrap iframe { aspect-ratio: 16 / 9; } }

/* ---------------------------------- 7 · download ---------------------------------- */

.download-wrap { margin-top: 34px; display: flex; }

.download-btn {
  flex: 1 1 auto;
  text-align: center;
  font-family: var(--f-disp);
  font-weight: 700;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--brand-ink);
  background: var(--brand);
  border-radius: var(--radius);
  padding: 15px 22px;
  transition: filter 0.2s ease, transform 0.15s ease;
}
.download-btn:hover { filter: brightness(0.92); }
.download-btn:active { transform: translateY(1px); }

@media (min-width: 720px) {
  .download-wrap { justify-content: center; }
  .download-btn { flex: 0 0 auto; min-width: 380px; }
}

/* ---------------------------------- 8 · footer ---------------------------------- */

#siteFooter {
  border-top: 1px solid var(--line);
  padding: 22px 16px 30px;
  text-align: center;
}
#siteFooter .mono {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--mut);
  text-transform: uppercase;
}

/* ---------------------------------- lightbox ---------------------------------- */

#lightbox {
  position: fixed; inset: 0;
  z-index: 60;
  background: rgba(12, 13, 16, 0.94);
  display: flex; align-items: center; justify-content: center;
}
#lightbox[hidden] { display: none; }

#lbImage {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 4px;
}

.lb-btn {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 0;
  border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 26px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.22); }

.lb-close { top: 14px; right: 14px; }
.lb-nav { top: 50%; transform: translateY(-50%); }
#lbPrev { left: 10px; }
#lbNext { right: 10px; }

#lbCounter {
  position: absolute;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  letter-spacing: 0.12em;
}

/* ---------------------------------- desktop polish ---------------------------------- */

@media (min-width: 720px) {
  #topbar { height: 84px; padding: 0 28px; gap: 20px; }
  #clientLogo { max-height: 52px; max-width: 180px; }
  .container { padding: 14px 28px 64px; }
  .strip-inner { padding: 13px 28px; }
  section { margin-top: 44px; }
}

/* ---------------------------------- reduced motion ---------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
