@import url("../fonts/fonts.css");

/* =========================================================================
   janekvaldsalu.ee — one stylesheet, no build step.
   Everything you'd want to restyle is a variable in :root below.
   ========================================================================= */

:root {
  /* Type. Swap these two lines if you license a different pair of faces. */
  --font-display: "Bodoni Moda", "Didot", "Times New Roman", serif;
  --font-body: "Mulish", -apple-system, "Helvetica Neue", Arial, sans-serif;

  /* Weight + optical size. Both faces are variable (Mulish 300-700,
     Bodoni Moda 400-900 with an opsz 6-96 axis).
     A LOW opsz means less thick/thin contrast in the Bodoni, so hairlines
     stay readable. Left on `auto` the browser matches opsz to the font-size,
     which makes a 72px heading and a 22px one look like different faces. */
  --weight-body: 400;
  --weight-display: 600;
  --opsz-display: 16;

  /* Colour — dark throughout. Sampled from the homepage photograph:
     violet-black ground, warm off-white text, streetlight amber accent. */
  --base: #131019;
  --raised: #1b1724;        /* image placeholders, hover fills */
  --paper: #f1ede4;
  --dim: rgba(241, 237, 228, .58);
  --faint: rgba(241, 237, 228, .13);
  --accent: #e0a355;

  --bg: var(--base);
  --ink: var(--paper);      /* headings */
  --body: var(--dim);       /* running text */
  --muted: var(--dim);
  --rule: var(--faint);
  --overlay: rgba(19, 16, 25, .82);

  /* Measure */
  --page-max: 1360px;
  --page-pad: clamp(1.25rem, 4vw, 4.375rem);
  --gap: 10px;              /* gallery gutter, as on the original site */
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font: var(--weight-body) 16px/1.7 var(--font-body);
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }

/* Links inside running text keep the original site's thin underline. */
.prose a, .footer-mail {
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  transition: color .18s ease, border-color .18s ease;
}
.prose a:hover, .footer-mail:hover { color: var(--ink); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0;
  letter-spacing: -.005em;
}

/* Every piece of Bodoni on the site renders with the same weight and the
   same stroke contrast, whatever its size. */
h1, h2, h3, h4,
.prose--lead p,
.lb-title {
  font-weight: var(--weight-display);
  font-variation-settings: "opsz" var(--opsz-display);
}

h1 { font-size: clamp(2.5rem, 6.5vw, 4.5rem); line-height: 1; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.15; }
h3 { font-size: 1.375rem; line-height: 1.2; }

.wrap {
  max-width: var(--page-max);
  margin: 0 auto;
  padding-inline: var(--page-pad);
}

/* Small letterspaced label, used for nav, section titles, footer */
.label {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--overlay);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header.is-stuck { border-bottom-color: var(--rule); }

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 72px;
}

.logo { display: flex; align-items: center; }
.logo img {
  width: 42px; height: auto;
  /* the mark is dark artwork — invert it onto the dark ground */
  filter: invert(1) brightness(1.6);
}

.nav { display: flex; align-items: center; gap: clamp(1rem, 2.6vw, 2.25rem); }

.nav a {
  font-size: .8125rem;
  letter-spacing: .045em;
  color: var(--body);
  padding: .35rem 0;
  position: relative;
  transition: color .18s ease;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s ease;
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--ink); }

.nav-toggle {
  display: none;
  background: none; border: 0; padding: .5rem; margin-right: -.5rem;
  cursor: pointer; color: var(--ink);
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed;
    inset: 72px 0 auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    padding: .5rem var(--page-pad) 1.5rem;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
  }
  .nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav a { font-size: 1.125rem; padding: .6rem 0; width: 100%; }
  .nav a::after { display: none; }
}

/* ---- page furniture ----------------------------------------------------- */

main { padding-bottom: clamp(4rem, 9vw, 8rem); }

.hero { padding: clamp(3.5rem, 11vw, 9rem) 0 clamp(2.5rem, 6vw, 4.5rem); }
.hero h1 { margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }

.prose { max-width: 46ch; }
.prose p { margin: 0 0 1.15rem; }
.prose p:last-child { margin-bottom: 0; }
.prose--lead p {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: clamp(1.125rem, 1.9vw, 1.375rem);
  line-height: 1.35;
  color: var(--ink);
  max-width: 34ch;
}

.page-head {
  padding: clamp(2.75rem, 8vw, 6rem) 0 clamp(1.5rem, 4vw, 2.75rem);
  display: grid;
  gap: 1.25rem;
}
.page-head .prose { max-width: 52ch; }

.section-title {
  display: flex;
  align-items: baseline;
  gap: .875rem;
  margin: clamp(2.5rem, 6vw, 4.5rem) 0 1.25rem;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.section-title:first-child { margin-top: 0; }

/* ---- galleries ---------------------------------------------------------- */

.gallery { --g: var(--gap); }
.gallery + .gallery { margin-top: var(--gap); }

.g-row { display: flex; gap: var(--g); margin-bottom: var(--g); }
.g-row:last-child { margin-bottom: 0; }

.g-cols { display: flex; gap: var(--g); align-items: flex-start; }
.g-col { flex: 1 1 0; display: grid; gap: var(--g); min-width: 0; }

.g-grid {
  display: grid;
  gap: var(--g);
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
}

.g-item {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--raised);
  cursor: zoom-in;
  min-width: 0;
}
.g-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .5s ease, transform .5s cubic-bezier(.2, .7, .2, 1);
}
.g-item img.is-loading { opacity: 0; }
.g-item:hover img { transform: scale(1.028); }
.g-item:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Caption revealed on hover, hidden for touch (no hover to reveal it) */
.g-cap {
  position: absolute;
  inset: auto 0 0;
  padding: 2.25rem .875rem .75rem;
  font-size: .75rem;
  letter-spacing: .02em;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .55));
  opacity: 0;
  transition: opacity .22s ease;
  pointer-events: none;
}
.g-item:hover .g-cap, .g-item:focus-visible .g-cap { opacity: 1; }

/* Play badge on video tiles */
.g-item--video { cursor: pointer; }
.g-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.g-play span {
  width: 66px; height: 66px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  display: grid; place-items: center;
  transition: transform .25s ease;
}
.g-play span::before {
  content: "";
  width: 0; height: 0;
  margin-left: 4px;
  border-left: 17px solid var(--ink);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
}
.g-item--video:hover .g-play span { transform: scale(1.08); }
.g-dur {
  position: absolute;
  right: .625rem; bottom: .625rem;
  font-size: .6875rem;
  letter-spacing: .04em;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  padding: .15rem .4rem;
  font-variant-numeric: tabular-nums;
}

.g-empty {
  border: 1px dashed var(--rule);
  padding: clamp(1.75rem, 5vw, 3rem);
  text-align: center;
  font-size: .875rem;
  color: var(--muted);
}
.g-empty code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8125em;
  color: var(--ink);
  background: #f6f6f6;
  padding: .1rem .35rem;
}

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

.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 16, 16, .965);
  display: grid;
  grid-template-rows: 1fr auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility .22s;
}
.lb.is-open { opacity: 1; visibility: visible; }
body.lb-open { overflow: hidden; }

.lb-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: clamp(2.5rem, 5vw, 3.5rem);
  min-height: 0;
}
.lb-stage img, .lb-stage video {
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
}
.lb-stage video { background: #000; }

.lb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2rem) clamp(1rem, 2.5vw, 1.75rem);
  color: rgba(255, 255, 255, .72);
  font-size: .8125rem;
}
.lb-count { font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.lb-title {
  font-family: var(--font-display);
  color: #fff;
  font-size: .9375rem;
  text-align: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb button {
  background: none; border: 0; cursor: pointer;
  color: #fff; padding: .75rem;
  opacity: .68;
  transition: opacity .18s ease;
}
.lb button:hover { opacity: 1; }
.lb button:focus-visible { outline: 1px solid #fff; outline-offset: 2px; }

.lb-close { position: absolute; top: .5rem; right: .5rem; z-index: 2; }
.lb-prev, .lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  padding: 1.25rem .875rem;
}
.lb-prev { left: 0; }
.lb-next { right: 0; }
.lb svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; }

@media (max-width: 720px) {
  .lb-prev, .lb-next { display: none; }   /* swipe instead */
  .lb-stage { padding: 3.25rem .75rem 0; }
}

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

.site-footer {
  border-top: 1px solid var(--rule);
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(2rem, 4vw, 3rem);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.75rem;
}
.site-footer p { margin: 0; font-size: .875rem; }
.footer-place { white-space: pre-line; }
.footer-links { display: flex; gap: 1.25rem; font-size: .875rem; }
.footer-links a { color: var(--body); transition: color .18s ease; }
.footer-links a:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .g-item:hover img { transform: none; }
}

/* ---- centred page (the homepage) ---------------------------------------- */

.center { text-align: center; }

/* .prose is measure-limited, so it needs centring as a block too */
.center .prose,
.center .prose--lead p { margin-inline: auto; }

/* A centred section label drops the rule that trails it */
.center .section-title { justify-content: center; }
.center .section-title::after { display: none; }
