:root {
  color-scheme: dark;
  --wine: #360f1a;
  --ivory: var(--design-ivory);
  --gold: #c5a36f;
  --muted: #d0bdb4;
  --line: rgba(207, 171, 117, 0.32);
  --paper: #f3ece2;
  --ink: #37131e;
  --serif: var(--design-serif);
  --sans: "Inter", Arial, sans-serif;
  --page-gutter: 96px;
  --page-width: min(1400px, calc(100% - var(--page-gutter)));
  --gallery-width: min(1640px, calc(100% - var(--page-gutter)));
  --frame-inset: clamp(9px, 1.03vw, 14px);
  --frame-edge: #b6996f;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-color: #a17c59 var(--wine); }
body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  color: var(--ivory);
  background: var(--wine);
  font-family: var(--sans);
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button, input, dialog { border-radius: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, section:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 5px;
}
[hidden] { display: none !important; }
::selection { background: #d2af75; color: var(--ink); }
h1, h2, h3, p, figure, blockquote { margin: 0; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 12px 18px;
  color: var(--ink);
  background: var(--paper);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
.reading-progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 50; }
.reading-progress span { display: block; height: 100%; width: 0; background: var(--gold); }
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: linear-gradient(155deg, #3b101e, #2c0f18 68%, #210e15);
  pointer-events: none;
}
.backdrop::before,
.backdrop::after {
  content: "";
  position: absolute;
}
.backdrop::before {
  inset: -28px;
  background: url("assets/opera-backdrop.jpg") center 35% / cover no-repeat;
  filter: blur(12px) brightness(0.52) saturate(1.1);
}
.backdrop::after {
  inset: 0;
  background:
    radial-gradient(ellipse at 55% 40%, transparent 25%, rgba(22, 8, 14, 0.68)),
    linear-gradient(155deg, rgba(59, 16, 30, 0.48), rgba(44, 15, 24, 0.42) 68%, rgba(28, 10, 17, 0.62));
}
.petals { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: 0.55; }

.site-header {
  width: 100%;
  min-height: 88px;
  padding: 0 clamp(18px, 3.2vw, 48px);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.brand { min-width: 0; color: var(--ivory); text-decoration: none; }
.brand__name { font-family: var(--design-display); font-size: clamp(19px, 1.8vw, 26px); letter-spacing: 0.035em; }
.brand__name strong { color: var(--gold); font-weight: 600; }
.header-tools { display: flex; gap: 8px; flex: 0 0 auto; }
.icon-button {
  width: 44px;
  height: 44px;
  padding: 11px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--gold);
  transition: color 160ms ease, background 160ms ease;
}
.icon-button:hover { color: var(--ivory); background: rgba(255, 255, 255, 0.05); }
.icon-button svg { width: 20px; height: 20px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.motion-toggle[aria-pressed="false"] { opacity: 0.5; }
.save-button[aria-pressed="true"] svg { fill: currentColor; }

.layout { width: var(--page-width); margin: 0 auto; }
.gallery-layout { width: var(--gallery-width); margin: auto auto 0; padding: clamp(30px, 4vw, 52px) 0 42px; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(38px, 5vw, 72px) clamp(24px, 3.2vw, 52px);
}
.gallery-entry { display: block; min-width: 0; color: var(--ivory); text-decoration: none; }
.art-frame {
  aspect-ratio: 706 / 858;
  padding: var(--frame-inset);
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  border: 1px solid var(--frame-edge);
  background: #35141d;
  overflow: hidden;
}
.art-frame img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.gallery-entry h2 {
  margin-top: 18px;
  color: inherit;
  font-family: var(--serif);
  font-size: clamp(24px, 2vw, 34px);
  font-weight: 400;
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.gallery-entry:hover, .gallery-entry:focus-visible { color: var(--gold); }
.gallery-entry:hover .gallery-frame, .gallery-entry:focus-visible .gallery-frame { border-color: var(--ivory); }
.gallery-empty { grid-column: 1 / -1; padding: 42px 0; color: var(--muted); font: 24px var(--serif); }
.reader { min-width: 0; scroll-margin-top: 24px; }
.article-header {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  align-items: center;
  gap: clamp(42px, 6vw, 96px);
  padding: 56px 0 64px;
}
.article-header__copy { min-width: 0; padding: 20px 0; }
h1 {
  font-family: var(--serif);
  font-size: clamp(54px, 5.6vw, 82px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
  hyphens: none;
  overflow-wrap: break-word;
}
#article-title.is-long { font-size: clamp(48px, 4.85vw, 72px); }
#article-title.is-very-long { font-size: clamp(42px, 4.4vw, 64px); }
h1 em { color: var(--gold); font-weight: 400; }
.article-lead {
  max-width: 560px;
  margin-top: 30px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(21px, 1.7vw, 26px);
  line-height: 1.5;
}
.article-meta {
  margin-top: 25px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.save-button { margin-left: 8px; }
.article-cover { min-width: 0; width: 100%; max-width: 600px; justify-self: center; }

.article-reading {
  margin-top: 24px;
  padding: clamp(48px, 7vw, 100px) clamp(24px, 7vw, 100px);
  color: var(--ivory);
  border: 1px solid var(--line);
  background:
    var(--design-glass-sheen),
    linear-gradient(165deg, rgba(28, 12, 20, 0.84), rgba(19, 9, 16, 0.88));
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42), var(--design-glass-edge);
  scroll-margin-top: 24px;
}
.article-body {
  max-width: 740px;
  margin: 0 auto;
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.article-body > * + * { margin-top: 1.15em; }
.article-body strong { font-weight: 600; color: #f7f1e7; }
.article-body a { color: var(--gold); text-decoration-color: rgba(197, 163, 111, 0.45); text-underline-offset: 4px; transition: color 160ms ease, text-decoration-color 160ms ease; }
.article-body a:hover { color: var(--ivory); text-decoration-color: currentColor; }
.article-body .dropcap::first-letter {
  float: left;
  padding: 9px 12px 0 0;
  font-size: 76px;
  line-height: 0.8;
  color: var(--gold);
}
.article-body h2, .article-body h3, .article-body h4 { line-height: 1.15; font-weight: 500; color: var(--ivory); }
.article-body h2 { font-size: 40px; margin-top: 1.6em; }
.article-body h3 { font-size: 32px; margin-top: 1.4em; }
.article-body img { display: block; max-width: 100%; height: auto; margin: 32px auto; }
.article-body ul, .article-body ol { padding-left: 1.25em; }
.article-body pre { overflow-x: auto; padding: 18px; border: 1px solid var(--line); background: rgba(10, 5, 9, 0.65); font-size: 15px; }
.article-body code { font-size: 0.8em; }
.article-body hr { border: 0; border-top: 1px solid var(--line); margin-block: 32px; }
.article-body figcaption { color: var(--muted); font-size: 18px; }
blockquote {
  margin: 1.6em 0;
  padding: 5px 0 5px 30px;
  border-left: 1px solid var(--gold);
  color: #efe3d2;
  font-size: 30px;
  font-style: italic;
  line-height: 1.4;
}

.article-footer { margin-top: 56px; border-block: 1px solid var(--line); }
.next-entry {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 30px;
  width: 100%;
  padding: 25px 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  text-decoration: none;
}
.next-entry img { display: block; width: 100%; height: 120px; object-fit: cover; }
.next-entry strong { grid-column: 2; max-width: 850px; font-family: var(--serif); font-size: clamp(26px, 3vw, 40px); font-weight: 400; line-height: 1.1; }
.next-entry__arrow { grid-column: 3; width: 44px; color: var(--gold); transition: transform 180ms ease; }
.next-entry:hover .next-entry__arrow { transform: translateX(4px); }
.site-footer {
  width: 100%;
  margin-top: auto;
  padding: 1.2rem 2rem;
  flex: 0 0 auto;
  text-align: center;
  background: linear-gradient(to top, rgba(10, 8, 18, 0.6), transparent);
}
.site-footer p {
  font-family: var(--serif);
  font-size: 0.82rem;
  color: rgba(240, 232, 220, 0.35);
  letter-spacing: 0.05em;
  line-height: 1.6;
}
.site-footer cite { font-style: normal; }
.site-footer a {
  color: rgba(201, 168, 76, 0.45);
  text-decoration: none;
  transition: color 0.3s ease;
}
.site-footer a:hover { color: rgba(201, 168, 76, 0.7); }

.search-dialog {
  width: min(680px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--gold);
  color: var(--ivory);
  background: #2c101a;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}
.search-dialog::backdrop { background: rgba(12, 5, 8, 0.82); }
.search-box { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); margin: 0; padding: 28px; }
.search-box__top { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.search-box label { font-family: var(--serif); font-size: 36px; }
#search-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ivory);
  font-size: 16px;
}
#search-input::placeholder { color: var(--muted); }
.search-status { padding: 17px 0 8px; color: var(--muted); font-size: 11px; }
.search-results { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.search-result { display: block; width: 100%; padding: 19px 6px; border: 0; border-bottom: 1px solid var(--line); color: var(--ivory); background: transparent; text-align: left; text-decoration: none; font: 24px var(--serif); }
.search-result:hover { background: rgba(255, 255, 255, 0.04); }

@media (max-width: 1100px) {
  :root { --page-gutter: 56px; }
  .article-header { gap: 38px; }
  #article-title, #article-title.is-long { font-size: clamp(43px, 5.3vw, 60px); }
  #article-title.is-very-long { font-size: clamp(38px, 4.6vw, 52px); }
}
@media (max-width: 900px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  :root { --page-gutter: 36px; }
  .site-header { min-height: 78px; padding: 0 18px; gap: 10px; }
  .brand__name { font-size: 20px; }
  .header-tools { gap: 0; }
  .article-header { grid-template-columns: minmax(0, 1fr); gap: 30px; padding: 34px 0 44px; }
  .article-header__copy { padding: 0; }
  #article-title, #article-title.is-long { font-size: clamp(40px, 7.6vw, 56px); }
  #article-title.is-very-long { font-size: clamp(36px, 6.6vw, 48px); }
  .article-lead { margin-top: 22px; font-size: 22px; }
  .article-meta { margin-top: 14px; }
  .article-cover { width: min(100%, 480px); }
  .article-reading { margin-inline: -18px; margin-top: 18px; padding: 46px 24px; border-inline: 0; }
  .article-body { font-size: 22px; line-height: 1.6; }
  .article-body h2 { font-size: 33px; }
  blockquote { padding-left: 22px; font-size: 27px; }
  .article-footer { margin-top: 36px; }
  .next-entry { grid-template-columns: 62px minmax(0, 1fr) 28px; gap: 15px; }
  .next-entry img { height: 85px; }
  .next-entry strong { font-size: 26px; }
  .next-entry__arrow { width: 28px; }
  .search-box { padding: 20px; }
}
@media (max-width: 620px) {
  .gallery-layout { width: min(var(--page-width), 480px); }
  .gallery-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .site-footer { padding: 1rem 1.5rem; }
  .site-footer p { font-size: 0.72rem; }
}
@media (max-width: 400px) {
  .brand__name { font-size: 17px; letter-spacing: 0; }
  .article-meta { gap: 7px; font-size: 9px; }
  .save-button { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
  .petals { display: none; }
}
