/* ============================================================
   Jan Vanek — portfolio (v3)

   Each background colour has a PRIMARY (flat page colour) and a
   SECONDARY (lighter shade used by the radial glow in the middle).
   Fonts: SANS = DM Sans · SERIF = Crimson Pro
   ============================================================ */

/* ---------- Self-hosted fonts (latin subset, woff2) ----------
   Removes the Google Fonts round-trip: fewer requests, no layout shift on slow
   mobile connections, and the site keeps working without any third party. */

@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/dm-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('../fonts/dm-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../fonts/dm-sans-latin-700-normal.woff2') format('woff2'); }

@font-face { font-family: 'Crimson Pro'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../fonts/crimson-pro-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Crimson Pro'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('../fonts/crimson-pro-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Crimson Pro'; font-style: italic; font-weight: 400; font-display: swap;
  src: url('../fonts/crimson-pro-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Crimson Pro'; font-style: italic; font-weight: 500; font-display: swap;
  src: url('../fonts/crimson-pro-latin-500-italic.woff2') format('woff2'); }

:root {
  /* primaries */
  --navy:    hsl(225, 100%, 8%);
  --wine:    hsl(331, 61%, 24%);
  --emerald: hsl(164, 91%, 14%);
  --white:   hsl(36, 100%, 96%);
  --orange:  hsl(25, 100%, 64%);

  /* secondaries — glow colour components, consumed as hsl(h s l / a) */
  --navy-2:    209 79% 21%;
  --wine-2:    331 68% 38%;
  --emerald-2: 152 68% 26%;

  --sans:  'DM Sans', system-ui, sans-serif;
  --serif: 'Crimson Pro', Georgia, serif;
  --menu-h: 76px;
  --ease: cubic-bezier(.45, 0, .55, 1); /* ease-in-out */
  --indent: clamp(0px, 6vw, 90px);      /* left indent shared by About text & card headers */
  --card-pad: 34px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  font-family: var(--serif);
  font-size: 18px;          /* default paragraph size */
  font-weight: 400;
  color: var(--white);
  background: var(--navy);
  overflow-x: hidden;
}

@media (pointer: coarse) {
  html { scroll-snap-type: y proximity; }
  .section { scroll-snap-align: start; }
}

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

/* <picture> is only a wrapper for choosing a file — it must not become a layout
   box of its own, or it lands in grids and flex rows instead of the image.
   Its <source> children must be hidden explicitly: with display:contents they
   would otherwise be laid out too, and add a phantom row to any grid. */
picture { display: contents; }
picture > source { display: none; }
a { color: inherit; }

/* ---------- Top menu ---------- */

.menu {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--menu-h);
  background: var(--navy);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(0);
  transition: transform .6s var(--ease), height .6s var(--ease);
}

/* soft gradient on the menu's bottom side */
.menu::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  height: 42px;
  background: linear-gradient(180deg, var(--navy), hsl(225 100% 8% / 0));
  pointer-events: none;
  opacity: 1;
  transition: opacity .35s var(--ease);
}

/* Outside Home the menu is 75% height and floats with NO background at all,
   so it can never paint a lighter block over the section behind it. */
.menu.compact {
  height: calc(var(--menu-h) * .75);
  background: transparent;
}
.menu.compact::after { display: none; }

/* hidden until the mouse reaches the top of the viewport —
   the soft bottom edge goes with it, nothing peeks through */
.menu.hidden { transform: translateY(-115%); }
.menu.hidden::after { opacity: 0; }

.menu nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;  /* brand mathematically centered */
  align-items: center;
  column-gap: clamp(14px, 3.4vw, 46px);
  width: min(1240px, 100%);
  padding: 0 16px;
}

.nav-side { display: flex; align-items: center; gap: clamp(14px, 3.4vw, 46px); }
.nav-side.left  { justify-content: flex-end; }
.nav-side.right { justify-content: flex-start; }

.menu a {
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 500;
  color: var(--white);
  text-decoration: none;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: color .2s var(--ease), font-size .6s var(--ease);
  white-space: nowrap;
}
.menu a:hover { color: var(--orange); }

.menu .dot {
  color: var(--white);
  font-family: var(--sans);
  font-size: 20px;
  user-select: none;
  transition: font-size .6s var(--ease);
}

.menu a.brand {
  font-size: 28px;
  font-weight: 700;
  color: var(--orange);
}
.menu a.brand:hover { color: var(--white); }

.menu.compact a { font-size: 15px; }
.menu.compact .dot { font-size: 15px; }
.menu.compact a.brand { font-size: 21px; }

/* mobile-only parts of the header (hidden on desktop) */
.burger, .brand-mobile { display: none; }

/* ---------- Radial pale gradient (appears when scrolling settles) ---------- */

/* The glow is part of the BACKGROUND. Paint order is:
     section colour  ->  radial glow (z 1)  ->  content and menu (z 2 / 50)
   Perfect circle, centred horizontally, 25% down the viewport, radius = half the
   viewport width so it exactly touches the left and right edges. */
.radial-glow {
  pointer-events: none;
  background: radial-gradient(circle 50vw at 50% 25vh,
              hsl(var(--glow) / 1)   0%,
              hsl(var(--glow) / .78) 30%,
              hsl(var(--glow) / .40) 58%,
              hsl(var(--glow) / .14) 80%,
              hsl(var(--glow) / 0)   100%);
  opacity: 0;
  transition: opacity .35s var(--ease);
}

.radial-glow {
  position: fixed;
  inset: 0;
  z-index: 1;
}

body.glow-on .radial-glow {
  opacity: 1;
  transition: opacity 3s var(--ease);
}

/* glow colour follows the section's own background colour */
body.c-navy    { --glow: var(--navy-2); }
body.c-wine    { --glow: var(--wine-2); }
body.c-emerald { --glow: var(--emerald-2); }

/* all page content sits above the glow */
.section > *,
body.extra .extra-wrap { position: relative; z-index: 2; }

/* ---------- Sections & background gradients ---------- */

.section {
  min-height: 100vh;
  min-height: 100svh;     /* stable on mobile: unaffected by the URL bar */
  position: relative;
  padding: calc(var(--menu-h) + 40px) clamp(20px, 8vw, 140px) 60px;
}

/* Each section holds its own colour to 75%, then blends into the next one */
#home      { background: linear-gradient(180deg, var(--navy) 0%,    var(--navy) 75%,    var(--wine) 100%); padding: 0; }
#music     { background: linear-gradient(180deg, var(--wine) 0%,    var(--wine) 75%,    var(--emerald) 100%); }
#about     { background: linear-gradient(180deg, var(--emerald) 0%, var(--emerald) 75%, var(--navy) 100%); }
#creations { background: linear-gradient(180deg, var(--navy) 0%,    var(--navy) 75%,    var(--wine) 100%); }
#contact   { background: linear-gradient(180deg, var(--wine) 0%,    var(--wine) 75%,    var(--navy) 100%); }

.section-header {
  font-family: var(--sans);
  font-size: 40px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: .02em;
  margin-bottom: clamp(28px, 5vh, 56px);
}

/* ---------- Home ---------- */

#home {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.hero {
  margin-top: var(--menu-h);
  width: min(1700px, 100%);
  position: relative;
}

.hero img {
  width: 100%;
  max-height: calc(100vh - var(--menu-h) - 8vh);
  max-height: calc(100svh - var(--menu-h) - 8vh);
  object-fit: cover;
  object-position: center 55%;   /* show a lower portion of the photo */
  opacity: 0;
  /* bottom fade, narrowed by 40% (was 28% of the height, now 17%) */
  -webkit-mask-image: linear-gradient(180deg, #000 83%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 83%, transparent 100%);
}
.hero img.reveal {
  animation: hero-in 1s var(--ease) forwards;
}
@keyframes hero-in { to { opacity: .8; } }

/* ---------- Music / player ---------- */

#music {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.player {
  position: relative;
  width: min(880px, 100%);
  margin-top: clamp(24px, 9vh, 110px);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 16px;
  color: var(--white);
}

.player-top {
  display: flex;
  align-items: center;
  gap: 22px;
}

.play-btn {
  flex: 0 0 auto;
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 2px solid var(--white);
  background: transparent;
  color: var(--white);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .2s var(--ease), background-color .2s var(--ease);
}
.play-btn:hover { transform: scale(1.06); }
.play-btn svg { width: 22px; height: 22px; fill: var(--white); }

.wave-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
#waveform { width: 100%; cursor: pointer; }

.wave-hover {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--white);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s var(--ease);
  z-index: 5;
}
.wave-hover .time {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-family: var(--sans);
  font-weight: 500;
  color: var(--white);
  white-space: nowrap;
}
.wave-wrap:hover .wave-hover { opacity: .9; }

.player-sub {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin: 10px 4px 0 0;
}
.player-sub svg { width: 18px; height: 18px; fill: var(--white); opacity: .9; }

input.volume {
  -webkit-appearance: none;
  appearance: none;
  width: 110px; height: 2px;
  background: rgba(255, 247, 235, .45);
  outline: none;
  cursor: pointer;
}
input.volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--white);
  border: none;
}
input.volume::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--white);
  border: none;
}

/* Blocking layer while a track loads — a big file can take a few seconds and
   without this the player just looks dead. */
.player-busy {
  position: absolute;
  inset: -14px -10px;
  z-index: 6;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: hsl(331 61% 24% / .5);   /* WINE at the same 0.5 opacity */
  cursor: progress;
}
.player-busy[hidden] { display: none; }   /* display:grid would beat the attribute */

.spinner {
  width: 34px; height: 34px;
  border: 2px solid hsl(36 100% 96% / .25);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Playlist ---------- */

.playlist {
  margin-top: 26px;
  list-style: none;
  width: min(760px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.playlist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 24px;
  line-height: 24px;
  padding: 4px 10px;
  cursor: pointer;
  border-top: 1px solid rgba(255, 247, 235, .65);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.playlist li:first-child { border-top-color: transparent; }
.playlist li.active,
.playlist li.active + li { border-top-color: transparent; }

.playlist li:hover:not(.active) { background: rgba(255, 247, 235, .08); }

.playlist li.active {
  background: var(--white);
  color: var(--wine);
}

.playlist .t-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Times are columned digit by digit.

   DM Sans ships no 'tnum' feature, so `font-variant-numeric: tabular-nums`
   below does nothing on its own — it is kept only so the times would snap into
   line automatically if the font is ever swapped for one that has it. The real
   work is done by .d: every digit gets a box exactly 1ch wide (1ch = the
   advance of '0', the widest digit at 690/1000 em) and is centred in it, which
   is precisely what tabular figures do. Minutes and seconds then sit in
   fixed-width boxes either side of the colon, so the colon never moves. */
.playlist .t-time { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.t-time .d {
  display: inline-block;
  width: 1ch;
  text-align: center;
}
.t-time .min {
  display: inline-block;
  min-width: 2ch;
  text-align: right;
}
.t-time .sec {
  display: inline-block;
  width: 2ch;
  text-align: left;
}

/* ---------- About ---------- */

.about-body { max-width: 1100px; margin: 0 auto; width: 100%; }
#about .section-header,
#creations .section-header,
#contact .section-header { max-width: 1100px; margin-left: auto; margin-right: auto; }
#about .section-header { margin-bottom: 40px; }

.persona {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 20px;
  color: var(--white);
  padding: 0 var(--indent);
  text-align: center;
}

.about-rule {
  border: 0;
  border-top: 1px solid var(--white);
  margin: 22px var(--indent) 34px;
  opacity: .85;
}

.about-text {
  padding: 0 var(--indent);
  text-align: justify;
}
.about-text p { margin-bottom: 20px; line-height: 1.8; }

/* ---------- Creations ---------- */

#creations { padding-top: calc(var(--menu-h) * .75 + 2.4vh); padding-bottom: 3vh; }
#creations .section-header { margin-bottom: clamp(12px, 2.4vh, 26px); }

.cards {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: clamp(10px, 1.7vh, 20px);
  /* card headers align with the About paragraph: card edge sits one
     card-padding to the left of the shared indent */
  padding-inline: max(0px, calc(var(--indent) - var(--card-pad) - 2px)); /* 2px = card border */
}

.card {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  grid-template-areas:
    "head img"
    "text img";
  gap: clamp(4px, .9vh, 10px) 28px;
  align-items: center;
  padding: clamp(10px, 1.5vh, 16px) var(--card-pad) clamp(12px, 1.7vh, 18px);
  border-radius: 16px;
  border: 2px solid transparent;
  box-shadow: 0 0 0 hsl(36 100% 96% / 0);
  cursor: pointer;
  text-decoration: none;
  color: var(--white);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease),
              background-color .2s var(--ease);
}
.card:hover {
  border-color: var(--white);
  background-color: hsl(36 100% 96% / .1);       /* WHITE at 0.1 opacity */
  box-shadow: 0 0 24px hsl(36 100% 96% / .85);   /* white outward glow, 24px */
}

/* 'DIY Instruments' style: mirrored — photo on the left, text on the right */
.card.reverse {
  grid-template-columns: .85fr 1.15fr;
  grid-template-areas:
    "img head"
    "img text";
}

.card h3 {
  grid-area: head;
  align-self: end;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  letter-spacing: .01em;
}

.card p {
  grid-area: text;
  align-self: start;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  max-width: 46ch;
  text-align: justify;
  line-height: 1.6;
}

/* Every card photo spans both rows, so all three are exactly the same height.
   The height is definite on purpose — left to `height:100%` the photo's own
   aspect ratio would drive the grid rows and make the cards taller. */
.card .card-img {
  grid-area: img;
  align-self: center;
  border-radius: 12px;
  width: 100%;
  height: clamp(120px, 18vh, 175px);
  object-fit: cover;
}

/* ---------- Contact ---------- */

#contact {
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

.contact-inner {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.contact-email {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 22px;
  color: var(--white);
  text-decoration: none;
  align-self: center;
  border-bottom: 1px solid rgba(255, 247, 235, .5);
  padding-bottom: 2px;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.contact-email:hover { color: var(--orange); border-color: var(--orange); }

.contact-form {
  width: min(560px, 100%);
  margin: clamp(26px, 5vh, 48px) auto 0;
  display: grid;
  gap: 16px;
}

.contact-form input,
.contact-form textarea {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--white);
  background: rgba(255, 247, 235, .06);
  border: 1px solid rgba(255, 247, 235, .45);
  border-radius: 6px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: rgba(255, 247, 235, .55); }
.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--white); background: rgba(255, 247, 235, .1); }
.contact-form input.invalid { border-color: var(--orange); }
.contact-form textarea { min-height: 140px; resize: vertical; }

.contact-form button {
  justify-self: end;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--white);
  background: transparent;
  border: 1px solid var(--white);
  border-radius: 6px;
  padding: 10px 34px;
  cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.contact-form button:hover { background: var(--white); color: var(--wine); }

.form-note {
  font-family: var(--sans);
  font-size: 14px;
  text-align: center;
  color: var(--orange);
  min-height: 1em;
}

.socials {
  margin-top: auto;
  padding: 26px 0 30px;
  display: flex;
  justify-content: center;
  gap: 38px;
}
.socials a { display: block; opacity: .95; transition: opacity .2s var(--ease), transform .2s var(--ease), color .2s var(--ease); }
.socials a:hover { opacity: 1; transform: translateY(-2px); }
.socials svg { width: 36px; height: 36px; fill: var(--white); transition: fill .2s var(--ease); }

/* Hover: ORANGE. Two properties are needed, not one — five icons are solid
   paths that take `fill`, but the Instagram mark is drawn with
   stroke="currentColor", so it only follows `color`. Setting just one of them
   would leave that single icon white. */
.socials a:hover { color: var(--orange); }
.socials a:hover svg { fill: var(--orange); }

/* honeypot */
.hp-field { position: absolute; left: -9999px; opacity: 0; }

/* ---------- Mobile fullscreen menu ---------- */

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 90;
  background:
    radial-gradient(circle 50vw at 50% 25%,
      hsl(var(--navy-2) / 1) 0%, hsl(var(--navy-2) / .78) 30%,
      hsl(var(--navy-2) / .40) 58%, hsl(var(--navy-2) / 0) 100%),
    var(--navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease);
}
body.nav-open .mobile-menu { opacity: 1; pointer-events: auto; }

.mobile-menu a {
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--white);
  text-decoration: none;
}

/* ---------- Extra pages ---------- */

body.extra {
  background: var(--page-bg, var(--navy));
  min-height: 100vh;
  min-height: 100svh;
}

.extra-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(50px, 9vh, 110px) clamp(20px, 6vw, 60px) 90px;
}

.extra-head {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: clamp(36px, 7vh, 70px);
}

.back-btn {
  flex: 0 0 auto;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 2px solid var(--white);
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: transform .2s var(--ease);
}
.back-btn:hover { transform: translateX(-4px); }
.back-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--white); stroke-width: 2.4; }

.extra-head h1 {
  font-family: var(--sans);
  font-size: 40px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: .02em;
}

.article { margin-bottom: clamp(48px, 9vh, 90px); }

.article h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  margin-bottom: 26px;
}

.article-body {
  padding-left: clamp(0px, 5vw, 90px);
  position: relative;
}
.article-body p {
  text-align: justify;
  line-height: 1.8;
  margin-bottom: 20px;
}
.article-body img {
  width: 100%;
  border-radius: 2px;
  margin: 6px 0 26px;
}
.article-body a {
  color: var(--orange);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 148, 71, .5);
  transition: border-color .2s var(--ease);
}
.article-body a:hover { border-color: var(--orange); }

.article-body.clamped {
  max-height: 560px;
  overflow: hidden;
}
.article-body.clamped::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 110px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), var(--page-bg, var(--navy)));
}

.see-more {
  display: inline-block;
  margin: 6px 0 0 clamp(0px, 5vw, 90px);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 16px;
  color: var(--orange);
  background: none;
  border: none;
  cursor: pointer;
  transition: color .2s var(--ease);
}
.see-more:hover { color: var(--white); }


/* ---------- Article galleries & image viewer ---------- */

.gallery { margin: 6px 0 26px; }

/* Large: exactly the width of the paragraph column, natural proportions kept */
.gal-item.large { display: block; margin: 0 0 22px; }
.gal-item.large img {
  display: block;
  width: 100%;
  height: auto;           /* beats the height attribute — never squashed */
  margin: 0;              /* the generic .article-body img margin must not apply */
  border-radius: 6px;
}

/* Thumbnails: three across, the row adding up to the paragraph width */
.gal-thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 22px;
}
.gal-thumbs .gal-item { margin: 0; }
.gal-thumbs img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;              /* the generic .article-body img margin must not apply */
  aspect-ratio: 4 / 3;
  object-fit: cover;      /* crop to fit — the ratio is never altered */
  border-radius: 6px;
}

.gal-item {
  border: 1px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease),
              transform .2s var(--ease);
}
.gal-item:hover,
.gal-item:focus-visible {
  border-color: hsl(36 100% 96% / .5);
  box-shadow: 0 0 16px hsl(36 100% 96% / .5);
  outline: none;
}
.gal-thumbs .gal-item:hover { transform: translateY(-2px); }

/* ---------- the viewer ---------- */

body.viewer-open { overflow: hidden; }

.viewer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: hsl(225 100% 4% / .92);
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.viewer.on { opacity: 1; }

/* `display: grid` above would otherwise beat the hidden attribute's UA rule and
   leave an invisible overlay swallowing every click on the page */
.viewer[hidden] { display: none; }

.v-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 80vw;
  height: 80vh;
  justify-content: center;
  margin: 0;
}

.v-img {
  max-width: 80vw;
  max-height: 72vh;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 4px;
  transition: opacity .18s var(--ease);
}
.viewer.loading .v-img { opacity: .35; }

.v-cap {
  font-family: var(--serif);
  font-size: 16px;
  color: hsl(36 100% 96% / .85);
  text-align: center;
  max-width: 80vw;
}

.v-count {
  position: absolute;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: hsl(36 100% 96% / .7);
  letter-spacing: .06em;
}

.v-close, .v-nav {
  position: absolute;
  background: none;
  border: 1.5px solid hsl(36 100% 96% / .55);
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color .2s var(--ease), background-color .2s var(--ease),
              transform .2s var(--ease);
}
.v-close svg, .v-nav svg {
  fill: none;
  stroke: var(--white);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.v-close:hover, .v-nav:hover,
.v-close:focus-visible, .v-nav:focus-visible {
  border-color: var(--white);
  background: hsl(36 100% 96% / .12);
  outline: none;
}

.v-close { top: 22px; right: 22px; width: 46px; height: 46px; }
.v-close svg { width: 20px; height: 20px; }

.v-nav { top: 50%; margin-top: -25px; width: 50px; height: 50px; }
.v-nav svg { width: 22px; height: 22px; }
.v-prev { left: 24px; }
.v-next { right: 24px; }
.v-prev:hover { transform: translateX(-3px); }
.v-next:hover { transform: translateX(3px); }

@media (max-width: 860px) {
  .gal-thumbs { gap: 8px; }
  .v-stage { width: 100vw; height: 100vh; gap: 10px; }
  .v-img { max-width: 94vw; max-height: 74vh; }
  .v-cap { font-size: 15px; max-width: 90vw; }
  .v-close { top: max(14px, env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px; }
  .v-nav { width: 44px; height: 44px; margin-top: -22px; }
  .v-prev { left: 8px; }
  .v-next { right: 8px; }
  .v-count { bottom: calc(14px + env(safe-area-inset-bottom)); }
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  :root { --menu-h: 60px; --card-pad: 18px; }

  /* header: hamburger left + name next to it */
  .menu {
    justify-content: flex-start;
    padding: 0 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    transform: none !important;    /* mouse-based hide/show is desktop-only */
    height: var(--menu-h) !important;
  }
  .menu nav { display: none; }

  .burger {
    display: grid;
    gap: 5px;
    width: 44px; height: 44px;      /* 44px tap target */
    place-content: center;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 95;                    /* above the fullscreen overlay */
  }
  .burger span {
    display: block;
    width: 24px; height: 2px;
    background: var(--white);
    transition: transform .3s var(--ease), opacity .3s var(--ease);
  }
  body.nav-open .burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.nav-open .burger span:nth-child(2) { opacity: 0; }
  body.nav-open .burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .brand-mobile {
    display: block;
    margin-left: 8px;
    font-family: var(--sans);
    font-size: 20px;
    font-weight: 700;
    color: var(--orange);
    text-decoration: none;
    letter-spacing: .04em;
    text-transform: uppercase;
    transition: opacity .3s var(--ease);
  }
  .menu.compact .brand-mobile { font-size: 20px; }   /* not the desktop compact size */
  body.nav-open .brand-mobile { opacity: 0; }
  body.nav-open .menu { background: transparent; z-index: 95; }
  body.nav-open .menu::after { opacity: 0; }
  body.nav-open { overflow: hidden; }   /* no scrolling behind the overlay */

  .section {
    padding: calc(var(--menu-h) + 24px) 20px 40px;
    padding-left:  max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }
  .section-header { font-size: 30px; margin-bottom: 22px; }

  /* hero: portrait crop, sized in svh so the URL bar can't clip it.
     A definite height (not just max-height) is what lets object-fit fill the
     screen — the portrait source is otherwise shorter than the space available. */
  .hero img {
    height: calc(100svh - var(--menu-h) - 8vh);
    max-height: none;
    object-position: center 38%;
  }

  /* player */
  #music { align-items: flex-start; }
  .player { margin-top: 4vh; }
  .player-top { gap: 12px; }
  .play-btn { width: 48px; height: 48px; }
  .play-btn svg { width: 18px; height: 18px; }
  .playlist { margin-top: 18px; }
  input.volume { width: 90px; }

  /* about */
  .about-text, .persona { padding: 0; }
  .about-rule { margin-left: 0; margin-right: 0; }
  .persona { font-size: 18px; }

  /* creations: one column — header, text, then the photo */
  #creations { padding-top: calc(var(--menu-h) + 20px); }
  .cards { padding-inline: 0; gap: 14px; }
  .card,
  .card.reverse {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "text"
      "img";
    gap: 8px;
    align-items: start;
    padding: 14px var(--card-pad) 16px;
  }
  .card h3 { font-size: 26px; align-self: start; }
  .card .card-img { height: clamp(120px, 22svh, 200px); margin-top: 4px; }

  /* contact */
  .contact-email { font-size: 19px; }
  .contact-form { width: 100%; }
  .contact-form textarea { min-height: 120px; }
  .socials {
    gap: 26px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  .socials svg { width: 32px; height: 32px; }

  /* extra pages */
  .extra-wrap { padding: 80px 20px 70px; }
  .extra-head { gap: 14px; margin-bottom: 30px; }
  .extra-head h1 { font-size: 28px; }
  .back-btn { width: 44px; height: 44px; }
  .article h2 { font-size: 26px; margin-bottom: 18px; }
  .article-body { padding-left: 0; }
  .article-body.clamped { max-height: 60svh; }
  .see-more { margin-left: 0; }

  .mobile-menu { gap: 32px; }
  .mobile-menu a { font-size: 23px; }
}

/* Phones: justified text creates rivers in a narrow column */
@media (max-width: 600px) {
  .about-text, .card p, .article-body p { text-align: left; }
  .about-text p { line-height: 1.7; }
  body { font-size: 17px; }
}

/* Touch devices: no hover, so affordances have to be visible and finger-sized */
@media (pointer: coarse) {
  .playlist li {
    min-height: 44px;
    padding: 10px 10px;
    line-height: 1.35;
  }
  /* cards must look tappable without a hover state */
  .card { border-color: hsl(36 100% 96% / .25); }
  .card:hover { box-shadow: none; }
  .card:active {
    border-color: var(--white);
    background-color: hsl(36 100% 96% / .1);
  }
  /* the hover time-line is replaced by a scrub indicator while dragging */
  .wave-wrap:hover .wave-hover { opacity: 0; }
  .wave-wrap.scrubbing .wave-hover { opacity: .9; }
  .wave-hover .time { font-size: 13px; top: -24px; }
  .contact-form button, .contact-email { min-height: 44px; }
  .contact-form button { padding: 12px 34px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .hero img { opacity: .8; }
}
