/* PhotoSite - emergency services & aviation photography */

:root {
  --bg: #0b0e13;
  --bg-soft: #111621;
  --panel: #151b26;
  --panel-2: #1b2230;
  --line: #263043;
  --text: #e9edf4;
  --muted: #8d99ad;
  --accent: #ff8c1a;
  --accent-2: #45a8ff;
  --danger: #ff5a5a;
  --radius: 14px;
  --wrap: 1360px;
  --header-h: 65px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -0.02em; }

.wrap { width: min(100% - 40px, var(--wrap)); margin-inline: auto; }

/* ------------------------------------------------------------------ header */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(11, 14, 19, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 24px; padding: 14px 0; }

.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand-mark { width: 34px; height: 34px; flex: none; display: block; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-mark .lm-ring { stroke: #55627a; }
.brand-mark .lm-blades { stroke: var(--accent); }
.brand:hover .lm-ring { stroke: var(--accent-2); }
.brand-mark svg * { transition: stroke .18s; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-text small { color: var(--muted); font-size: .74rem; letter-spacing: .02em; }

.site-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-link {
  padding: 7px 13px; border-radius: 999px; font-size: .9rem; color: var(--muted);
  transition: background .15s, color .15s;
}
.nav-link:hover { color: var(--text); background: var(--panel); }
.nav-link.is-active { color: #0b0e13; background: var(--text); font-weight: 600; }

.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 4px 0; border-radius: 2px; }

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

.hero { padding: 54px 0 26px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: .15em; }
.hero p { color: var(--muted); font-size: 1.05rem; margin: 0; max-width: 62ch; }

/* ------------------------------------------------------------------ filters */

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0 26px; }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; margin-right: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; font-size: .87rem;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  transition: .15s;
}
.chip em { font-style: normal; font-size: .75rem; opacity: .6; }
.chip:hover { color: var(--text); border-color: #3a465e; }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #17120a; font-weight: 600; }
.chip.is-active em { opacity: .75; }

.search { display: flex; gap: 8px; }
.search input {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 9px 14px; border-radius: 999px; min-width: 260px; font: inherit; font-size: .9rem;
}
.search input:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.search button {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 16px; border-radius: 999px; cursor: pointer; font: inherit; font-size: .9rem;
}
.search button:hover { background: var(--accent); color: #17120a; border-color: var(--accent); }

.tagrow { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.tag { font-size: .8rem; color: var(--muted); padding: 4px 10px; border-radius: 6px; background: var(--bg-soft); }
.tag:hover { color: var(--accent); }

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

.grid { columns: 4 320px; column-gap: 18px; padding-bottom: 60px; }

.card {
  break-inside: avoid; display: block; position: relative; margin-bottom: 18px;
  border-radius: var(--radius); overflow: hidden; background: var(--panel);
  border: 1px solid var(--line); transition: transform .22s ease, border-color .22s;
}
.card:hover { transform: translateY(-3px); border-color: #44536e; }
.card-media { position: relative; background: var(--bg-soft); }
/* width/height attributes on the img supply the intrinsic ratio; these two rules
   scale it to the column without losing the reserved space. */
.card-media img { width: 100%; height: auto; }

body.no-scroll { overflow: hidden; }
.card-guard { position: absolute; inset: 0; }

.card-body {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 16px 14px;
  background: linear-gradient(to top, rgba(6, 8, 12, .92), rgba(6, 8, 12, 0));
  opacity: 0; transform: translateY(8px); transition: .22s ease; pointer-events: none;
}
.card:hover .card-body, .card:focus-visible .card-body { opacity: 1; transform: none; }
.card-body h3 { font-size: 1rem; margin: 0 0 2px; }
.card-body p { margin: 0; font-size: .8rem; color: #b5c0d2; }

.reg-chip {
  position: absolute; top: 12px; left: 12px;
  background: rgba(9, 12, 18, .78); backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .16); color: #fff;
  font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  padding: 4px 9px; border-radius: 6px; font-family: "Consolas", ui-monospace, monospace;
}

.empty { color: var(--muted); padding: 60px 0 100px; text-align: center; font-size: 1.05rem; }

/* ------------------------------------------------------------------ photo page */

/* The photo fills the viewport under the header; every detail lives below the fold,
   with a cue so people know to keep going. */
.photo-stage {
  position: relative; background: #05070a;
  /* Deliberately NOT full viewport height: at 100vh the photo pushes every detail
     below the fold, so the caption, rego and EXIF are invisible until you scroll. */
  height: 68vh;
  height: 68svh;
  min-height: 340px;
  /* Flex, not grid: in a grid the row is auto-sized, so the image's max-height:100%
     has no definite height to resolve against and tall photos overflow the stage —
     cropping the bottom of the frame, watermark included. */
  display: flex; align-items: center; justify-content: center;
  padding: 18px 18px 66px;
}
.photo-stage img {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  min-width: 0; min-height: 0; object-fit: contain;
}
.photo-stage .card-guard { inset: 0; }
#hero-img { cursor: zoom-in; }

.backlink-float {
  position: absolute; top: 16px; left: 18px; z-index: 2;
  background: rgba(9, 12, 18, .72); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .12); color: #d7dee9;
  font-size: .84rem; padding: 6px 13px; border-radius: 999px;
}
.backlink-float:hover { color: var(--accent); border-color: var(--accent); }

.scroll-cue {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; cursor: pointer; padding: 6px 14px;
  color: var(--muted); font: inherit; font-size: .72rem;
  letter-spacing: .16em; text-transform: uppercase;
  transition: opacity .3s, color .18s;
}
.scroll-cue:hover { color: var(--accent); }
.scroll-cue.is-hidden { opacity: 0; pointer-events: none; }
.cue-arrow svg { width: 22px; height: 22px; display: block; animation: cue-bob 1.9s ease-in-out infinite; }
@keyframes cue-bob {
  0%, 100% { transform: translateY(0); opacity: .75; }
  50% { transform: translateY(5px); opacity: 1; }
}

.photo-page { padding: 46px 0 70px; scroll-margin-top: var(--header-h); }
.backlink { color: var(--muted); font-size: .88rem; display: inline-block; margin-bottom: 14px; }
.backlink:hover { color: var(--accent); }

.photo-layout { display: grid; grid-template-columns: 1fr 360px; gap: 40px; }
.photo-main h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.subline { color: var(--muted); font-size: .95rem; margin: 0 0 18px; }
.caption { font-size: 1.05rem; line-height: 1.7; color: #cdd6e4; max-width: 68ch; }

.photo-side { display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.panel h2 {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); margin-bottom: 12px; font-weight: 600;
}
.meta { margin: 0; display: grid; gap: 8px; }
.meta-row { display: grid; grid-template-columns: 118px 1fr; gap: 10px; font-size: .9rem; }
.meta-row dt { color: var(--muted); }
.meta-row dd { margin: 0; overflow-wrap: anywhere; }
.meta-row dd a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }

.trackbar { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.track-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 15px; border-radius: 10px; font-size: .9rem; font-weight: 600;
  transition: .16s; border: 1px solid transparent;
}
.track-btn.fr24 {
  background: linear-gradient(135deg, #ffb300, #ff7a00); color: #17120a;
  box-shadow: 0 6px 20px rgba(255, 140, 26, .22);
}
.track-btn.fr24:hover { filter: brightness(1.08); transform: translateY(-1px); }
.track-btn.fr24 strong { font-family: "Consolas", ui-monospace, monospace; letter-spacing: .06em; }
.track-btn.alt { background: var(--panel-2); border-color: var(--line); color: var(--text); justify-content: center; }
.track-btn.alt:hover { border-color: var(--accent-2); color: var(--accent-2); }
.track-go { font-size: 1.05rem; }

.photo-nav { display: flex; justify-content: space-between; margin-top: 40px; border-top: 1px solid var(--line); padding-top: 20px; }
.pn { color: var(--muted); font-size: .92rem; }
.pn:hover { color: var(--accent); }

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

.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(5, 7, 10, .96);
  display: flex; align-items: center; justify-content: center; padding: 40px;
}
.lightbox[hidden] { display: none; }
/* min-width/height:0 stops the flex item inheriting the image's intrinsic size */
.lb-stage {
  margin: 0; display: flex; flex-direction: column; gap: 12px;
  min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; align-items: center;
}
.lb-stage img {
  width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 150px);
  object-fit: contain; border-radius: 8px;
}
.lb-stage figcaption { text-align: center; color: var(--muted); font-size: .9rem; }
.lb-stage figcaption strong { color: var(--text); }
.lb-stage figcaption a { color: var(--accent); text-decoration: underline; }
.lb-close, .lb-prev, .lb-next {
  position: absolute; background: rgba(255, 255, 255, .08); border: 1px solid var(--line);
  color: #fff; cursor: pointer; border-radius: 50%; width: 46px; height: 46px;
  font-size: 1.6rem; line-height: 1; display: grid; place-items: center; transition: .15s;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: var(--accent); color: #17120a; }
.lb-close { top: 22px; right: 22px; }
.lb-prev { left: 22px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 22px; top: 50%; transform: translateY(-50%); }

/* ------------------------------------------------------------------ prose / misc */

/* .wrap already centres the column; constrain the line length on the children so
   body copy stays left-aligned with the page heading instead of floating centre. */
.prose { padding: 10px 0 80px; }
.prose > * { max-width: 74ch; }
.prose h2 { font-size: 1.2rem; margin-top: 1.8em; }
.prose p { color: #c6d0df; }
.prose a { color: var(--accent-2); text-decoration: underline; }
.prose pre {
  background: var(--panel); border: 1px solid var(--line); padding: 14px 16px;
  border-radius: 10px; overflow-x: auto; font-family: "Consolas", ui-monospace, monospace;
}
.center-block { max-width: 620px; margin-inline: auto; padding-top: 60px; }
.errcode { font-size: 3rem; font-weight: 700; color: var(--accent); margin: 0; }

.btn {
  display: inline-block; background: var(--accent); color: #17120a; font-weight: 600;
  padding: 11px 20px; border-radius: 10px; border: 1px solid var(--accent);
  cursor: pointer; font: inherit; font-weight: 600; font-size: .92rem;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); filter: none; }

.loginbox {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; max-width: 380px; margin: 0 auto 120px; display: flex; flex-direction: column; gap: 10px;
}
.loginbox input {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  padding: 11px 14px; border-radius: 9px; font: inherit;
}
.loginbox label { font-size: .82rem; color: var(--muted); }
.formerror { color: var(--danger); font-size: .88rem; margin: 0; }

/* ------------------------------------------------------------------ footer */

.site-footer { border-top: 1px solid var(--line); padding: 30px 0 44px; margin-top: auto; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-footer p { margin: 0; color: var(--muted); font-size: .84rem; }
.footer-links { display: flex; gap: 18px; }
.footer-links a:hover { color: var(--accent); }

/* ------------------------------------------------------------------ admin */

.admin { padding: 30px 0 90px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.admin-head > div { display: flex; gap: 10px; }
.admin h2 { margin-top: 34px; display: flex; align-items: center; gap: 10px; font-size: 1.1rem; }
.count { background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: .78rem; padding: 2px 9px; border-radius: 999px; }

.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 44px 20px;
  text-align: center; color: var(--muted); transition: .18s; background: var(--bg-soft);
}
.dropzone.over { border-color: var(--accent); background: rgba(255, 140, 26, .07); color: var(--text); }
.dropzone p { margin: 0 0 6px; font-size: 1.02rem; }
.linklike { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

.uploads { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.uploads li {
  display: flex; align-items: center; gap: 12px; font-size: .88rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
}
.uploads .state { margin-left: auto; color: var(--muted); font-size: .8rem; }
.uploads .state.ok { color: #4ade80; }
.uploads .state.err { color: var(--danger); }

.adm-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.adm-row {
  display: flex; align-items: center; gap: 14px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
}
.adm-row img { width: 76px; height: 54px; object-fit: cover; border-radius: 7px; flex: none; background: var(--bg-soft); }
.adm-info { display: flex; flex-direction: column; min-width: 0; }
.adm-info strong { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-info span { font-size: .78rem; color: var(--muted); }
.adm-actions { margin-left: auto; display: flex; gap: 8px; }
.mini {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 7px 13px; border-radius: 8px; cursor: pointer; font: inherit; font-size: .82rem;
}
.mini:hover { border-color: var(--accent); color: var(--accent); }
.mini.danger:hover { border-color: var(--danger); color: var(--danger); }

.editor { position: fixed; inset: 0; z-index: 120; background: rgba(5, 7, 10, .8); display: grid; place-items: center; padding: 24px; }
.editor[hidden] { display: none; }
.editor-card {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  width: min(940px, 100%); max-height: 92vh; overflow: auto; position: relative;
}
.editor-card header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-soft); }
.editor-card header h2 { margin: 0; font-size: 1.05rem; }
.editor-card .lb-close { position: static; width: 36px; height: 36px; font-size: 1.3rem; }
.editor-body { display: grid; grid-template-columns: 280px 1fr; gap: 22px; padding: 22px; }
.editor-body img { border-radius: 10px; border: 1px solid var(--line); position: sticky; top: 80px; }
#ed-form { display: grid; gap: 12px; }
#ed-form label { display: grid; gap: 5px; font-size: .8rem; color: var(--muted); }
#ed-form input, #ed-form select, #ed-form textarea {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 10px 12px; border-radius: 9px; font: inherit; font-size: .92rem; width: 100%;
}
#ed-form input:focus, #ed-form select:focus, #ed-form textarea:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }
#ed-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#ed-form .check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .88rem; }
#ed-form .check input { width: auto; }
.hint { font-size: .8rem; color: var(--muted); margin: -4px 0 0; min-height: 1.2em; }
.hint a { color: var(--accent); text-decoration: underline; }
.editor-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1080px) {
  .photo-layout { grid-template-columns: 1fr; gap: 26px; }
  .editor-body { grid-template-columns: 1fr; }
  .editor-body img { position: static; max-height: 240px; object-fit: cover; width: 100%; }
}

@media (max-width: 760px) {
  :root { --header-h: 74px; }          /* brand text wraps to two lines here */
  .photo-stage { padding: 12px 12px 60px; }
  .photo-page { padding: 32px 0 60px; }
  .nav-toggle { display: block; }
  .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-soft); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; padding: 10px 20px 16px; gap: 2px;
  }
  .site-nav.open { display: flex; }
  .nav-link { padding: 11px 12px; border-radius: 8px; }
  .header-inner { position: relative; }
  .grid { columns: 1; }
  .search input { min-width: 0; flex: 1; }
  .search { width: 100%; }
  .lightbox { padding: 16px; }
  .lb-prev, .lb-next { width: 40px; height: 40px; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
  #ed-form .two { grid-template-columns: 1fr; }
  .meta-row { grid-template-columns: 104px 1fr; }
}

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