/* ─────────────────────────────────────────────
   Nikatique — landing page
   EVERY colour, font and size is a token below.
   Never write a raw colour further down this file.
   ───────────────────────────────────────────── */

:root {
  /* Colour */
  --cream:        #bcb7af;
  --cream-deep:   #e8dccb;
  --card:         #fffaf1;
  --ink:          #574f4c;
  --ink-soft:     #5c5046;
  --ink-faint:    #8c7c6c;
  --line:         #d8cbb6;
  --card-fixed:   #fffaf1;
  --ink-fixed:    #2c2420;
  --teal:         #2f7d72;
  --teal-hover:   color-mix(in srgb, var(--teal) 82%, black);
  --teal-tint:    color-mix(in srgb, var(--teal) 12%, var(--cream));
  --on-dark:      #f4ece0;
  --mono-bright:  #c7dcdb;

  /* Type */
  --serif:        "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans:         -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --cursive:      "Snell Roundhand", "Brush Script MT", "Segoe Script", "Bradley Hand", cursive;
  --step-hero:    clamp(2.4rem, 6vw, 4.2rem);
  --step-h2:      clamp(1.6rem, 3vw, 2.2rem);
  --step-body:    1.0625rem;

  /* Space & shape */
  --gutter:       clamp(1.25rem, 4vw, 3rem);
  --stack:        clamp(3.5rem, 9vw, 7rem);
  --radius:       12px;
  --radius-tight: 3px;
  --line-w:       1px;
  --measure:      62ch;

  /* Woven grain */
  --weave:        color-mix(in srgb, var(--ink) 7%, transparent);
  --weave-pitch:  3px;

  /* Stitched frame */
  --stitch:       #c7dcdb;
  --stitch-w:     1.5px;
  --frame-inset:  clamp(.6rem, 2.4vw, 1.1rem);

  /* Gallery */
  --shot-frame:   var(--ink-faint);
  --shot-shadow:  color-mix(in srgb, var(--ink) 26%, transparent);
  --shot-veil:    color-mix(in srgb, var(--ink) 66%, transparent);
  --shot-min:     190px;
  --shot-gap:     clamp(1.4rem, 3.4vw, 2.6rem);
  --card-shrink:  .72;              /* how far the centre card shrinks */
  --gallery-rail: min(34vw, 380px); /* space kept clear for it — JS refines this */
  --gallery-head: 14rem;            /*   ditto, for narrow screens */
}

/* ── Alternate palettes ────────────────────────
   Every colour still lives here at the top.
   Clicking a dot bottom-left swaps one of these in. */

body[data-palette="rust"] {
  --cream:      #f7f0e7;
  --cream-deep: #ece0d1;
  --card:       #fffbf4;
  --ink:        #2e2320;
  --ink-soft:   #5f4d44;
  --ink-faint:  #927b6c;
  --line:       #ddccb9;
  --teal:       #a8552f;
}

body[data-palette="sage"] {
  --cream:      #eef0e8;
  --cream-deep: #dfe3d6;
  --card:       #f8faf3;
  --ink:        #262b24;
  --ink-soft:   #4e5449;
  --ink-faint:  #808875;
  --line:       #ccd3c0;
  --teal:       #4a6b4f;
}

body[data-palette="dusk"] {
  --cream:      #22201f;
  --cream-deep: #2c2928;
  --card:       #2b2827;
  --ink:        #f0e8dd;
  --ink-soft:   #c4b8aa;
  --ink-faint:  #8e8377;
  --line:       #453f3b;
  --teal:       #c99a6a;
  --weave:      color-mix(in srgb, var(--ink) 9%, transparent);
}

/* Terra — charcoal and warm taupe, dark enough that the fixed
   cream card reads with strong contrast against it. */
body[data-palette="terra"] {
  --cream:      #4a4a4a;
  --cream-deep: #3c3c3c;
  --card:       #565248;
  --ink:        #bea98e;
  --ink-soft:   #a4917a;
  --ink-faint:  #8a7965;
  --line:       #6e6a5e;
  --teal:       #9c7a34;
  --weave:      color-mix(in srgb, var(--ink) 9%, transparent);
  /* Card swaps to the same two tones as the page, reversed. */
  --card-fixed: var(--ink);
  --ink-fixed:  var(--cream);
}
body[data-palette="terra"] {
  background: linear-gradient(160deg,
    var(--cream) 0%,
    var(--cream-deep) 55%,
    color-mix(in srgb, var(--teal) 30%, var(--cream-deep)) 100%);
}

/* Swatch dots — one pair per palette above. */
:root {
  --sw-1-bg: #f4ece0; --sw-1-dot: #2f7d72;
  --sw-2-bg: #f7f0e7; --sw-2-dot: #a8552f;
  --sw-3-bg: #eef0e8; --sw-3-dot: #4a6b4f;
  --sw-4-bg: #22201f; --sw-4-dot: #c99a6a;
  --sw-5-bg: #4a4a4a; --sw-5-dot: #bea98e;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--cream);
  color: var(--ink);
  font: var(--step-body)/1.7 var(--serif);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

.wrap {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ── Header ── */

.site-header {
  border-bottom: var(--line-w) solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.4rem;
}
.wordmark {
  font-size: 1.35rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
}
.site-header nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2rem);
  font: 500 .8rem/1 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.site-header nav a { color: var(--ink-soft); text-decoration: none; }
.site-header nav a:hover { color: var(--teal); }

/* ── Single-surface home page ── */

body.solo { position: relative; }

/* All-over monogram — the wordmark repeated in a straight diagonal
   grid, like a printed fabric. Filled with JS (many identical spans),
   styled here as one rotated flex grid so every row and column lines up. */
.monogram-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  mask-image:
    linear-gradient(to right, transparent, #000 10%, #000 90%, transparent),
    linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
  mask-composite: intersect;
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 10%, #000 90%, transparent),
    linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-composite: source-in;
}
.monogram {
  position: absolute;
  inset: -30%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transform: rotate(-18deg);
}
.mrow {
  display: flex;
  flex: 0 0 auto;
  gap: 4.6rem;
}
.mrow:nth-child(even) { margin-left: 5.7rem; }
.monogram span {
  flex: 0 0 auto;
  font: 400 2.6rem/1 var(--cursive);
  letter-spacing: .01em;
  color: var(--ink);
  opacity: .08;
  white-space: nowrap;
  transition: opacity .8s ease, transform .8s ease;
}
.monogram span.bright { opacity: .72; color: var(--mono-bright); transform: scale(1.18); }

@media (prefers-reduced-motion: reduce) {
  .monogram span { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .by { animation: none; opacity: 1; }
  .links.typing .stitch-ch { animation: none; opacity: 1; }
}

/* Stitched border, framing the whole page a little in from the edge. */
body.solo::after {
  content: "";
  position: fixed;
  inset: var(--frame-inset);
  z-index: 1;
  pointer-events: none;
  border: var(--stitch-w) dashed var(--stitch);
  border-radius: var(--radius);
}

.surface {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2rem, 6vh, 3.5rem);
  padding: var(--gutter);
  text-align: center;
}

/* ── Centerpiece ── */
.centerpiece {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background:
    repeating-linear-gradient(180deg,
      color-mix(in srgb, var(--ink-fixed) 4%, transparent) 0 1px,
      transparent 1px 3px),
    var(--card-fixed);
  border: var(--line-w) solid var(--ink-fixed);
  border-radius: var(--radius-tight);
  padding: clamp(2.1rem, 6vw, 3.1rem) clamp(2rem, 7vw, 3.75rem);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink-fixed) 14%, transparent);
}

.centerpiece {
  transform-origin: top left;
  transition: transform .8s cubic-bezier(.22, .8, .28, 1);
}

/* stitch border — hand-sewn dash */
.centerpiece::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: none;
  border-radius: 2px;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg,   var(--ink-fixed) 0 4px, transparent 4px 7px),
    repeating-linear-gradient(90deg,  var(--ink-fixed) 0 4px, transparent 4px 7px),
    repeating-linear-gradient(180deg, var(--ink-fixed) 0 4px, transparent 4px 7px),
    repeating-linear-gradient(270deg, var(--ink-fixed) 0 4px, transparent 4px 7px);
  background-repeat: repeat-x, repeat-y, repeat-x, repeat-y;
  background-size: 100% 1.5px, 1.5px 100%, 100% 1.5px, 1.5px 100%;
  background-position: top, right, bottom, left;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  padding: 2px;
}

.tagline {
  font: 500 1.3rem/1.4 var(--sans);
  letter-spacing: .16em;
  text-transform: lowercase;
  color: var(--ink-fixed);
}

.by {
  margin-top: 1rem;
  font: 500 .82rem/1.4 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-fixed);
  opacity: 0;
  animation: by-in 1.2s ease .8s forwards;
}

@keyframes by-in {
  from { opacity: 0; transform: translateY(.2rem); }
  to   { opacity: 1; transform: translateY(0); }
}

.rule {
  width: 2.25rem;
  height: var(--line-w);
  background: color-mix(in srgb, var(--ink-fixed) 35%, transparent);
  margin: 1.3rem 0;
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .7rem clamp(1rem, 3vw, 1.7rem);
}
.links a,
.links .gallery-toggle {
  font: 500 .8rem/1 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-fixed);
  text-decoration: none;
  transition: color .15s ease;
}
.links .gallery-toggle {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.links a:hover,
.links .gallery-toggle:hover { color: var(--teal); }
.links span { color: color-mix(in srgb, var(--ink-fixed) 55%, transparent); }

.links.typing .stitch-ch {
  display: inline-block;
  opacity: 0;
  animation: stitch-in .7s ease forwards;
  animation-delay: calc(2.1s + var(--i, 0) * 110ms);
}

@keyframes stitch-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.palettes {
  position: absolute;
  left: var(--gutter);
  bottom: var(--gutter);
  display: flex;
  gap: .5rem;
  z-index: 2;
}
.palettes button {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: var(--line-w) solid var(--line);
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  opacity: .75;
  transition: opacity .15s ease, transform .15s ease;
}
.palettes button::after {
  content: "";
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
}
.palettes button:hover { opacity: 1; transform: translateY(-2px); }
.palettes button[aria-pressed="true"] { opacity: 1; border-color: var(--ink-soft); }

.palettes button[data-set="default"] { background: var(--sw-1-bg); }
.palettes button[data-set="default"]::after { background: var(--sw-1-dot); }
.palettes button[data-set="rust"] { background: var(--sw-2-bg); }
.palettes button[data-set="rust"]::after { background: var(--sw-2-dot); }
.palettes button[data-set="sage"] { background: var(--sw-3-bg); }
.palettes button[data-set="sage"]::after { background: var(--sw-3-dot); }
.palettes button[data-set="dusk"] { background: var(--sw-4-bg); }
.palettes button[data-set="dusk"]::after { background: var(--sw-4-dot); }
.palettes button[data-set="terra"] { background: var(--sw-5-bg); }
.palettes button[data-set="terra"]::after { background: var(--sw-5-dot); }

.fine {
  position: absolute;
  right: var(--gutter);
  bottom: var(--gutter);
  font: 500 .7rem/1 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  opacity: .7;
}

/* ── Gallery ───────────────────────────────────
   Not a page of its own — a layer over the same one.
   The centre card slides to the top left and the photographs
   arrive behind it, oldest first. */

body.gallery-open { overflow: hidden; }

body.gallery-open .centerpiece {
  transform:
    translate(calc(var(--gutter) - 50vw + 50%), calc(var(--gutter) - 50vh + 50%))
    scale(var(--card-shrink));
}

/* Lift the card clear of the gallery layer, but let clicks
   anywhere else in the surface fall through to it. */
body.gallery-open .surface { z-index: 3; pointer-events: none; }
body.gallery-open .centerpiece,
body.gallery-open .palettes { pointer-events: auto; }
body.gallery-open .fine { opacity: 0; transition: opacity .4s ease; }

.gallery {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: none;  /* the page's own background carries straight through */
  padding: calc(var(--gutter) * 1.5) var(--gutter) calc(var(--gutter) * 3.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .6s ease, visibility 0s linear .6s;
}
body.gallery-open .gallery {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .6s ease, visibility 0s;
}

.gallery-soon {
  min-height: 60vh;
  display: grid;
  place-items: center;
  font: 500 .82rem/1.4 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
}

/* Keep the photographs out from under the card. */
@media (min-width: 900px) {
  .gallery { padding-left: calc(var(--gallery-rail) + var(--gutter) * 2); }
}
@media (max-width: 899px) {
  .gallery { padding-top: calc(var(--gallery-head) + var(--gutter) * 2); }
}

.gallery-close {
  position: fixed;
  top: calc(var(--gutter) + var(--frame-inset));
  right: calc(var(--gutter) + var(--frame-inset));
  z-index: 2;
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  background: none;
  border: var(--line-w) solid var(--line);
  border-radius: 50%;
  color: var(--ink-soft);
  font: 400 1.2rem/1 var(--sans);
  cursor: pointer;
  opacity: .8;
  transition: opacity .15s ease, color .15s ease;
}
.gallery-close:hover { opacity: 1; color: var(--teal); }

.shots {
  list-style: none;
  max-width: 1100px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--shot-min), 1fr));
  gap: var(--shot-gap);
  align-items: start;
}

/* A grid, but nudged off true — six offsets that cycle, so any
   number of photographs lands looking hand-laid rather than ruled. */
.shot { --dx: 0rem; --dy: 0rem; --rot: 0deg; }
.shot:nth-child(6n + 1) { --dx: -.3rem; --dy:  .9rem; --rot: -.7deg; }
.shot:nth-child(6n + 2) { --dx:  .45rem; --dy: -.4rem; --rot:  .5deg; }
.shot:nth-child(6n + 3) { --dx: -.15rem; --dy: 1.5rem; --rot:  .8deg; }
.shot:nth-child(6n + 4) { --dx:  .3rem; --dy:  .2rem; --rot: -.5deg; }
.shot:nth-child(6n + 5) { --dx: -.5rem; --dy: 1.1rem; --rot:  .3deg; }
.shot:nth-child(6n + 6) { --dx:  .2rem; --dy: -.7rem; --rot: -.9deg; }

.shot {
  opacity: 0;
  transform: translate(var(--dx), calc(var(--dy) + 1.4rem)) rotate(var(--rot));
}
body.gallery-open .shot {
  animation: shot-in .85s cubic-bezier(.22, .8, .28, 1) forwards;
  animation-delay: calc(.25s + var(--i, 0) * 110ms);
}
.shot:hover, .shot:focus-within { z-index: 2; }

@keyframes shot-in {
  to { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); }
}

/* The peek and the frame live on the figure, so they stay free of
   the arrival above. */
.shot figure {
  position: relative;
  transition: transform .45s cubic-bezier(.22, .8, .28, 1), box-shadow .45s ease;
}
.shot:hover figure,
.shot:focus-within figure {
  transform: translateY(-.6rem) scale(1.035);
  box-shadow: 0 1.1rem 2.2rem var(--shot-shadow);
}
.shot img {
  width: 100%;
  height: auto;
  border: var(--line-w) solid var(--line);
  border-radius: var(--radius-tight);
}

/* A thin frame that grows outwards from the edge of the photograph. */
.shot figure::before {
  content: "";
  position: absolute;
  inset: 0;
  border: var(--line-w) solid var(--shot-frame);
  border-radius: var(--radius-tight);
  opacity: 0;
  pointer-events: none;
  transition: inset .45s cubic-bezier(.22, .8, .28, 1), opacity .35s ease;
}
.shot:hover figure::before,
.shot:focus-within figure::before { inset: -.75rem; opacity: .8; }

.shot figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
  padding: 1.6rem .7rem .6rem;
  border-radius: 0 0 var(--radius-tight) var(--radius-tight);
  background: linear-gradient(to top, var(--shot-veil), transparent);
  color: var(--on-dark);
  font: 500 .66rem/1.2 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(.4rem);
  transition: opacity .35s ease, transform .35s ease;
}
.shot:hover figcaption,
.shot:focus-within figcaption { opacity: 1; transform: none; }
.shot-when { opacity: .8; }

@media (prefers-reduced-motion: reduce) {
  .centerpiece,
  .gallery,
  .shot figure,
  .shot figure::before,
  .shot figcaption { transition: none; }
  body.gallery-open .shot { animation: none; }
  .shot { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); }
}

/* ── Story section ── */

.story {
  position: relative;
  z-index: 1;
  border-top: var(--line-w) solid var(--line);
  background: var(--cream);
  padding-block: var(--stack);
}
.story .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 4rem);
  align-items: center;
}
@media (min-width: 760px) {
  .story .wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
}
.story-photo img,
.story-photo .placeholder {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-tight);
  border: var(--line-w) solid var(--line);
  object-fit: cover;
}
.story-photo .placeholder {
  display: grid;
  place-items: center;
  background: var(--cream-deep);
  color: var(--ink-faint);
  font: 500 .78rem/1.4 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
  padding: 1.5rem;
}
.story h2 {
  font-size: var(--step-h2);
  font-weight: 400;
  margin-bottom: 1.3rem;
}
.story .prose { max-width: var(--measure); color: var(--ink-soft); }
.story .prose p + p { margin-top: 1.1rem; }

/* ── Generic section (legal page) ── */

.section .prose { max-width: var(--measure); color: var(--ink-soft); }
.section .prose p + p { margin-top: 1.1rem; }

/* ── Footer ── */

.site-footer {
  border-top: var(--line-w) solid var(--line);
  background: var(--cream-deep);
  padding-block: 2.6rem;
  font-size: .9rem;
  color: var(--ink-soft);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
}
.site-footer a { color: var(--ink-soft); }

/* ── Legal page ── */

.legal { padding-block: var(--stack); }
.legal h1 { font-size: var(--step-h2); font-weight: 400; margin-bottom: 2rem; }
.legal h2 {
  font: 500 .8rem/1 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 2.4rem 0 .9rem;
}
.legal .prose { max-width: var(--measure); color: var(--ink-soft); }
.legal .prose p + p { margin-top: 1rem; }
.legal dl { max-width: var(--measure); color: var(--ink-soft); }
.legal dt { font: 500 .78rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); margin-top: 1rem; }
.legal dd { margin-top: .25rem; }

.todo {
  background: var(--teal-tint);
  border-left: 3px solid var(--teal);
  padding: 1rem 1.2rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
  max-width: var(--measure);
  font-size: .95rem;
}
