/* ==========================================================================
   Ravetracer Photography – static site styles.
   Colours: --accent, --bg and --text can be overridden in site.json (theme).
   ========================================================================== */

@font-face { font-family: "Inter"; font-weight: 400 500; font-display: swap; src: url("../fonts/Inter-Medium.ttf") format("truetype"); }
@font-face { font-family: "Inter"; font-weight: 600 800; font-display: swap; src: url("../fonts/Inter-Bold.ttf") format("truetype"); }

:root {
  --bg: #0d0e10;
  --text: #ecebe7;
  --accent: #9fd18b;
  --text-dim: color-mix(in oklab, var(--text) 68%, transparent);
  --text-faint: color-mix(in oklab, var(--text) 45%, transparent);
  --surface: color-mix(in oklab, var(--text) 6%, var(--bg));
  --surface-2: color-mix(in oklab, var(--text) 11%, var(--bg));
  --border: color-mix(in oklab, var(--text) 12%, transparent);
  --maxw: 1320px;
  --gutter: 16px;
  --gap: 6px;
  --radius: 4px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}
@media (min-width: 700px) { :root { --gutter: 32px; --gap: 10px; } }
@media (min-width: 1100px) { :root { --gap: 14px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font: 400 16px/1.6 var(--font);
  color: var(--text);
  background: var(--bg);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.15; }
svg { width: 1.2em; height: 1.2em; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: 8px; transform: translateY(-200%); z-index: 50; padding: 8px 12px; background: var(--accent); color: var(--bg); border-radius: var(--radius); }
.skip:focus { transform: none; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.main { flex: 1; }

/* -------------------------------------------------------------- top bar */

.topbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--gutter);
  padding-top: max(18px, env(safe-area-inset-top));
}
.brand {
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}
.page-home .brand { visibility: hidden; }
.nav { display: flex; gap: 22px; }
.nav a {
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
  opacity: 0.85;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}
.nav a:hover { opacity: 1; }
.page-text .topbar, .page-photo .topbar { position: static; border-bottom: 1px solid var(--border); }

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

.hero {
  position: relative;
  display: grid;
  place-items: end center;
  min-height: 44vh;
  padding: 110px var(--gutter) 44px;
  background: var(--hero-color, var(--surface));
  overflow: hidden;
  isolation: isolate;
  text-align: center;
}
.hero-home { min-height: min(58vh, 620px); place-items: center; }
.hero-img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.hero::after {
  content: "";
  position: absolute;
  inset: 0 0 -2px;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.05) 30%, rgba(0, 0, 0, 0.1) 55%, var(--bg)),
    radial-gradient(ellipse 60% 45% at 50% 45%, rgba(0, 0, 0, 0.25), transparent);
}
.hero-inner { max-width: 900px; }
.hero h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4.6vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
}
.hero-home h1 {
  font-size: clamp(1.8rem, 5.4vw, 3.6rem);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.hero-sub { margin: 14px 0 0; color: var(--text-dim); font-size: clamp(0.95rem, 1.6vw, 1.1rem); text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7); }
.kicker {
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--text) 82%, transparent);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
}

/* -------------------------------------------------------------- home: filters + cards */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin: 8px 0 22px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-dim);
}
.chip:hover { color: var(--text); border-color: var(--text-faint); }
.chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.search { flex: 0 1 280px; margin-left: auto; }
@media (max-width: 559px) { .search { flex-basis: 100%; } }
.search input {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
.search input::placeholder { color: var(--text-faint); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: calc(var(--gap) * 2.4);
  padding-bottom: 64px;
}
@media (min-width: 560px) and (max-width: 899px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.card {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--c, var(--surface));
  text-decoration: none;
  isolation: isolate;
}
.card img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease), filter 0.5s; }
.card-info {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 48px 18px 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.35) 60%, transparent);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.card-title { font-weight: 700; font-size: 1.08rem; line-height: 1.25; text-wrap: balance; }
.card-meta { font-size: 0.8rem; color: color-mix(in oklab, var(--text) 75%, transparent); }
.card-star { position: absolute; top: 12px; right: 12px; color: #ffd36b; filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.7)); }
.card:hover img, .card:focus-visible img { transform: scale(1.045); }
@media (hover: hover) {
  .titles-hover .card-info { opacity: 0; transform: translateY(8px); }
  .titles-hover .card:hover .card-info, .titles-hover .card:focus-visible .card-info { opacity: 1; transform: none; }
  .titles-hover .card:hover img { filter: brightness(0.9); }
}
.empty { padding: 40px 0 80px; color: var(--text-dim); text-align: center; }

/* -------------------------------------------------------------- gallery page */

.gallery { padding-bottom: 40px; }
.gallery-actions { display: flex; justify-content: flex-end; margin: 4px 0 18px; }
.story > * + * { margin-top: 28px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-decoration: none;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-faint); }
.btn-ghost svg { width: 1.05em; height: 1.05em; }

.prose { max-width: 720px; margin-inline: auto; font-size: 1.05rem; line-height: 1.75; color: color-mix(in oklab, var(--text) 88%, transparent); }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 { margin: 1.8em 0 0.6em; font-size: 1.45rem; color: var(--text); }
.prose h3 { margin: 1.5em 0 0.5em; font-size: 1.15rem; color: var(--text); }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose blockquote { margin: 1.4em 0; padding: 2px 0 2px 20px; border-left: 3px solid var(--accent); color: var(--text-dim); font-style: italic; }
.prose code { padding: 0.1em 0.35em; border-radius: 4px; background: var(--surface-2); font-size: 0.9em; }
.prose pre { padding: 14px 16px; overflow-x: auto; border-radius: var(--radius); background: var(--surface); }
.prose pre code { padding: 0; background: none; }
.prose hr { margin: 2.2em auto; width: 80px; border: 0; border-top: 1px solid var(--border); }
.prose img { height: auto; border-radius: var(--radius); }

/* An inline photo ({{photo file.jpg}} or a Markdown image of this gallery) */
.inline-photo { margin: 0; }
.inline-photo a { display: block; }
.inline-photo img { width: 100%; height: auto; border-radius: var(--radius); background: var(--c, var(--surface)); }
.inline-photo figcaption { margin-top: 10px; text-align: center; font-size: 0.9rem; color: var(--text-dim); }
.story > .inline-photo { max-width: 1100px; margin-inline: auto; }

/* Grids */
.grid { --cols: 2; display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: var(--gap); }
@media (min-width: 560px) { .grid { --cols: 3; } }
@media (min-width: 900px) { .grid { --cols: 4; } }
.tile {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--c, var(--surface));
}
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease), opacity 0.3s; }
.tile:hover img { transform: scale(1.04); }
.tile:target, .tile.is-target { outline: 2px solid var(--accent); outline-offset: 2px; }

.layout-square .tile { aspect-ratio: 1; }

/* Justified rows: every tile grows in proportion to its aspect ratio. */
.layout-justified { --row: 200px; display: flex; flex-wrap: wrap; }
@media (min-width: 900px) { .layout-justified { --row: 280px; } }
.layout-justified .tile { flex: calc(var(--ar) * 100) 1 calc(var(--ar) * var(--row)); aspect-ratio: var(--ar); }
.layout-justified::after { content: ""; flex: 1e4 1 0; }

/* Masonry: columns, original aspect ratios. */
.layout-masonry { display: block; columns: var(--cols); column-gap: var(--gap); }
.layout-masonry .tile { margin-bottom: var(--gap); break-inside: avoid; aspect-ratio: var(--ar); }

/* Text and grid are put together in the browser; hide the static grid until then. */
.js .gallery[data-text] .story:not(.is-ready) { opacity: 0; }
.story { transition: opacity 0.25s; }

/* Prev / next gallery */
.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.pager a { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text-dim); }
.pager a:hover { color: var(--text); }
.pager span { display: flex; flex-direction: column; line-height: 1.3; }
.pager small { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }
.pager-next { justify-content: flex-end; text-align: right; }
.pager-all { padding: 10px; border: 1px solid var(--border); border-radius: 50%; }
@media (max-width: 559px) { .pager a span { font-size: 0.85rem; } }

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

.photo-view { padding-bottom: 40px; }
.photo-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: calc(100svh - 140px);
  min-height: 320px;
  padding: 16px var(--gutter);
  background: radial-gradient(ellipse at center, color-mix(in oklab, var(--c) 22%, var(--bg)), var(--bg) 75%);
}
.photo-main { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 0; cursor: zoom-in; }
.photo-main img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9); }
.photo-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: 48px;
  height: 72px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  opacity: 0.75;
  transition: opacity 0.2s, background 0.2s;
}
.photo-nav:hover { opacity: 1; background: rgba(0, 0, 0, 0.6); }
.photo-nav svg { width: 28px; height: 28px; }
.photo-prev { left: 8px; }
@media (max-width: 699px) {
  .photo-stage { height: auto; min-height: 0; padding: 0; background: none; }
  .photo-main img { max-height: 82svh; box-shadow: none; }
  .photo-nav { width: 36px; height: 56px; }
}
.photo-next { right: 8px; }
.photo-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px 32px;
  padding-top: 20px;
}
.photo-caption { margin: 0 0 4px; font-size: 1.35rem; font-weight: 700; }
.photo-caption.is-plain span { font-weight: 500; color: var(--text-dim); }
.photo-from { margin: 0; color: var(--text-dim); }
.photo-from a { color: var(--text); }
.photo-exif { margin: 8px 0 0; font-size: 0.85rem; color: var(--text-faint); }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* -------------------------------------------------------------- text pages */

.legal { max-width: 860px; padding-top: 40px; padding-bottom: 40px; }
.legal article { padding-bottom: 40px; }
.legal article + article { border-top: 1px solid var(--border); padding-top: 40px; }
.legal h1 { margin: 0 0 18px; font-size: clamp(1.8rem, 5vw, 2.4rem); }
.legal h2 { margin: 34px 0 10px; font-size: 1.2rem; }
.legal h3 { margin: 20px 0 6px; font-size: 1rem; }
.legal p, .legal li { color: color-mix(in oklab, var(--text) 84%, transparent); line-height: 1.65; overflow-wrap: anywhere; }
.legal ul { padding-left: 1.2em; }
.legal li { margin-bottom: 6px; }
.legal a { color: var(--accent); }
.lang-switch { display: flex; gap: 16px; }
.legal-summary { padding: 4px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.legal-note, .legal-credit { font-size: 0.85rem; color: var(--text-faint) !important; }
.notfound { padding: 80px var(--gutter); text-align: center; }
.notfound a { color: var(--accent); }

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

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 28px var(--gutter);
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-faint);
}
.footer p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer a { color: var(--text-dim); text-decoration: none; }
.footer a:hover { color: var(--text); }
.feed-link { display: inline-flex; align-items: center; gap: 6px; }

/* -------------------------------------------------------------- lightbox (PhotoSwipe additions) */

.pswp { --pswp-bg: #050505; --pswp-placeholder-bg: #111; }
.pswp__caption {
  position: absolute;
  inset: auto 0 0;
  padding: 36px max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  text-align: center;
  font-size: 0.92rem;
  color: #eee;
  pointer-events: none;
  transition: opacity 0.25s;
}
.pswp__caption:empty { display: none; }
.pswp__caption strong { display: block; font-size: 1rem; margin-bottom: 2px; }
.pswp__caption small { display: block; color: rgba(255, 255, 255, 0.6); font-size: 0.78rem; }
.pswp--ui-visible .pswp__caption { opacity: 1; }
.pswp:not(.pswp--ui-visible) .pswp__caption { opacity: 0; }
.pswp__button--share-button svg, .pswp__button--fs-button svg { width: 22px; height: 22px; color: #fff; }
.pswp__button--share-button, .pswp__button--fs-button { display: grid; place-items: center; }

/* -------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 100001;
  translate: -50% 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: toast 2.4s var(--ease) forwards;
}
@keyframes toast { 0% { opacity: 0; translate: -50% 10px; } 10%, 85% { opacity: 1; translate: -50% 0; } 100% { opacity: 0; } }

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