/* Dual-identity surfaces: atmospheric home, solid-color reading pages. */
.identity-brand {
  position: relative;
  display: block;
  width: 6.1rem;
  aspect-ratio: 1259 / 1161;
  margin-inline: auto;
}

.identity-brand img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 180ms ease;
}

.identity-brand .identity-seal--night { opacity: 0; }
body[data-visual-identity="engram"] .identity-brand .identity-seal--day { opacity: 0; }
body[data-visual-identity="engram"] .identity-brand .identity-seal--night { opacity: 1; }

.side-rail nav .nav-label-en,
.side-rail nav .nav-label-ko { display: block; line-height: 1.25; }
.side-rail nav .nav-label-ko { margin-top: 0.16rem; font-size: 0.9em; letter-spacing: 0.09em; }

.cinema-backdrops {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #e7eef0;
}

.cinema-backdrop {
  position: absolute;
  inset: 0;
  background-position: center 46%;
  background-size: cover;
  transition: opacity 780ms ease;
  will-change: opacity;
}

.cinema-backdrop--day {
  background-image:
    linear-gradient(105deg, rgba(234, 241, 241, 0.91), rgba(225, 235, 238, 0.82) 58%, rgba(219, 231, 235, 0.74)),
    url("/cinema/assets/afterimage-day.webp");
  opacity: 1;
}

.cinema-backdrop--night {
  background-image:
    linear-gradient(105deg, rgba(19, 25, 36, 0.94), rgba(23, 29, 42, 0.87) 58%, rgba(30, 35, 48, 0.82)),
    url("/cinema/assets/engram-night.webp");
  background-position: center center;
  opacity: 0;
}

body[data-visual-identity="engram"] .cinema-backdrop--day { opacity: 0; }
body[data-visual-identity="engram"] .cinema-backdrop--night { opacity: 1; }

.dual-home {
  --home-ink: #253238;
  --home-muted: #4a5b61;
  --home-rule: rgba(37, 50, 56, 0.22);
  --home-masthead: rgba(226, 236, 238, 0.32);
  color: var(--home-ink);
  background: #e7eef0;
}

.dual-home[data-visual-identity="engram"] {
  --home-ink: #f2f1ec;
  --home-muted: #c6cbd0;
  --home-rule: rgba(242, 241, 236, 0.24);
  --home-masthead: rgba(25, 30, 42, 0.3);
  --red: #d68d81;
}

.dual-home .side-rail {
  color: var(--home-ink);
  border-color: var(--home-rule);
  background: transparent;
  backdrop-filter: none;
}

.dual-home .side-rail nav a,
.dual-home .mobile-masthead nav a,
.dual-home .rail-mark { color: var(--home-muted); }
.dual-home .side-rail nav a:hover,
.dual-home .side-rail nav a.is-active,
.dual-home .mobile-masthead nav a:hover,
.dual-home .mobile-masthead nav a.is-active { color: var(--home-ink); }
.dual-home .side-rail nav a.is-active::before { background: var(--red); }
.dual-home[data-visual-identity="engram"] .identity-seal--night { filter: brightness(1.65); }

.dual-home .mobile-masthead {
  color: var(--home-ink);
  border-color: var(--home-rule);
  background: var(--home-masthead);
  backdrop-filter: blur(12px);
}

.dual-home .cinema-shell { position: relative; z-index: 1; }
.dual-home .landing-main { display: block; min-height: 0; overflow: visible; isolation: auto; }

.dual-home .landing-section {
  position: relative;
  display: flex;
  align-items: center;
  min-height: clamp(29rem, 58svh, 35rem);
  padding: 3rem clamp(1.5rem, 5vw, 5rem) 2.5rem;
  scroll-margin-top: 0;
}

.dual-home .landing-copy {
  display: block;
  width: min(56rem, 94%);
  margin-left: clamp(0.5rem, 3vw, 3rem);
  padding: 0;
  color: var(--home-ink);
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  text-shadow: 0 1px 2px rgba(10, 18, 26, 0.08);
}

.dual-home .landing-feature-link {
  cursor: pointer;
  text-decoration: none;
}

.dual-home .landing-feature-link:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 0.8rem;
}

.dual-home .landing-feature-link:hover .landing-deck,
.dual-home .landing-feature-link:focus-visible .landing-deck {
  opacity: 0.72;
}

.dual-home .landing-feature-link:hover .brand-heading--landing,
.dual-home .landing-feature-link:focus-visible .brand-heading--landing {
  transform: translateX(3px);
}

.dual-home .landing-copy .eyebrow { margin-bottom: 0.65rem; color: var(--red); }
.dual-home .landing-intro { max-width: 42rem; margin: 0.5rem 0 0; color: var(--home-ink); }
.dual-home .landing-deck {
  max-width: 46rem;
  margin: 1.1rem 0 0;
  color: var(--home-ink);
  font-size: clamp(1.65rem, 2.6vw, 2.6rem);
  line-height: 1.22;
  transition: opacity 220ms ease;
}

.dual-home .brand-heading--landing {
  position: relative;
  width: min(100%, 50rem);
  height: clamp(7.5rem, 12vw, 10rem);
  overflow: hidden;
  transition: transform 220ms ease;
}

.dual-home .brand-heading--landing .brand-lockup {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: auto;
  transform: translateY(-50%);
}

/* Lift only the distressed lettering on the night field; leave each crimson seal untouched. */
.dual-home .brand-heading--landing::after {
  position: absolute;
  inset: 0;
  background: #f1f2ef;
  clip-path: inset(0 11% 0 0);
  content: "";
  opacity: 0;
  pointer-events: none;
  -webkit-mask-image: var(--wordmark-mask);
  mask-image: var(--wordmark-mask);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% auto;
  mask-size: 100% auto;
  transition: opacity 780ms ease;
}

.dual-home .landing-section--afterimage .brand-heading--landing { --wordmark-mask: url("/cinema/assets/afterimage-title.png"); }
.dual-home .landing-section--engram .brand-heading--landing { --wordmark-mask: url("/cinema/assets/engram-wordmark.png"); }
.dual-home .landing-section--engram .brand-heading--landing::after {
  background: linear-gradient(90deg, rgba(241, 242, 239, 0.46), rgba(241, 242, 239, 0.72) 42%, rgba(241, 242, 239, 0.98) 87%);
}
.dual-home[data-visual-identity="engram"] .brand-heading--landing::after { opacity: 0.88; }

.dual-home .landing-section--engram .brand-heading--landing {
  width: min(100%, 47rem);
}

.dual-home .landing-section--engram .landing-deck { font-style: normal; }

.dual-home .landing-footer {
  position: relative;
  right: auto;
  bottom: auto;
  left: auto;
  padding: 1.5rem clamp(1.5rem, 5vw, 5rem) 2rem;
  color: var(--home-muted);
  background: transparent;
  text-shadow: 0 1px 2px rgba(10, 18, 26, 0.08);
}

.log-page {
  --paper: #e8eff0;
  --paper-deep: #d9e4e7;
  --paper-light: #f3f7f7;
  background: var(--paper);
}

.log-page .side-rail,
.log-page .mobile-masthead {
  background: var(--paper);
  backdrop-filter: none;
}

.log-page .control-field select,
.log-page .control-field input { background: #f3f7f7; }

.engram-page {
  --paper: #d9dfe1;
  --paper-deep: #cbd4d8;
  --paper-light: #e9eeed;
  background: var(--paper);
}

.engram-page .side-rail,
.engram-page .mobile-masthead {
  background: var(--paper);
  backdrop-filter: none;
}

.engram-index-page {
  --paper: #29343f;
  --ink: #eef0ee;
  --muted: #c5cdd0;
  --faint: #a7b3b8;
  --rule: rgba(238, 240, 238, 0.16);
  --rule-strong: rgba(238, 240, 238, 0.27);
  --red: #d69588;
  color: var(--ink);
}

.engram-index-page .engram-header .brand-heading { position: relative; overflow: hidden; }
.engram-index-page .engram-header .brand-heading::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(241, 242, 239, 0.62), rgba(241, 242, 239, 0.98));
  clip-path: inset(0 11% 0 0);
  content: "";
  pointer-events: none;
  -webkit-mask: url("/cinema/assets/engram-wordmark.png") center / 100% auto no-repeat;
  mask: url("/cinema/assets/engram-wordmark.png") center / 100% auto no-repeat;
}
.engram-index-page .identity-seal--night { filter: brightness(1.65); }

.engram-essay-page {
  --paper: #29343f;
  --ink: #eef0ee;
  --muted: #c5cdd0;
  --faint: #a7b3b8;
  --rule: rgba(238, 240, 238, 0.16);
  --rule-strong: rgba(238, 240, 238, 0.27);
  --red: #d69588;
  color: var(--ink);
}

.engram-main {
  min-height: 100svh;
  padding: clamp(2rem, 5vw, 5rem) clamp(1.3rem, 6vw, 6rem) 8rem;
  background: var(--paper);
}

.engram-header,
.engram-essay-frame {
  width: min(100%, 68rem);
  margin-inline: auto;
}

.engram-header { padding-bottom: 4rem; }
.engram-header .brand-heading { width: min(100%, 43rem); }
.engram-header .brand-lockup { width: 100%; height: auto; }
.engram-header .landing-deck { font-style: normal; }
.engram-header .landing-intro { margin-top: 0.5rem; }
.engram-index-list { border-top: 1px solid var(--rule-strong); }
.engram-index-item { display: grid; grid-template-columns: minmax(0, 1fr) min(30%, 19rem); align-items: center; gap: clamp(1.5rem, 4vw, 3.5rem); padding: 2rem 0; border-bottom: 1px solid var(--rule-strong); }
.engram-index-item h2 { margin: 0.5rem 0; font-family: var(--film-serif); font-size: clamp(1.7rem, 3vw, 2.6rem); font-weight: 400; }
.engram-index-item p { margin: 0.35rem 0; color: var(--muted); }
.engram-index-item a { color: inherit; text-decoration: none; }
.engram-index-item a:hover,
.engram-index-item a:focus-visible { color: var(--red); }
.engram-index-media { display: block; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--rule-strong); background: #1d2832; }
.engram-index-media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; filter: saturate(0.8); transition: transform 220ms ease, opacity 220ms ease; }
.engram-index-media:hover img,
.engram-index-media:focus-visible img { transform: scale(1.025); opacity: 0.86; }
.engram-essay-frame {
  max-width: 58rem;
  padding: clamp(1.35rem, 5vw, 4.5rem);
  background: transparent;
  box-shadow: none;
}
.engram-essay-hero { aspect-ratio: 1080 / 580; margin: 0 0 2.6rem; overflow: hidden; border: 1px solid var(--rule-strong); background: #1d2832; }
.engram-essay-hero img { display: block; width: 100%; height: 100%; object-fit: contain; filter: saturate(0.78) contrast(0.94); }
.engram-essay-frame h1 { margin: 0.6rem 0 0; font-family: var(--film-serif); font-size: clamp(2.3rem, 5vw, 4.3rem); font-weight: 400; line-height: 1.12; }
.engram-essay-subhead { margin: 1.3rem 0; color: var(--muted); font-family: var(--film-serif); font-size: clamp(1.05rem, 1.7vw, 1.35rem); }
.engram-essay-meta { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; color: var(--red); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.engram-language-nav { display: flex; gap: 1rem; align-items: center; margin: 2.5rem 0 1.8rem; padding: 1rem 0; border-block: 1px solid var(--rule-strong); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; }
.engram-language-nav a[aria-current="page"] { color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 0.35em; }
.engram-share { margin-left: auto; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: inherit; font-weight: inherit; letter-spacing: inherit; text-transform: uppercase; }
.engram-share:hover { color: var(--red); }
.engram-essay-body { max-width: 42rem; margin: 2rem auto 0; font-family: var(--film-serif); font-size: clamp(1.08rem, 1.8vw, 1.28rem); line-height: 1.9; }
.engram-essay-body p { margin: 0 0 1.6em; }
.engram-essay-body h2 { margin: 2.4em 0 0.7em; font-size: 1.45em; line-height: 1.35; }
.engram-essay-body .editorial-hold { padding: 1rem 0; color: var(--red); font-family: var(--sans); font-size: 0.85rem; }

.engram-crosslink { display: inline-block; margin-top: 0.9rem; color: var(--red); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-decoration-thickness: 1px; text-underline-offset: 0.25em; text-transform: uppercase; }

@media (max-width: 680px) {
  .mobile-masthead { position: sticky; top: 0; }
  .mobile-masthead .identity-brand { width: 2.6rem; height: 2.5rem; margin: 0; }
  .mobile-masthead nav { gap: 0.7rem; }
  .mobile-masthead nav a { font-size: 0.58rem; letter-spacing: 0.05em; }
  .dual-home .landing-section { min-height: 0; padding: 2.4rem 1.25rem 2.6rem; scroll-margin-top: 4rem; }
  .dual-home .landing-copy { width: 100%; margin: 0; }
  .dual-home .landing-deck { font-size: clamp(1.6rem, 7vw, 2rem); }
  .dual-home .landing-footer { align-items: flex-start; flex-direction: column; gap: 0.25rem; padding: 1.75rem 1.25rem 2rem; font-size: 0.55rem; }
  .cinema-backdrop--day { background-position: center 45%; }
  .cinema-backdrop--night { background-position: center 52%; }
  .engram-main { padding: 2rem 1rem 5rem; }
  .engram-header { padding-bottom: 2rem; }
  .engram-index-item { grid-template-columns: 1fr; gap: 1.35rem; }
  .engram-index-media { grid-row: 1; }
  .engram-essay-hero { margin-bottom: 2rem; }
  .engram-language-nav { gap: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cinema-backdrop,
  .identity-brand img,
  .dual-home .brand-heading--landing,
  .dual-home .brand-heading--landing::after,
  .dual-home .landing-deck,
  .engram-index-media img { transition-duration: 0.01ms; }
}
