:root {
  color-scheme: dark;
  --ink: #05070a;
  --white: #ffffff;
  --line: rgba(255, 255, 255, 0.2);
  --display: "Garamond", "Adobe Garamond Pro", "EB Garamond", serif;
  --text: Georgia, Cambria, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--ink);
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--white);
  font-family: var(--text);
  font-size: 20px;
}

a { color: inherit; }

.detail-film {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--ink);
  pointer-events: none;
}

.detail-silk-image,
.detail-film canvas,
.detail-film::before {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.detail-silk-image {
  background:
    radial-gradient(circle at 76% 32%, rgba(24, 76, 132, 0.32), transparent 35%),
    url("assets/silk-base-gold.png") center / cover;
  filter: brightness(0.82) saturate(0.96) contrast(1.03);
}

.detail-film canvas {
  display: block;
  opacity: 0;
  transition: opacity 1.4s ease;
}

body.webgl-ready .detail-film canvas { opacity: 0.94; }
body.webgl-ready .detail-silk-image { opacity: 0.12; }

.detail-film::before {
  content: "";
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(2, 3, 6, 0.78), rgba(2, 4, 8, 0.26) 58%, rgba(2, 3, 6, 0.46)),
    linear-gradient(180deg, rgba(2, 3, 5, 0.18), rgba(2, 3, 5, 0.58));
}

.detail-header,
main,
.detail-footer {
  position: relative;
  z-index: 1;
}

.detail-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 72px;
  padding: 0 5vw;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(5, 7, 10, 0.72);
  backdrop-filter: blur(14px);
}

.detail-brand,
.detail-back,
.detail-action {
  color: var(--white);
  text-decoration: none;
}

.detail-brand {
  display: inline-flex;
  align-items: center;
  width: max-content;
  gap: 12px;
  font-family: var(--display);
  font-size: 0.98rem;
  text-transform: uppercase;
}

.detail-mark {
  display: grid;
  width: 40px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--white);
  font-size: 12px;
}

.detail-back {
  font-family: var(--display);
  font-size: 1.02rem;
}

.detail-hero {
  display: grid;
  min-height: 78svh;
  align-items: end;
  padding: 150px 7vw 11vh;
}

.detail-shell {
  width: min(1160px, 100%);
  margin: 0 auto;
}

.detail-label {
  margin: 0 0 30px;
  font-family: var(--display);
  font-size: 1.08rem;
  text-transform: uppercase;
}

.detail-hero h1 {
  max-width: 1000px;
  margin: 0 0 28px;
  color: var(--white);
  font-size: 4.7rem;
  line-height: 0.98;
  font-weight: 400;
  letter-spacing: 0;
  font-family: var(--display);
}

.detail-deck {
  max-width: 780px;
  margin: 0;
  color: var(--white);
  font-size: 1.38rem;
  line-height: 1.64;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.52);
}

.detail-body {
  padding: 13vh 7vw 16vh;
  border-top: 1px solid var(--line);
  background: rgba(3, 5, 8, 0.38);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(210px, 0.42fr) minmax(0, 1fr);
  gap: clamp(58px, 9vw, 130px);
  align-items: start;
}

.detail-portrait {
  width: min(270px, 100%);
  margin: 0;
}

.detail-portrait img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 50% 23%;
  border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle, #000 55%, rgba(0, 0, 0, 0.82) 65%, transparent 76%);
  mask-image: radial-gradient(circle, #000 55%, rgba(0, 0, 0, 0.82) 65%, transparent 76%);
}

.detail-prose {
  max-width: 720px;
}

.detail-prose p {
  margin: 0 0 1.4em;
  color: var(--white);
  font-size: 1.08rem;
  line-height: 1.78;
  font-weight: 400;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.52);
}

.detail-action {
  display: inline-block;
  margin-top: 18px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.62);
  font-family: var(--display);
  font-size: 1.08rem;
  text-transform: uppercase;
}

.detail-footer {
  padding: 8vh 7vw;
  border-top: 1px solid var(--line);
  background: rgba(2, 3, 5, 0.72);
}

.detail-footer .detail-shell {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  font-size: 1.08rem;
}

/* Refined portrait and project pages. */
:root {
  --nav-serif: "Baskerville", "Baskerville Old Face", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --pearl: #f1ede5;
  --pearl-soft: #d7d0c4;
  --reading: #e3ddd2;
  --old-gold: #a98a50;
  --old-gold-light: #c5af78;
  --lapis: #15345d;
  --blue-mist: #ffffff;
}

.detail-silk-image {
  background: url("assets/silk-base-gold.png") center / cover;
  filter: brightness(0.86) saturate(0.96) contrast(1.03);
}

.detail-film::before {
  background:
    linear-gradient(90deg, rgba(2, 3, 6, 0.76), rgba(2, 4, 8, 0.24) 60%, rgba(2, 3, 6, 0.42)),
    linear-gradient(180deg, rgba(2, 3, 5, 0.14), rgba(2, 3, 5, 0.52));
}

.detail-header {
  min-height: 82px;
  padding-inline: clamp(28px, 4vw, 68px);
  border-bottom-color: rgba(197, 169, 106, 0.22);
  background: linear-gradient(180deg, rgba(3, 5, 9, 0.92), rgba(3, 5, 9, 0.58));
  backdrop-filter: blur(14px);
}

.detail-brand,
.detail-back,
.detail-action {
  letter-spacing: 0;
}

.detail-brand { font-family: var(--display); }
.detail-back,
.detail-action { font-family: var(--nav-serif); }

.detail-brand {
  gap: 15px;
  font-size: 0.92rem;
  font-variant-caps: small-caps;
  text-transform: none;
}

.detail-mark {
  width: 42px;
  height: 42px;
  border-color: rgba(216, 201, 164, 0.82);
  font-family: var(--display);
  box-shadow:
    inset 0 0 0 3px rgba(5, 7, 10, 0.78),
    inset 0 0 0 4px rgba(197, 169, 106, 0.2);
}

.detail-back {
  position: relative;
  color: var(--pearl-soft);
  font-size: 1rem;
  font-variant-caps: small-caps;
}

.detail-back::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -8px;
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--old-gold));
  transition: width 320ms ease;
}

.detail-back:hover::after,
.detail-back:focus-visible::after { width: 100%; }

.detail-hero {
  position: relative;
  min-height: 88svh;
  overflow: hidden;
}

.detail-hero::before {
  position: absolute;
  top: 18vh;
  right: 6vw;
  color: rgba(197, 169, 106, 0.11);
  font-family: var(--nav-serif);
  font-size: 14rem;
  line-height: 1;
  pointer-events: none;
}

body[data-detail="portrait"] .detail-hero::before { content: "V"; }
body[data-detail="project"] .detail-hero::before { content: "S"; color: rgba(48, 111, 200, 0.13); }

.detail-hero::after {
  content: "";
  position: absolute;
  right: 7vw;
  bottom: 8vh;
  width: min(36vw, 440px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(18, 59, 117, 0.88), rgba(197, 169, 106, 0.78));
}

.detail-shell { position: relative; z-index: 1; }

.detail-label {
  color: var(--old-gold);
  font-family: var(--nav-serif);
  font-variant-caps: small-caps;
  text-transform: none;
}

.detail-label::after {
  content: "";
  display: inline-block;
  width: 64px;
  height: 1px;
  margin-left: 18px;
  vertical-align: middle;
  background: linear-gradient(90deg, var(--old-gold), rgba(18, 59, 117, 0.5));
}

.detail-hero h1 {
  color: var(--pearl);
  font-family: var(--display);
  font-weight: 400;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.78);
}

.detail-deck { color: var(--blue-mist); }

.detail-body {
  border-top-color: rgba(197, 169, 106, 0.32);
  background: linear-gradient(112deg, rgba(3, 5, 8, 0.7), rgba(6, 21, 47, 0.34) 72%, rgba(3, 5, 8, 0.58));
}

body[data-detail="portrait"] .detail-body {
  background: linear-gradient(90deg, rgba(3, 5, 8, 0.7), rgba(29, 22, 12, 0.18) 42%, rgba(7, 26, 59, 0.32));
}

.detail-portrait {
  position: relative;
  padding: 12px;
}

.detail-portrait::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(197, 169, 106, 0.58);
  border-radius: 50%;
  box-shadow: 0 0 44px rgba(18, 59, 117, 0.2);
}

.detail-prose p {
  color: var(--reading);
  font-size: 1.14rem;
  line-height: 1.82;
}

.detail-prose p:first-child::first-letter {
  float: left;
  margin: 0.08em 0.12em 0 0;
  color: var(--old-gold);
  font-family: var(--nav-serif);
  font-size: 3.6em;
  line-height: 0.74;
}

.detail-action {
  color: var(--pearl);
  border-bottom-color: var(--old-gold);
  font-variant-caps: small-caps;
  text-transform: none;
}

.detail-footer {
  border-top-color: rgba(197, 169, 106, 0.26);
  background: linear-gradient(90deg, rgba(2, 3, 5, 0.9), rgba(5, 16, 35, 0.82));
}

@media (max-width: 760px) {
  .detail-header { padding-inline: 20px; }
  .detail-brand > span:last-child { display: none; }
  .detail-hero { min-height: 78svh; padding: 122px 22px 9vh; }
  .detail-hero::before { top: 16vh; right: 5vw; font-size: 7rem; }
  .detail-hero::after { right: 22px; bottom: 6vh; width: 42vw; }
  .detail-hero h1 { font-size: 3rem; }
  .detail-deck { font-size: 1.22rem; }
  .detail-body,
  .detail-footer { padding-inline: 22px; }
  .detail-grid { grid-template-columns: 1fr; gap: 46px; }
  .detail-portrait { width: 190px; padding: 8px; }
  .detail-prose p { font-size: 1.05rem; line-height: 1.76; }
  .detail-footer .detail-shell { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .detail-back::after { transition: none; }
}
