/* ============================================================
   Vintage Portfolio — wooden table + horizontal parchment scroll
   ============================================================ */

@font-face {
  font-family: "IM Fell English";
  src: url("IM_Fell_English/IMFellEnglish-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IM Fell English";
  src: url("IM_Fell_English/IMFellEnglish-Italic.ttf") format("truetype");
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

:root {
  --wood-dark: #3a2416;
  --wood-mid: #5a3a22;
  --wood-light: #7a512f;
  --wood-hi: #8a5c36;

  --paper: #e8d9b5;
  --paper-shade: #d8c39a;
  --paper-edge: #b79b6a;
  --ink: #3b2a1a;
  --ink-soft: #6a5238;
  --gold: #8a5a2b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: "IM Fell English", Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--wood-dark);
  position: relative;
  cursor: default;
}

/* ============================================================
   Wooden table surface
   ============================================================ */

.table {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    /* soft warm light pooling in the centre */
    radial-gradient(120% 90% at 50% 45%, rgba(160, 110, 60, 0.35), rgba(0, 0, 0, 0) 60%),
    /* base wood tone, running horizontally */
    linear-gradient(180deg, var(--wood-light) 0%, var(--wood-mid) 45%, var(--wood-dark) 100%);
}

/* horizontal wood grain: long planks + fine grain lines */
.table__grain {
  position: absolute;
  inset: 0;
  background-image:
    /* plank seams (thin dark horizontal lines) */
    repeating-linear-gradient(
      180deg,
      rgba(0, 0, 0, 0) 0px,
      rgba(0, 0, 0, 0) 118px,
      rgba(0, 0, 0, 0.28) 119px,
      rgba(0, 0, 0, 0.32) 120px,
      rgba(255, 220, 170, 0.05) 121px,
      rgba(0, 0, 0, 0) 122px
    ),
    /* fine flowing grain */
    repeating-linear-gradient(
      178deg,
      rgba(58, 36, 22, 0) 0px,
      rgba(58, 36, 22, 0.14) 2px,
      rgba(140, 96, 56, 0.05) 5px,
      rgba(58, 36, 22, 0) 9px
    ),
    repeating-linear-gradient(
      182deg,
      rgba(30, 18, 10, 0) 0px,
      rgba(30, 18, 10, 0.1) 3px,
      rgba(30, 18, 10, 0) 7px
    );
  mix-blend-mode: multiply;
  opacity: 0.9;
}

/* fibrous grain noise via SVG turbulence */
.table__noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.6' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 620px 620px;
  mix-blend-mode: overlay;
  opacity: 0.32;
}

.table__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(130% 110% at 50% 50%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.55) 100%);
}

/* ============================================================
   Desk stickers (table surface, behind parchment)
   ============================================================ */

.scroll-stage {
  position: relative;
  width: min(100vw, calc(100vh * 1.408));
  aspect-ratio: 4101 / 2913;
}

.desk-stickers {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}

.sticker {
  position: fixed;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.5));
  opacity: 0.94;
  left: 0;
  top: 0;
  visibility: hidden;
  transition: none;
}

.desk-stickers.is-ready .sticker {
  visibility: visible;
}

.sticker--book { width: clamp(95px, 13vw, 165px); }
.sticker--stamp { width: clamp(78px, 9vw, 120px); }
.sticker--paper-butterfly { width: clamp(68px, 7.5vw, 105px); }
.sticker--butterfly { width: clamp(88px, 10vw, 140px); }
.sticker--quill { width: clamp(88px, 10vw, 145px); }
.sticker--gramophone { width: clamp(95px, 11vw, 155px); }
.sticker--clock {
  width: clamp(72px, 7.5vw, 110px);
  margin-top: clamp(18px, 3.5vh, 36px);
}

/* ============================================================
   The scroll (rods + parchment)
   ============================================================ */

.scroll {
  position: relative;
  z-index: 2;
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(4px, 1vh, 12px) 0;
  overflow: visible;
}

/* real parchment image (rolls on left & right) */
.parchment {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  transform-origin: center center;
  transform: scaleX(0.001);
  transition: transform 1.4s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 26px 46px rgba(0, 0, 0, 0.5));
}

.scroll.is-open .scroll-stage .parchment {
  transform: scaleX(1);
}

.parchment__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

/* writable region over the flat middle of the sheet (avoids the rolls & torn edges) */
.parchment__content {
  position: absolute;
  top: 10%;
  bottom: 10%;
  left: 9%;
  right: 9%;
  overflow: hidden;
  box-sizing: border-box;
  padding-top: clamp(4px, 0.8vh, 10px);
  padding-bottom: clamp(14px, 2.5vh, 28px);
}

/* ============================================================
   Horizontal track + section pages
   ============================================================ */

.track {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  align-items: stretch;
  will-change: transform;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.page {
  position: relative;
  flex: 0 0 auto;
  width: 100vw; /* overridden by JS to match content width */
  height: 100%;
  padding: clamp(10px, 3vh, 34px) clamp(10px, 2vw, 28px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page--split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  column-gap: clamp(1rem, 3vw, 2.5rem);
  padding-top: clamp(4px, 1vh, 14px);
  padding-bottom: clamp(4px, 1vh, 14px);
}

.page--split::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 10%;
  bottom: 10%;
  width: 1px;
  transform: translateX(-50%);
  background: linear-gradient(
    180deg,
    rgba(120, 90, 50, 0),
    rgba(120, 90, 50, 0.45) 15%,
    rgba(120, 90, 50, 0.45) 85%,
    rgba(120, 90, 50, 0)
  );
  pointer-events: none;
}

.page--split .heading {
  grid-column: 1;
  margin-bottom: 0;
  align-self: center;
  max-width: 14ch;
}

.page--split .entries {
  grid-column: 2;
  align-self: stretch;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  padding-right: clamp(4px, 1vw, 12px);
  gap: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 90, 50, 0.35) transparent;
}

.page--split .entries::-webkit-scrollbar {
  width: 4px;
}

.page--split .entries::-webkit-scrollbar-thumb {
  background: rgba(120, 90, 50, 0.35);
  border-radius: 2px;
}

.page--split .entry__desc {
  max-width: none;
}

#projects.page--split,
#skills.page--split {
  align-items: center;
}

#projects.page--split .entries,
#skills.page--split .entries {
  align-self: center;
  margin-block: auto;
  max-height: calc(100% - clamp(12px, 2vh, 24px));
  overflow-y: auto;
  justify-content: safe center;
  padding-bottom: 0.35rem;
}

.page--intro {
  justify-content: center;
  padding-top: clamp(10px, 3vh, 34px);
}

.page--intro .body {
  margin-top: clamp(1.1rem, 2.6vh, 1.9rem);
}

.contact-social {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.contact-social__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: "IM Fell English", Georgia, serif;
  font-size: clamp(0.93rem, 1.5vw, 1.15rem);
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(138, 90, 43, 0.4);
  padding: 3px 0 4px;
  transition: color 0.25s, border-color 0.25s;
  white-space: nowrap;
}

.contact-social__icon {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-social__btn:hover,
.contact-social__btn:focus-visible {
  color: var(--gold);
  border-color: var(--gold);
  outline: none;
}

.about-nav {
  position: absolute;
  right: clamp(56px, 9vw, 100px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: clamp(0.85rem, 2vh, 1.2rem);
  z-index: 1;
  padding-right: 6px;
}

.about-nav__btn {
  font-family: "IM Fell English", Georgia, serif;
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  color: var(--ink);
  background: none;
  border: none;
  border-bottom: 1px solid rgba(138, 90, 43, 0.4);
  padding: 3px 0 4px;
  cursor: pointer;
  text-align: right;
  transition: color 0.25s, border-color 0.25s;
  width: fit-content;
  white-space: nowrap;
}

.about-nav__btn:hover,
.about-nav__btn:focus-visible {
  color: var(--gold);
  border-color: var(--gold);
  outline: none;
}

/* opening animation for content fade-in */
.scroll.is-open .page { animation: rise 1s ease both; }
.scroll.is-open .page:nth-child(2) { animation-delay: 0.1s; }
.scroll.is-open .page:nth-child(3) { animation-delay: 0.2s; }
.scroll.is-open .page:nth-child(4) { animation-delay: 0.3s; }
.scroll.is-open .page:nth-child(5) { animation-delay: 0.4s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  font-family: "IM Fell English", serif;
  font-style: italic;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}

.title {
  font-family: "IM Fell English", Georgia, serif;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  font-weight: 700;
  line-height: 1.18;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
  max-width: 36ch;
}

.subtitle {
  font-family: "IM Fell English", serif;
  font-style: italic;
  font-size: clamp(0.97rem, 1.75vw, 1.32rem);
  color: var(--gold);
  margin: 0.35rem 0 1.2rem;
  letter-spacing: 0.04em;
}

.heading {
  font-family: "IM Fell English", Georgia, serif;
  font-size: clamp(1.58rem, 3vw, 2.46rem);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 1.2rem;
  position: relative;
}

.heading::after {
  content: "";
  display: block;
  width: 64px;
  height: 2px;
  margin-top: 0.5rem;
  background: linear-gradient(90deg, var(--gold), rgba(138, 90, 43, 0));
}

.body {
  font-size: clamp(0.88rem, 1.32vw, 1.06rem);
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 42ch;
}

.entries { list-style: none; display: flex; flex-direction: column; gap: 1.1rem; }

.entry__name {
  display: block;
  font-family: "IM Fell English", Georgia, serif;
  font-size: clamp(0.97rem, 1.58vw, 1.19rem);
  color: var(--ink);
}

.entry__meta {
  display: block;
  font-style: italic;
  font-size: 0.84rem;
  color: var(--gold);
  margin: 0.12rem 0 0.3rem;
}

.entry__desc { color: var(--ink-soft); line-height: 1.55; max-width: 40ch; }

.entry__link {
  display: inline-block;
  margin-top: 0.5rem;
  font-family: "IM Fell English", Georgia, serif;
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(0.84rem, 1.23vw, 0.97rem);
  border-bottom: 1px solid rgba(138, 90, 43, 0.4);
  padding-bottom: 2px;
  transition: color 0.25s, border-color 0.25s;
  width: fit-content;
}
.entry__link:hover { color: var(--gold); border-color: var(--gold); }

.skills { display: flex; flex-direction: column; gap: 1.1rem; }
.skills__label {
  font-family: "IM Fell English", serif;
  font-style: italic;
  color: var(--gold);
  font-size: 0.97rem;
  margin-bottom: 0.2rem;
}

.page__index {
  position: absolute;
  bottom: clamp(18px, 3vh, 34px);
  right: clamp(20px, 3vw, 40px);
  font-family: "IM Fell English", serif;
  font-style: italic;
  color: rgba(120, 90, 50, 0.55);
  font-size: 0.97rem;
}

/* ============================================================
   Navigation compass
   ============================================================ */

.compass {
  position: fixed;
  z-index: 6;
  bottom: clamp(16px, 3vh, 30px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  padding: 10px 16px;
  border-radius: 40px;
  background: rgba(40, 26, 14, 0.55);
  backdrop-filter: blur(2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.compass__dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(232, 217, 181, 0.6);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.25s, transform 0.25s;
}
.compass__dot:hover { transform: scale(1.25); }
.compass__dot.is-active { background: var(--paper); border-color: var(--paper); }

@media (max-width: 640px) {
  .scroll-stage {
    width: 100vw;
  }

  .page--split {
    grid-template-columns: 1fr;
    align-items: start;
    row-gap: 1rem;
  }

  .page--split::before {
    display: none;
  }

  .page--split .heading {
    grid-column: 1;
    align-self: start;
    margin-bottom: 0.5rem;
    max-width: none;
  }

  .page--split .entries {
    grid-column: 1;
    max-height: none;
    overflow-y: visible;
  }

  .about-nav {
    position: static;
    transform: none;
    align-items: flex-start;
    margin-top: clamp(1.4rem, 4vh, 2rem);
  }
}
