/* ════════════════════════════════════════════════════════════════════════
   lisamuschinski.com — shared foundation.

   The house style is an educational art museum: gallery white, a modern
   literary serif for anything you read, an engraved display serif for
   titles, and a small sans reserved for wall labels and metadata.
   Two rooms share it — /teaching (warm, writerly) and /work (cool, spare).
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --paper: #fcfbf9;           /* the wall */
  --wall: #f4f2ee;            /* recessed panels, cards, hovers */
  --ink: #16161a;
  --ink-mid: rgba(22, 22, 26, 0.68);
  --ink-dim: rgba(22, 22, 26, 0.42);
  --rule: rgba(22, 22, 26, 0.16);
  --rule-soft: rgba(22, 22, 26, 0.07);
  --link: #33505e;            /* slate ink */
  --accent: #9b5a2b;          /* ochre — labels, hovers, the one warm note */

  --display: "Instrument Serif", "Big Caslon", "Hoefler Text", Georgia, serif;
  --text: "Newsreader", "Hoefler Text", Georgia, "Times New Roman", serif;
  --label: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* ── The blob ───────────────────────────────────────────────────────
     A soft shape drifting behind the gallery. Measured from the viewport's
     top-left; the parallax rate lives on the <img> as data-speed
     (0.14 = drifts up at 14% of scroll speed, 0 = fixed in place). */
  --blob-top: 14vh;
  --blob-left: 46vw;
  --blob-width: min(82vw, 980px);
  --blob-rotate: -12deg;
  --blob-opacity: 0.16;
  --blob-blur: 26px;

  --page: 1180px;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --dur: 0.3s;
  --slow: 0.75s;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html.dark-mode {
  --paper: #121214;
  --wall: #1a1a1d;
  --ink: #ece7de;
  --ink-mid: rgba(236, 231, 222, 0.66);
  --ink-dim: rgba(236, 231, 222, 0.38);
  --rule: rgba(236, 231, 222, 0.18);
  --rule-soft: rgba(236, 231, 222, 0.08);
  --link: #9dbccb;
  --accent: #d79a63;
  --blob-opacity: 0.22;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 18px;
  font-optical-sizing: auto;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }
p { margin: 0 0 1em; }

::selection { background: var(--accent); color: var(--paper); }

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

[id] { scroll-margin-top: 5.5rem; }

/* ── The blob ───────────────────────────────────────────────────────── */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.backdrop-blob {
  position: absolute;
  top: var(--blob-top);
  left: var(--blob-left);
  width: var(--blob-width);
  max-width: none;
  opacity: var(--blob-opacity);
  filter: blur(var(--blob-blur));
  transform: translate3d(0, var(--parallax, 0px), 0) rotate(var(--blob-rotate));
  will-change: transform;
  transition: opacity var(--dur) var(--ease);
}
/* Everything after the backdrop sits in front of it. */
.backdrop ~ nav,
.backdrop ~ main,
.backdrop ~ footer { position: relative; z-index: 1; }

/* ── Wall label: the small sans used for every piece of metadata ─────── */
.label {
  font-family: var(--label);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.5;
}

.rule { height: 1px; background: var(--rule-soft); border: 0; margin: 0; }

/* ── Site bar ───────────────────────────────────────────────────────── */
.sitebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule-soft);
}

.sitebar-name {
  font-family: var(--display);
  font-size: 1.24rem;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.sitebar-name:hover { color: var(--accent); }

.sitebar-nav { display: flex; align-items: center; gap: clamp(0.9rem, 2.5vw, 1.9rem); }

.sitebar-nav a,
.theme-toggle {
  position: relative;
  padding: 0.3rem 0;
  background: none;
  border: 0;
  color: var(--ink-mid);
  font-family: var(--label);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.sitebar-nav a:hover,
.theme-toggle:hover { color: var(--accent); }

/* The current room keeps a hairline under it. */
.sitebar-nav a[aria-current="page"] { color: var(--ink); }
.sitebar-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.15rem;
  height: 1px;
  background: var(--accent);
}

/* The toggle shows where it will take you: a moon by day, a sun by night.
   Drawn as masks so the icon takes the text colour, hover included. */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
}
.theme-toggle::before {
  content: "";
  width: 1.05rem;
  height: 1.05rem;
  background: currentColor;
  -webkit-mask: var(--toggle-icon) center / contain no-repeat;
  mask: var(--toggle-icon) center / contain no-repeat;
  --toggle-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.5 14.6A8.5 8.5 0 0 1 9.4 3.5a8.5 8.5 0 1 0 11.1 11.1z'/%3E%3C/svg%3E");
}
html.dark-mode .theme-toggle::before {
  --toggle-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.2' fill='black'/%3E%3Cpath d='M12 1.8v2.6M12 19.6v2.6M1.8 12h2.6M19.6 12h2.6M4.8 4.8l1.8 1.8M17.4 17.4l1.8 1.8M4.8 19.2l1.8-1.8M17.4 6.6l1.8-1.8'/%3E%3C/svg%3E");
}

/* ── Page furniture ─────────────────────────────────────────────────── */
.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.page-head { padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(2rem, 5vw, 3.5rem); }
.page-head .label { color: var(--accent); margin-bottom: clamp(1rem, 3vw, 1.8rem); }
.page-head h1 {
  font-family: var(--display);
  font-size: clamp(2.9rem, 9vw, 6rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
}
.page-head h1 .amp { font-style: italic; color: var(--ink-dim); }
.page-dek {
  max-width: 34ch;
  margin: 1.4rem 0 0;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--ink-mid);
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.85rem 1.7rem;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  font-family: var(--label);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.btn:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }

/* ── Colophon (shared footer) ───────────────────────────────────────── */
.colophon {
  margin-top: clamp(4rem, 10vw, 8rem);
  border-top: 1px solid var(--rule-soft);
  background: var(--wall);
}
.colophon-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4rem) var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem clamp(2rem, 6vw, 5rem);
  align-items: start;
}
.colophon h2 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.1;
}
.colophon-note { margin: 0.7rem 0 0; color: var(--ink-mid); font-style: italic; max-width: 32ch; }
.colophon-links { margin: 0; padding: 0; list-style: none; }
.colophon-links li { border-top: 1px solid var(--rule-soft); }
.colophon-links li:last-child { border-bottom: 1px solid var(--rule-soft); }
.colophon-links a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.colophon-links a:hover { color: var(--accent); }
.colophon-links .label { color: var(--ink-dim); white-space: nowrap; }
.colophon-fine {
  grid-column: 1 / -1;
  margin: 1rem 0 0;
  color: var(--ink-dim);
}

.cms-status { color: var(--ink-dim); font-style: italic; }

@media (max-width: 720px) {
  .colophon-inner { grid-template-columns: minmax(0, 1fr); }

  /* The name and three wide-tracked links cannot share a row on a phone —
     they ran off the right edge. The bar becomes two centred rows instead,
     and the nav itself may wrap again if a name is longer still. */
  .sitebar {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 0.45rem;
    padding: 0.7rem clamp(1rem, 5vw, 2rem);
  }
  .sitebar-name { flex: 1 0 100%; text-align: center; font-size: 1.1rem; }
  .sitebar-nav { flex-wrap: wrap; justify-content: center; gap: 0.5rem 1.15rem; }
  .sitebar-nav a,
  .theme-toggle { font-size: 0.64rem; letter-spacing: 0.12em; }

  /* Two rows of bar to clear when jumping to a hall. */
  [id] { scroll-margin-top: 7.5rem; }
}

/* At the narrowest sizes the toggle was tipping onto a third row of its
   own. Tighter tracking and gaps keep the nav to a single line. */
@media (max-width: 380px) {
  .sitebar-nav { gap: 0.4rem 0.75rem; }
  .sitebar-nav a,
  .theme-toggle { font-size: 0.6rem; letter-spacing: 0.1em; }
  .theme-toggle { width: 1.5rem; height: 1.5rem; }
}

/* Reduced motion stills the site, except the hover effects on the splash
   panels and on /work, and the glide down to a hall — those should always
   ease rather than snap. */
@media (prefers-reduced-motion: reduce) {
  :where(*:not(.panel, .panel-face, .panel-veil, .split-seam, .work-title a,
                .plate, .plate-zoom img, .plate-size, .vitrine-img img)),
  *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
