/* ==========================================================================
   Ryan Harp — portfolio
   Look: a pre-rendered island adventure from the mid-90s. A quiet live
   landscape behind; parchment pages, brass plaques and leather-bound
   books in front. Each film is a book you open.
   ========================================================================== */

:root {
  --parchment: #e9dcbf;
  --parchment-edge: #c4ad80;
  --ink: #2b2116;
  --ink-soft: #5e4a32;
  --cream: #f1e8d3;
  --gold: #d8b66f;
  --gold-deep: #8f6b30;
  --night: #10100e;

  --brass: linear-gradient(180deg, #fff1c8 0%, #e2c07a 30%, #a87d38 49%, #6e4f1f 52%, #b8914f 74%, #f0d697 100%);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  --display: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --display-sc: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --body: "Cormorant Garamond", Georgia, "Times New Roman", serif;

  --max: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--night);
  color: var(--cream);
  font-family: var(--body);
  font-size: 1.25rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
a { color: inherit; }

/* ---------- Backdrop ---------- */

#scene, .scene-fallback, .grain { position: fixed; inset: 0; width: 100%; height: 100%; }
#scene { z-index: -3; display: block; }
.scene-fallback {
  z-index: -4;
  background:
    radial-gradient(ellipse 40% 20% at 20% 52%, #f6dfae99, transparent 70%),
    linear-gradient(180deg, #5f7890 0%, #c9b896 46%, #e8cf9c 52%, #5d6b66 53%, #1b2a2c 100%);
}
.grain {
  z-index: -2;
  pointer-events: none;
  background-image: var(--grain);
  opacity: 0.18;
  mix-blend-mode: overlay;
}

/* ---------- Type ---------- */

.engraved {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.05;
  margin: 0;
  /* chrome lettering that reflects the sunset */
  background: linear-gradient(180deg,
    #ffffff 0%, #eef2f6 28%, #a9b4c0 47%, #26303c 51%, #5d6b78 58%, #d8c7a4 76%, #fff8ea 94%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 1px 0 rgba(255, 250, 235, 0.5))
    drop-shadow(0 2px 0 #1c2430)
    drop-shadow(0 10px 22px rgba(0, 0, 0, 0.5));
}
.engraved.small { font-size: clamp(2.4rem, 4.6vw, 3.6rem); }

.note {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.1rem;
  margin: 0;
  color: #e2d4b2;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

/* ---------- Brass plaques (buttons) ---------- */

.plaque {
  display: inline-block;
  position: relative;
  font-family: var(--display-sc);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: #2a1c0b;
  text-shadow: 0 1px 0 rgba(255, 238, 196, 0.6);
  padding: 0.45em 1.35em 0.5em;
  border: 1px solid #4d391b;
  border-radius: 2px;
  background:
    radial-gradient(circle at 7px 7px, #5a4320 0 1.6px, #f3dfae 2.2px, transparent 3px),
    radial-gradient(circle at calc(100% - 7px) 7px, #5a4320 0 1.6px, #f3dfae 2.2px, transparent 3px),
    radial-gradient(circle at 7px calc(100% - 7px), #5a4320 0 1.6px, #f3dfae 2.2px, transparent 3px),
    radial-gradient(circle at calc(100% - 7px) calc(100% - 7px), #5a4320 0 1.6px, #f3dfae 2.2px, transparent 3px),
    var(--brass);
  box-shadow:
    inset 0 2px 0 rgba(255, 248, 225, 0.95),
    inset 0 -2px 0 rgba(60, 40, 10, 0.7),
    inset 2px 0 0 rgba(255, 245, 215, 0.5),
    inset -2px 0 0 rgba(60, 40, 10, 0.4),
    0 3px 0 #3b2a12,
    0 8px 18px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  cursor: pointer;
  transition: filter 0.2s, transform 0.08s;
}
.plaque:hover { filter: brightness(1.08) contrast(1.05); }
.plaque:active { transform: translateY(1px); }
.plaque:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.plaque.big { font-family: var(--display); font-size: 1.25rem; letter-spacing: 0.02em; padding: 0.6em 1.8em; }

/* ---------- Parchment page ---------- */

.page {
  position: relative;
  color: var(--ink);
  background:
    var(--grain),
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(120, 85, 40, 0.28) 100%),
    linear-gradient(180deg, #efe4c9, var(--parchment) 60%, #e0cfa8);
  background-blend-mode: soft-light, normal, normal;
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 1px rgba(120, 90, 45, 0.25),
    inset 0 0 60px rgba(140, 100, 45, 0.25),
    0 24px 60px rgba(0, 0, 0, 0.55);
}
.page .note { color: var(--ink-soft); text-shadow: none; }

/* ---------- Hero ---------- */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 1.5rem clamp(1rem, 4vw, 3rem) 2rem;
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.nav ul { display: flex; gap: 0.8rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }

.nav-mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid #4d391b;
  background: var(--brass);
  box-shadow: inset 0 1px 0 #fff6d8, inset 0 0 0 4px rgba(90, 64, 25, 0.35), 0 6px 14px rgba(0, 0, 0, 0.45);
  font-family: var(--display-sc);
  font-size: 1.05rem;
  color: #2a1c0b;
  text-decoration: none;
  text-shadow: 0 1px 0 rgba(255, 238, 196, 0.6);
}

.hero-title { align-self: center; justify-self: start; margin-top: -6vh; }
.hero-title h1 { font-size: clamp(3.4rem, 10vw, 8.5rem); letter-spacing: 0.01em; }
.hero-sub {
  font-family: var(--display-sc);
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  letter-spacing: 0.45em;
  margin: 0.5em 0 0 0.15em;
  color: var(--cream);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 16px rgba(0, 0, 0, 0.55);
}

.scroll-cue {
  justify-self: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
  font-family: var(--display);
  font-style: italic;
  font-size: 1rem;
  text-decoration: none;
  color: var(--cream);
  text-shadow: 0 1px 6px #000;
  animation: drift 3.2s ease-in-out infinite;
}
@keyframes drift { 50% { transform: translateY(6px); opacity: 0.75; } }
@media (prefers-reduced-motion: reduce) { .scroll-cue { animation: none; } }

/* ---------- Sections ---------- */

.chamber { max-width: var(--max); margin: 0 auto; padding: 7rem clamp(1rem, 4vw, 3rem) 1rem; }
.chamber-head { margin-bottom: 2.2rem; display: flex; align-items: baseline; gap: 1.5rem; flex-wrap: wrap; }

/* ---------- The shelf of books ---------- */

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 2.4rem 2rem;
}

.book {
  all: unset;
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.6rem 1.6rem 1.4rem 2.2rem;
  cursor: pointer;
  border-radius: 3px 9px 9px 3px;
  --leather: #5a2618;
  background:
    var(--grain),
    linear-gradient(90deg, rgba(0,0,0,0.55) 0, rgba(0,0,0,0.15) 14px, rgba(255,255,255,0.06) 16px, transparent 22px),
    radial-gradient(ellipse at 40% 30%, rgba(255, 220, 170, 0.14), transparent 60%),
    var(--leather);
  background-blend-mode: overlay, normal, normal, normal;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 0 40px rgba(0, 0, 0, 0.45),
    6px 0 0 -2px #e6d8b6,          /* page edges */
    8px 1px 0 -2px #b9a47c,
    0 18px 40px rgba(0, 0, 0, 0.55);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.book:nth-child(3n + 2) { --leather: #1f3b30; }
.book:nth-child(3n + 3) { --leather: #22304a; }
.book::before { /* tooled gold border */
  content: "";
  position: absolute;
  inset: 10px 10px 10px 26px;
  border: 1px solid rgba(216, 182, 111, 0.55);
  outline: 1px solid rgba(216, 182, 111, 0.25);
  outline-offset: 4px;
  border-radius: 2px;
  pointer-events: none;
}
.book:hover { transform: translateY(-5px) rotate(-0.4deg); }
.book:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; }

.book-panel {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 2px;
  background: #0b0d0c;
  box-shadow: 0 0 0 3px #1a120a, 0 0 0 4px rgba(216, 182, 111, 0.5), inset 0 0 30px #000;
}
.book-panel img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: saturate(0.8) brightness(0.85);
  transition: filter 0.6s ease, transform 0.8s ease;
}
.book:hover .book-panel img { filter: saturate(1.05) brightness(1.05); transform: scale(1.04); }
.book-panel::after { /* the panel's glow, brighter on hover */
  content: "";
  position: absolute; inset: 0;
  box-shadow: inset 0 0 24px rgba(255, 214, 150, 0.0);
  transition: box-shadow 0.5s;
}
.book:hover .book-panel::after { box-shadow: inset 0 0 28px rgba(255, 214, 150, 0.45); }

.unwritten {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(110, 140, 150, 0.35), transparent 55%),
    radial-gradient(ellipse at 70% 65%, rgba(150, 120, 80, 0.3), transparent 55%),
    #121716;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.05rem;
  color: rgba(241, 232, 211, 0.75);
}

.book-title {
  font-family: var(--display-sc);
  font-size: 1.55rem;
  line-height: 1.15;
  color: var(--gold);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 230, 170, 0.15);
  margin: 0;
  text-align: center;
}
.book-meta {
  font-family: var(--display);
  font-style: italic;
  font-size: 1rem;
  color: rgba(241, 232, 211, 0.7);
  text-align: center;
  margin: -0.6rem 0 0;
}

/* ---------- About / Contact ---------- */

.about { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 2.4rem; padding: 2.6rem; }
.about-portrait {
  margin: 0;
  aspect-ratio: 4 / 5;
  display: grid; place-items: center;
  border: 1px solid rgba(94, 74, 50, 0.45);
  outline: 1px solid rgba(94, 74, 50, 0.25);
  outline-offset: 5px;
  background: rgba(94, 74, 50, 0.08);
  font-family: var(--display);
  font-style: italic;
  color: var(--ink-soft);
  overflow: hidden;
}
.about-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 35%; display: block; }
.about-text p { margin: 0 0 1rem; }
.about-text .lede { font-family: var(--display); font-size: 1.75rem; line-height: 1.3; }

.contact { padding: 2.8rem 2rem; text-align: center; }
.contact p { margin: 0 0 1.4rem; }
.links {
  list-style: none; padding: 0; margin: 2rem 0 0;
  display: flex; justify-content: center; gap: 2rem; flex-wrap: wrap;
  font-family: var(--display-sc); font-size: 1.1rem; letter-spacing: 0.06em;
}
.links a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid rgba(94, 74, 50, 0.45); }
.links a:hover { color: var(--ink); }

.footer { text-align: center; padding: 5rem 1rem 3rem; font-family: var(--display); font-style: italic; color: rgba(241, 232, 211, 0.7); }

/* ---------- Viewer: an open book ---------- */

.viewer {
  position: fixed;
  width: min(1200px, 94vw);
  max-height: 94vh;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
.viewer::backdrop { background: rgba(8, 8, 6, 0.82); backdrop-filter: blur(3px); }
.viewer[open] .book-open { animation: open-book 0.5s ease both; }
@keyframes open-book { from { opacity: 0; transform: scale(0.96) rotateX(6deg); } }
@media (prefers-reduced-motion: reduce) { .viewer[open] .book-open { animation: none; } }

.viewer .close { position: absolute; top: -18px; right: -10px; z-index: 2; font-size: 0.95rem; padding: 0.35em 1.1em; }

.book-open {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
  padding: 14px;
  border-radius: 6px;
  background: var(--grain), #4a2014;
  background-blend-mode: overlay, normal;
  box-shadow: inset 0 0 0 1px #000, inset 0 0 30px rgba(0,0,0,0.6), 0 30px 80px #000;
  max-height: 94vh;
  overflow: auto;
}
.leaf {
  padding: 2.2rem 2.2rem 2rem;
  background:
    var(--grain),
    linear-gradient(180deg, #efe4c9, var(--parchment) 60%, #e0cfa8);
  background-blend-mode: soft-light, normal;
}
.leaf.left {
  border-radius: 3px 0 0 3px;
  box-shadow: inset -30px 0 40px -20px rgba(90, 60, 25, 0.45);
}
.leaf.right {
  border-radius: 0 3px 3px 0;
  box-shadow: inset 30px 0 40px -20px rgba(90, 60, 25, 0.45);
  display: grid; place-items: center;
}
.leaf h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 3.4vw, 2.8rem);
  line-height: 1.05;
  margin: 0.4rem 0 1rem;
}
.leaf .note { color: var(--ink-soft); text-shadow: none; }
.viewer-logline { margin: 0 0 1.4rem; font-size: 1.3rem; font-style: italic; color: var(--ink-soft); }

.panel-window {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b0d0c;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 0 0 4px #2a1d0f, 0 0 0 5px rgba(143, 107, 48, 0.6), 0 10px 30px rgba(60, 40, 15, 0.4);
}
.panel-window iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.credits { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1.2rem; margin: 0; }
.credits dt { font-family: var(--display); font-style: italic; color: var(--ink-soft); font-size: 1.05rem; padding-top: 0.15em; }
.credits dd { margin: 0; }
.laurels { list-style: none; padding: 0; margin: 1.4rem 0 0; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.laurels li {
  font-family: var(--display-sc); font-size: 0.95rem;
  border: 1px solid rgba(94, 74, 50, 0.5); border-radius: 2px; padding: 0.2em 0.7em; color: var(--ink-soft);
}

.watch { margin: 1.6rem 0 0; font-family: var(--display); font-style: italic; font-size: 1.1rem; }
.watch a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid rgba(94, 74, 50, 0.45); }
.watch a:hover { color: var(--ink); }

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  body { font-size: 1.15rem; }
  .nav ul { gap: 0.45rem; flex-wrap: nowrap; }
  .nav .plaque { font-size: 0.8rem; letter-spacing: 0.04em; padding: 0.45em 0.8em; }
  .about { grid-template-columns: 1fr; padding: 1.8rem; }
  .about-portrait { max-width: 220px; }
  .book-open { grid-template-columns: 1fr; }
  .leaf.right { order: -1; border-radius: 3px 3px 0 0; box-shadow: inset 0 -30px 40px -20px rgba(90, 60, 25, 0.45); padding: 1.2rem; }
  .leaf.left { border-radius: 0 0 3px 3px; box-shadow: inset 0 30px 40px -20px rgba(90, 60, 25, 0.45); padding: 1.6rem; }
  .hero-sub { letter-spacing: 0.3em; }
  .hero-title { align-self: end; margin: 0 0 14vh; }
}
