/* ============================================================
   Memorial site — main stylesheet
   Aesthetic: refined, dignified, calm. No flashy motion.
   ============================================================ */

:root {
  /* Surfaces */
  --bg: #0c1014;
  --bg-elev: #11161d;
  --surface: #161c25;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);

  /* Text */
  --ink-1: #ebe5d7;          /* warm off-white, primary */
  --ink-2: #a8a89f;          /* secondary */
  --ink-3: #6b6e75;          /* muted */
  --ink-inverse: #0c1014;

  /* Accents — careful, muted Ukrainian flag */
  --accent-blue: #355d8a;
  --accent-yellow: #c9a227;
  --accent-soft: rgba(201, 162, 39, 0.18);

  /* Typography */
  --font-display: "Cormorant Garamond", "EB Garamond", "Times New Roman", serif;
  --font-body: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  /* Spacing */
  --gutter: clamp(1.25rem, 4vw, 3rem);

  /* Motion (kept very subtle) */
  --t-fade: 320ms ease;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* The [hidden] attribute must always win — class selectors with display: flex/grid
   would otherwise override the user-agent rule. */
[hidden] { display: none !important; }

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
kbd {
  display: inline-block;
  padding: 0.05em 0.4em;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font: 500 0.8em var(--font-body);
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.03);
}

/* ----- Base ----- */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink-1);
  font: 400 1rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;

  /* Very subtle vignette */
  background-image:
    radial-gradient(ellipse at top, rgba(53, 93, 138, 0.05), transparent 60%),
    radial-gradient(ellipse at bottom, rgba(0, 0, 0, 0.4), transparent 50%);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--ink-1);
  padding: 0.6rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

::selection { background: var(--accent-soft); color: var(--ink-1); }

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: relative;
  z-index: 5;
  padding: 1.1rem var(--gutter);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink-1);
}
.brand__mark {
  width: 14px;
  height: 14px;
  position: relative;
  flex: none;
}
.brand__mark::before,
.brand__mark::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 100%;
  height: 50%;
}
.brand__mark::before { top: 0; background: var(--accent-blue); }
.brand__mark::after { bottom: 0; background: var(--accent-yellow); }
.brand__text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
}

.site-header__meta {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}
.counter__current { color: var(--ink-1); font-size: 1.25rem; }
.counter__sep { color: var(--ink-3); }

/* ============================================================
   Stage
   ============================================================ */
.stage {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  outline: none;
  position: relative;
}

/* ----- Loading / Empty states ----- */
.state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  padding: var(--gutter);
}
.state__inner { text-align: center; color: var(--ink-2); }
.state__text { margin: 0; font-size: 1.1rem; letter-spacing: 0.03em; }

.state__spinner {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-top-color: var(--accent-yellow);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 1.2s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Slide
   ============================================================ */
.slide {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(2rem, 5vh, 4rem) var(--gutter);
  opacity: 1;
  transition: opacity var(--t-fade);
}
.slide.is-fading { opacity: 0; }

/* ----- Portrait ----- */
.slide__media { display: flex; justify-content: center; }

.portrait {
  margin: 0;
  position: relative;
  display: inline-block;
  max-width: 100%;
}
.portrait__frame {
  position: relative;
  aspect-ratio: 4 / 5;
  width: min(100%, 480px);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow:
    0 30px 60px -30px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}
.portrait__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Slight desaturation to feel respectful; tweak if too strong */
  filter: saturate(0.92) contrast(1.02);
}

/* Thin blue-yellow ribbon on the left edge of the portrait */
.portrait__ribbon {
  position: absolute;
  top: 0;
  left: -10px;
  bottom: 0;
  width: 3px;
  display: flex;
  flex-direction: column;
}
.portrait__ribbon-blue,
.portrait__ribbon-yellow { flex: 1; }
.portrait__ribbon-blue { background: var(--accent-blue); }
.portrait__ribbon-yellow { background: var(--accent-yellow); }

/* ----- Body ----- */
.slide__body { min-width: 0; }

.eyebrow {
  margin: 0 0 1.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-yellow);
  font-weight: 500;
}

.name {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.005em;
  color: var(--ink-1);
}

.callsign {
  margin: 0 0 1.4rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--ink-2);
}

.dates {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 0 2rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--line);
}
.dates__dash { color: var(--ink-3); }
.dates__birth, .dates__death { color: var(--ink-1); }
.dates__age {
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-left: 0.5rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--line-strong);
}

.facts {
  margin: 0 0 1.8rem;
  display: grid;
  gap: 0.65rem;
}
.facts__row {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1rem;
  font-size: 0.95rem;
  align-items: baseline;
}
.facts__row dt {
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.facts__row dd {
  margin: 0;
  color: var(--ink-1);
}

.short-text {
  margin: 0 0 1.5rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--ink-1);
  padding-left: 1rem;
  border-left: 2px solid var(--accent-yellow);
}

.full-text {
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 60ch;
}
.full-text p { margin: 0 0 1em; }
.full-text p:last-child { margin-bottom: 0; }

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem var(--gutter);
  border-top: 1px solid var(--line);
  position: sticky;
  bottom: 0;
  background: rgba(12, 16, 20, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 4;
}

.nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  color: var(--ink-1);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: border-color var(--t-fade), color var(--t-fade), background-color var(--t-fade);
  min-height: 44px;
}
.nav__btn:hover,
.nav__btn:focus-visible {
  border-color: var(--accent-yellow);
  color: var(--accent-yellow);
  outline: none;
}
.nav__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.nav__btn:disabled:hover {
  border-color: var(--line);
  color: var(--ink-1);
}
.nav__btn svg { width: 18px; height: 18px; flex: none; }

.nav__hint {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  text-align: center;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  padding: 1.25rem var(--gutter);
  text-align: center;
  color: var(--ink-3);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-top: 1px solid var(--line);
}
.site-footer p { margin: 0; }

/* ============================================================
   Responsive
   ============================================================ */

/* Tablet */
@media (max-width: 960px) {
  .slide {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  .slide__media { justify-content: center; }
  .portrait__frame { width: min(100%, 380px); }
  .facts__row { grid-template-columns: 9rem 1fr; }
  .nav__hint { display: none; }
}

/* Phone */
@media (max-width: 600px) {
  :root { --gutter: 1.1rem; }

  .site-header { padding: 0.85rem var(--gutter); }
  .brand__text { font-size: 1.1rem; }
  .site-header__meta { font-size: 0.95rem; }
  .counter__current { font-size: 1.05rem; }

  .portrait__frame { width: min(100%, 320px); }
  .portrait__ribbon { left: -6px; width: 2px; }

  .eyebrow { font-size: 0.7rem; }
  .name { font-size: 2rem; }
  .dates { font-size: 1.15rem; padding-bottom: 1.2rem; margin-bottom: 1.4rem; }

  .facts__row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--line);
  }
  .facts__row:last-child { border-bottom: none; }

  .short-text { font-size: 1.05rem; }
  .nav { padding: 0.75rem var(--gutter); }
  .nav__btn { padding: 0.55rem 0.75rem; font-size: 0.75rem; }
  .nav__label { display: none; } /* arrows only on small screens */

  .site-footer { font-size: 0.7rem; letter-spacing: 0.14em; }
}

/* Tall / portrait tablets */
@media (min-width: 601px) and (max-width: 960px) and (orientation: portrait) {
  .portrait__frame { width: min(60%, 360px); }
}

/* Very large screens — keep content readable, don't let it stretch */
@media (min-width: 1600px) {
  .slide { max-width: 1500px; }
}
