/* Lochaber Astro
   Palette carried over from the original gallery:
   black background, #aaa text, white links, grey panels and borders. */

:root {
  --black: #000000;
  --panel: #101010;
  --panel-2: #202020;
  --line: #303030;
  --line-2: #505050;
  --muted: #808080;
  --text: #aaaaaa;
  --white: #ffffff;
  --error: #ff6b6b;
  --ok: #9fd3a2;

  --display: "Michroma", "Eurostile", "Arial Black", sans-serif;
  --body: "Hanken Grotesk", "Segoe UI", Arial, Helvetica, sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
  --row-h: 240px;
  --radius: 3px; /* the original gallery used 3px rounded corners */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--black);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--white); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; color: var(--white); line-height: 1.15; margin: 0; letter-spacing: .02em; }
p { margin: 0 0 1em; }
code { font-size: .9em; color: var(--white); }

.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: var(--white); color: var(--black); padding: 8px 12px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 14px var(--gutter);
  background: rgba(0, 0, 0, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.home .site-header {
  position: absolute; left: 0; right: 0;
  background: linear-gradient(rgba(0,0,0,.7), rgba(0,0,0,0));
  border-bottom-color: transparent;
  backdrop-filter: none;
}
.wordmark { text-decoration: none; display: flex; align-items: center; gap: 12px; line-height: 1.2; }
.wordmark-logo { width: 44px; height: 44px; flex: none; }
.wordmark-text { display: grid; }
.wordmark-name { font-family: var(--display); font-size: 1rem; color: var(--white); letter-spacing: .08em; }
.wordmark-sub { font-size: .8rem; color: var(--text); letter-spacing: .04em; }
.home .wordmark { visibility: hidden; } /* the hero already carries the name */

.site-nav ul { display: flex; flex-wrap: wrap; gap: 4px 26px; list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--text); text-decoration: none; font-size: .95rem; padding: 6px 0; border-bottom: 1px solid transparent; }
.site-nav a:hover { color: var(--white); }
.site-nav a[aria-current="page"] { color: var(--white); border-bottom-color: var(--white); }

.nav-toggle { display: none; background: none; border: 1px solid var(--line-2); border-radius: var(--radius); width: 44px; height: 40px; cursor: pointer; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display: block; width: 18px; height: 1px; background: var(--white); margin: 0 auto; position: relative; transition: transform .2s; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .site-nav { position: absolute; top: 100%; left: 0; right: 0; background: var(--black); border-bottom: 1px solid var(--line); display: none; }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; padding: 8px var(--gutter) 16px; }
  .site-nav a { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .site-nav a[aria-current="page"] { border-bottom-color: var(--line); padding-left: 10px; border-left: 2px solid var(--white); }
  .home .site-header { background: rgba(0,0,0,.6); }
}

/* ---------- Home: hero ---------- */
.hero {
  position: relative;
  min-height: 50svh; /* was 100svh: half-height hero (Nov 2026) */
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 96px var(--gutter) clamp(24px, 4vh, 44px);
  overflow: hidden;
  isolation: isolate;
}
.hero-slides { position: absolute; inset: 0; z-index: -1; background: var(--black); }
.hero-slide {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0;
  transition: opacity 2.4s ease;
  transform: scale(1.04);
}
.hero-slide.is-active { opacity: 1; animation: drift 14s linear forwards; }
@keyframes drift { from { transform: scale(1.04); } to { transform: scale(1.12); } }
.hero::after { /* keeps the text readable on bright nebulae */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.25) 45%, rgba(0,0,0,0) 70%);
}
.hero-logo { width: clamp(44px, 4.5vw, 100px); height: auto; margin-bottom: clamp(10px, 1.5vh, 16px); filter: drop-shadow(0 4px 24px rgba(0,0,0,.6)); }
.hero-title {
  font-size: clamp(1.6rem, 5.25vw, 4.75rem); /* was clamp(2.6rem, 10.5vw, 9.5rem) */
  line-height: .98;
  letter-spacing: .04em;
  text-shadow: 0 2px 30px rgba(0,0,0,.5);
}
.hero-title span { display: block; }
.hero-title span + span { padding-left: .9em; color: var(--text); }
.hero-sub { max-width: 38ch; margin: .9rem 0 0; font-size: clamp(1rem, 1.6vw, 1.2rem); color: var(--white); }
.hero-scroll {
  align-self: flex-start; margin-top: 1.2rem;
  color: var(--text); text-decoration: none; font-size: .95rem;
  padding-bottom: 4px; border-bottom: 1px solid var(--line-2);
}
.hero-scroll:hover { color: var(--white); border-color: var(--white); }

/* ---------- Home: one row per gallery ---------- */
.gallery-rows { padding: 0 var(--gutter); }
.gallery-row {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: clamp(20px, 3vw, 48px);
  padding: clamp(36px, 5vw, 64px) 0;
  border-top: 1px solid var(--line);
}
.gallery-row:first-child { border-top: 0; }
.gallery-row-head h2 { font-size: clamp(1.4rem, 2.4vw, 2rem); margin-bottom: .7rem; }
.gallery-row-head h2 a { color: var(--white); text-decoration: none; }
.gallery-row-head h2 a:hover { text-decoration: underline; }
.gallery-row-intro { max-width: 34ch; }
.gallery-row-meta { font-size: .9rem; color: var(--muted); }

.gallery-row-strip { display: flex; gap: 8px; height: var(--row-h); min-width: 0; text-decoration: none; }
.gallery-row-strip figure {
  position: relative; margin: 0; min-width: 0;
  flex: var(--ar) 1 0;
  background: var(--panel-2); border-radius: var(--radius); overflow: hidden;
}
.gallery-row-strip img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease, opacity .3s; }
.gallery-row-strip figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 24px 12px 10px; font-size: .85rem; color: var(--white);
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gallery-row-strip:hover img { opacity: .75; }
.gallery-row-strip figure:hover img { opacity: 1; transform: scale(1.03); }
.empty-strip { align-self: center; color: var(--muted); }

@media (max-width: 860px) {
  .gallery-row { grid-template-columns: 1fr; }
  .gallery-row-strip { height: auto; flex-wrap: wrap; }
  .gallery-row-strip figure { flex: 1 1 calc(50% - 4px); aspect-ratio: 4 / 3; }
}

/* ---------- Buttons ---------- */
.button {
  display: inline-block;
  font: 500 .95rem/1 var(--body);
  color: var(--text); background: var(--black);
  border: 1px solid var(--muted); border-radius: var(--radius);
  padding: 12px 18px; text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--white); color: var(--black); border-color: var(--white); }
.button-primary { color: var(--black); background: var(--text); border-color: var(--text); }
.button-primary:hover { background: var(--white); }

/* ---------- Gallery page ---------- */
.gallery-head {
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 16px 40px;
  padding: clamp(32px, 5vw, 64px) var(--gutter) 28px;
}
.gallery-head h1 { font-size: clamp(1.9rem, 5vw, 3.6rem); grid-column: 1; }
.gallery-intro { grid-column: 1; max-width: 73ch; margin: 0; }
.gallery-count { color: var(--muted); }
.gallery-search { grid-column: 2; grid-row: 1 / span 2; align-self: end; width: min(320px, 100%); }
.gallery-search label { display: block; font-size: .85rem; margin-bottom: 6px; }
.filter-status { font-size: .85rem; color: var(--muted); min-height: 1.4em; margin: 6px 0 0; }
@media (max-width: 700px) {
  .gallery-head { grid-template-columns: 1fr; }
  .gallery-search { grid-column: 1; grid-row: auto; width: 100%; }
}

.justified {
  list-style: none; margin: 0; padding: 0 var(--gutter) 64px;
  display: flex; flex-wrap: wrap; gap: 28px 10px;
}
.justified::after { content: ""; flex: 999 1 0; } /* stops the last row stretching */
.justified li { flex: var(--ar) 1 calc(var(--ar) * var(--row-h)); min-width: 0; }
.justified li[hidden] { display: none; }
.tile { display: block; text-decoration: none; color: inherit; }
.tile img {
  width: 100%; height: auto; aspect-ratio: var(--ar);
  object-fit: cover; background: var(--panel-2); border-radius: var(--radius);
  transition: opacity .25s;
}
.tile:hover img { opacity: .82; }
.tile-caption { display: block; padding-top: 8px; }
.tile-title { display: block; color: var(--white); font-size: .95rem; line-height: 1.35; }
.tile-meta { display: block; color: var(--muted); font-size: .85rem; white-space: pre; }
.tag { font-size: .75rem; color: var(--text); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 0 5px; margin-left: 4px; vertical-align: 1px; }
.empty { padding: 0 var(--gutter) 80px; }
@media (max-width: 1000px) { :root { --row-h: 180px; } }
@media (max-width: 600px) { :root { --row-h: 150px; } .justified { gap: 20px 8px; } }

/* ---------- Image viewer ---------- */
.viewer {
  position: fixed; inset: 0; z-index: 50;
  display: grid; grid-template-rows: 1fr auto;
  background: var(--black);
}
.viewer[hidden] { display: none; }
.viewer-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 56px 72px 12px; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; border: 1px solid var(--line); transition: opacity .3s; }
.viewer.is-loading .viewer-img { opacity: .35; }
.viewer-loading { position: absolute; width: 36px; height: 36px; border: 2px solid var(--line-2); border-top-color: var(--white); border-radius: 50%; animation: spin 1s linear infinite; opacity: 0; }
.viewer.is-loading .viewer-loading { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.viewer-bar {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  padding: 16px var(--gutter) 22px; border-top: 1px solid var(--line);
}
.viewer-title { font-size: clamp(1rem, 2vw, 1.35rem); margin-bottom: 6px; }
.viewer-meta, .viewer-details { margin: 0; font-size: .9rem; }
.viewer-details { color: var(--muted); }
.viewer-actions { display: flex; align-items: center; gap: 20px; white-space: nowrap; font-size: .9rem; }
.viewer-count { color: var(--muted); }
.viewer-btn {
  position: absolute; display: grid; place-items: center;
  width: 48px; height: 48px; padding: 0;
  background: rgba(0,0,0,.5); color: var(--white);
  border: 1px solid var(--line-2); border-radius: var(--radius); cursor: pointer;
}
.viewer-btn:hover { background: var(--white); color: var(--black); }
.viewer-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.viewer-prev { left: 12px; top: 45%; }
.viewer-next { right: 12px; top: 45%; }
.viewer-close { right: 12px; top: 12px; }
@media (max-width: 700px) {
  .viewer-stage { padding: 64px 8px 8px; }
  .viewer-prev, .viewer-next { top: auto; bottom: 12px; }
  .viewer-bar { flex-direction: column; align-items: flex-start; padding-bottom: 76px; }
}

/* ---------- Forms (contact + upload) ---------- */
.form-page {
  display: grid; grid-template-columns: minmax(220px, 340px) minmax(0, 620px); gap: 24px 64px;
  padding: clamp(32px, 5vw, 72px) var(--gutter) 80px;
}
.form-page > :not(.form-intro) { grid-column: 2; }
.form-intro { grid-row: 1 / span 6; }
.form-intro h1 { font-size: clamp(1.9rem, 4vw, 3rem); margin-bottom: 1rem; }
@media (max-width: 820px) {
  .form-page { grid-template-columns: 1fr; }
  .form-page > :not(.form-intro) { grid-column: 1; }
  .form-intro { grid-row: auto; }
}

.form { display: grid; gap: 22px; }
.form > .button { justify-self: start; }
.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field label, .field legend { color: var(--white); font-size: .95rem; padding: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], textarea {
  width: 100%; font: inherit; color: var(--white);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 12px 14px;
}
textarea { resize: vertical; min-height: 160px; }
input:focus, textarea:focus { outline: none; border-color: var(--white); box-shadow: 0 0 0 1px var(--white); }
::placeholder { color: #5c5c5c; }
.field-check input { max-width: 120px; }
.has-error input, .has-error textarea { border-color: var(--error); }
.field-error { color: var(--error); font-size: .9rem; margin: 0; }
.hint { color: var(--muted); font-size: .85rem; margin: 0; }
.field-hp { position: absolute; left: -9999px; }

.notice { border: 1px solid var(--line-2); border-left-width: 3px; border-radius: var(--radius); padding: 16px 18px; background: var(--panel); }
.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }
.notice h2 { font-size: 1.2rem; margin-bottom: .6rem; }
.notice-ok { border-left-color: var(--ok); }
.notice-error { border-left-color: var(--error); }
.notice-error p { color: var(--white); }
.code-line { white-space: pre-wrap; word-break: break-all; background: var(--black); border: 1px solid var(--line); padding: 12px; color: var(--white); font-size: .85rem; }

.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.field .choice {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px 14px; cursor: pointer;
  color: var(--text) !important;
}
.field .choice:has(input:checked) { border-color: var(--white); color: var(--white) !important; background: var(--panel-2); }
.choice input { accent-color: var(--white); margin: 0; }

.dropzone { position: relative; border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 28px 20px; background: var(--panel); text-align: center; }
.dropzone.is-over { border-color: var(--white); background: var(--panel-2); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone:focus-within { border-color: var(--white); }
.dropzone-text { margin: 0; }
.link-like { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }
.dropzone-list { list-style: none; margin: 12px 0 0; padding: 0; font-size: .9rem; color: var(--white); text-align: left; }
.dropzone-list:empty { display: none; }
.dropzone-list li { padding: 4px 0; border-top: 1px solid var(--line); }
.upload-progress { color: var(--white); }

.upload-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.upload-results li { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: start; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.upload-results img { border-radius: var(--radius); }
.upload-title { color: var(--white); margin-bottom: 4px; }
.upload-meta { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.no-thumb { font-size: .85rem; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--black); }
.footer-inner {
  display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 32px 56px; align-items: start;
  padding: 44px var(--gutter) 40px; font-size: .92rem;
}
.footer-name { font-family: var(--display); color: var(--white); font-size: .95rem; letter-spacing: .06em; display: flex; align-items: center; gap: 12px; }
.footer-name img { flex: none; }
.footer-about p:last-child { max-width: 52ch; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-links a { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.footer-links a:hover { color: var(--white); }
.footer-legal { text-align: right; }
.footer-legal .pi-logo { display: inline-block; opacity: .8; }
.footer-legal .pi-logo:hover { opacity: 1; }
.footer-policies { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 18px; }
.footer-policies a { color: var(--text); }
.footer-policies a:hover { color: var(--white); }
@media (max-width: 820px) { .footer-policies { justify-content: flex-start; } }

/* ---------- Privacy policy and terms of use ---------- */
.legal { max-width: 72ch; padding: clamp(32px, 5vw, 72px) var(--gutter) 80px; }
.legal-head h1 { font-size: clamp(1.9rem, 4vw, 3rem); margin-bottom: .8rem; }
.legal-sub { color: var(--muted); font-size: .95rem; }
.legal h2 { font-size: 1.15rem; margin: 2.4rem 0 .8rem; }
.legal p, .legal li { line-height: 1.7; }
.legal ul { padding-left: 1.2em; margin: 0 0 1em; }
.legal li + li { margin-top: .35em; }
.legal strong { color: var(--white); font-weight: 600; }
.legal-summary { border: 1px solid var(--line-2); border-left: 3px solid var(--text); border-radius: var(--radius); background: var(--panel); padding: 18px 22px 8px; margin: 1.6rem 0 2rem; }
.legal-summary h2 { margin-top: 0; }
.table-wrap { overflow-x: auto; margin: 0 0 1em; }
.legal table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 520px; border: 1px solid var(--muted); }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 10px 12px; border: 1px solid var(--muted); }
.legal th { color: var(--white); background: var(--panel-2); font-weight: 500; border-bottom: 2px solid var(--text); }

@media (max-width: 820px) { .footer-inner { grid-template-columns: 1fr; } .footer-legal { text-align: left; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-slide { transition-duration: .01s; }
  .hero-slide.is-active { animation: none; transform: none; }
  .gallery-row-strip img, .tile img { transition: none; }
}
