/* Two themes share one structure: .theme-desktop (reference 1) and .theme-notebook (reference 2).
   site.js sets the theme class, --accent, --accent-ink, and data-font / data-tiles on <body>. */
:root {
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --serif: "Didot", "Bodoni 72", "Bodoni MT", "Playfair Display", Georgia, serif;
  --accent: #2f6bff;
  --accent-ink: #ffffff;
  --gutter: clamp(16px, 4vw, 48px);
}
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { letter-spacing: -0.035em; line-height: 1.04; }
h1, h2 { font-family: var(--display); font-weight: var(--display-weight); font-style: var(--display-style); }
h1 em { font-style: italic; display: inline-block; padding-bottom: .08em; }
img, video { display: block; max-width: 100%; }

body[data-font="sans"] { --display: var(--sans) !important; --display-weight: 650 !important; --display-style: normal !important; }
body[data-font="serif"] { --display: var(--serif) !important; --display-weight: 400 !important; --display-style: italic !important; }

/* ---------- Shared layout ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  height: 64px; padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between;
}
.nav__brand { font-weight: 600; letter-spacing: -0.02em; }
.nav__links { display: flex; gap: 6px; font-size: 15px; }
.nav__links a { padding: 8px 14px; border-radius: 999px; transition: background-color .2s; }

.btn {
  display: inline-block; padding: 14px 26px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
  transition: transform .25s cubic-bezier(.16, 1, .3, 1);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(.97); }

.hero { position: relative; overflow: hidden; display: flex; align-items: center; }
.hero__copy { position: relative; z-index: 3; width: min(100%, 780px); }
.hero h1 { font-size: clamp(52px, 9vw, 150px); white-space: nowrap; }
.hero p { margin: 22px 0 30px; font-size: 20px; color: var(--muted); }
.rings { display: none; }

/* Floating tiles: position comes from --x/--y (desktop) and --mx/--my (phone), set in site.js */
.tiles { position: absolute; inset: 0; z-index: 1; }
.tile {
  position: absolute; left: var(--x); top: var(--y); width: var(--w);
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0) rotate(calc(var(--rot) * var(--tilt-amount)));
  animation: float 9s ease-in-out infinite;
  animation-delay: var(--delay);
}
body[data-tiles="s"] { --tile-base: 9vw; }
body[data-tiles="m"], body:not([data-tiles]) { --tile-base: 12vw; }
body[data-tiles="l"] { --tile-base: 15vw; }
.tile--photo { --w: calc(var(--tile-base) * var(--scale)); }
.tile--video { --w: calc(var(--tile-base) * var(--scale) * .78); }
.tile img { width: 100%; height: auto; }
.tile video, .tile .ph { width: 100%; object-fit: cover; }
.tile--video video, .tile--video .ph { aspect-ratio: 9 / 16; }
.tile--photo .ph { aspect-ratio: 4 / 5; }
.tile--video[data-shape="horizontal"] { --w: calc(var(--tile-base) * var(--scale) * 1.55); }
.tile--video[data-shape="horizontal"] video, .tile--video[data-shape="horizontal"] .ph { aspect-ratio: 16 / 9; }
@keyframes float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -12px; }
}

.ph {
  display: grid; place-items: center; text-align: center;
  background: var(--ph-bg); color: var(--muted); font-size: 13px;
}

.panel { position: relative; }
.about { display: grid; grid-template-columns: 1fr 1.4fr; gap: clamp(24px, 5vw, 80px); align-items: center; }
.about__photo img, .about__photo .ph { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.about h2 { font-size: clamp(36px, 5vw, 68px); margin-bottom: 18px; }
.about p, .extra-section p { white-space: pre-line; font-size: 18px; max-width: 58ch; }
.about p { color: var(--muted); }

.extra { display: grid; }
.extra-section h2 { font-size: clamp(32px, 4.5vw, 60px); margin-bottom: 16px; }
.extra-section p { color: var(--muted); }

.work__title { font-size: clamp(40px, 7vw, 104px); margin-bottom: 40px; }
.work__grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 22px; grid-auto-flow: dense; align-items: start; }
.work-item--video { grid-column: span 3; }
.work-item--photo { grid-column: span 6; }
.work-item .media { overflow: hidden; }
.work-item--video .media video, .work-item--video .media iframe, .work-item--video .ph { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border: 0; background: #000; }
.work-item--video .ph { background: var(--ph-bg); }
.work-item--photo .media img { width: 100%; height: auto; }
.work-item--photo .ph { aspect-ratio: 4 / 3; }
.work-item--video[data-shape="horizontal"] { grid-column: span 6; }
.work-item--video[data-shape="horizontal"] .media video,
.work-item--video[data-shape="horizontal"] .media iframe,
.work-item--video[data-shape="horizontal"] .ph { aspect-ratio: 16 / 9; }
.work-item h3 { font-size: 18px; margin-top: 12px; letter-spacing: -0.01em; }
.work-item h3:empty { display: none; }

.contact h2 { font-size: clamp(44px, 8vw, 128px); }
.contact__mail { display: inline-block; margin-top: 28px; font-size: clamp(20px, 3vw, 34px); border-bottom: 2px solid var(--accent); }
.contact__social { margin-top: 22px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 22px; }
.contact__social a:hover { color: var(--fg); text-decoration: underline; }
.contact__mail[hidden], .contact__social:empty { display: none; }
.foot { padding: 28px var(--gutter) 110px; color: var(--muted); font-size: 14px; }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s cubic-bezier(.16, 1, .3, 1), transform .8s cubic-bezier(.16, 1, .3, 1); }
.reveal.in { opacity: 1; transform: none; }

body.is-loading main, body.is-loading .nav, body.is-loading .foot { opacity: 0; }
main, .nav, .foot { transition: opacity .3s; }

/* ---------- Reference 1: Y2K desktop ---------- */
.theme-desktop {
  --bg: #b4b4b1;
  --fg: #141416;
  --muted: #4d4d52;
  --panel: rgba(250, 250, 248, .86);
  --ph-bg: linear-gradient(140deg, #ececea, #cfcfcc);
  --display: var(--sans); --display-weight: 650; --display-style: normal;
  --tilt-amount: .35;
  background: radial-gradient(120% 90% at 25% 15%, #e6e6e3 0%, #b9b9b6 55%, #a2a29f 100%) fixed;
}
/* Fine vertical stripes, like the reference's screen texture */
.theme-desktop::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .09) 0 2px, transparent 2px 6px);
}
.theme-desktop main, .theme-desktop .foot { position: relative; z-index: 1; }
.theme-desktop .nav { background: transparent; pointer-events: none; }
.theme-desktop .nav__brand, .theme-desktop .nav__links { pointer-events: auto; }
.theme-desktop .nav__brand {
  padding: 7px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .62); backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .8);
}
/* Nav links become a dock at the bottom of the screen */
.theme-desktop .nav__links {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  padding: 8px; gap: 6px; border-radius: 20px;
  background: rgba(255, 255, 255, .62); backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 12px 40px rgba(40, 40, 50, .22);
}
.theme-desktop .nav__links a { border-radius: 12px; font-weight: 500; }
.theme-desktop .nav__links a:hover { background: var(--accent); color: var(--accent-ink); }

.theme-desktop .hero { min-height: 100dvh; padding: 96px var(--gutter) 110px; }
.theme-desktop .tile {
  background: #fff; padding: 5px; border-radius: 6px;
  box-shadow: 0 18px 44px rgba(30, 30, 40, .28);
}
.theme-desktop .tile > * { border-radius: 3px; }

/* Panels are app windows with a title bar */
.theme-desktop .panel, .theme-desktop .extra-section {
  margin: 0 var(--gutter) 40px; padding: 72px clamp(20px, 4vw, 64px) clamp(32px, 5vw, 72px);
  background: var(--panel); border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 24px 60px rgba(30, 30, 40, .18);
  backdrop-filter: blur(10px);
}
.theme-desktop .panel::before, .theme-desktop .extra-section::before {
  content: attr(data-title); position: absolute; inset: 0 0 auto 0; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--muted);
  border-bottom: 1px solid rgba(20, 20, 22, .08);
  background:
    radial-gradient(circle 6px at 22px 50%, #ff5f57 98%, transparent) no-repeat,
    radial-gradient(circle 6px at 42px 50%, #febc2e 98%, transparent) no-repeat,
    radial-gradient(circle 6px at 62px 50%, #28c840 98%, transparent) no-repeat,
    linear-gradient(#f7f7f5, #ebebe8);
  border-radius: 14px 14px 0 0;
}
.theme-desktop .extra { gap: 0; }
.theme-desktop .about__photo > *, .theme-desktop .work-item .media { border-radius: 8px; }

/* ---------- Reference 2: notebook ---------- */
.theme-notebook {
  --bg: #5a1620;
  --paper: #f3ece2;
  --fg: #3d0f15;
  --muted: #74504c;
  --ph-bg: linear-gradient(150deg, #e7dccd, #d6c4b1);
  --display: var(--serif); --display-weight: 400; --display-style: italic;
  --tilt-amount: 1;
  background: var(--bg);
}
.theme-notebook .nav { color: var(--paper); background: var(--bg); }
.theme-notebook .nav__links a:hover { background: rgba(243, 236, 226, .14); }

/* Hero is a notebook page with spiral rings along the top */
.theme-notebook .hero {
  min-height: calc(100dvh - 96px); margin: 80px var(--gutter) 40px;
  padding: 90px clamp(20px, 5vw, 80px) 56px;
  background: var(--paper); border-radius: 10px; overflow: visible;
}
.theme-notebook .hero .tiles { overflow: hidden; border-radius: 10px; }
.theme-notebook .rings {
  display: block; position: absolute; z-index: 4; left: 4%; right: 4%; top: -26px; height: 60px;
  background:
    radial-gradient(ellipse 7px 26px at 50% 50%, transparent 4px, #6e6e6e 5px, #e9e9e9 7px, #8c8c8c 8px, transparent 9px) 0 0 / 56px 60px repeat-x;
}
.theme-notebook .hero h1 { color: var(--fg); }
.theme-notebook .tile {
  background: #fbf7f0; padding: 8px 8px 30px;
  box-shadow: 0 14px 34px rgba(60, 15, 20, .25);
}

.theme-notebook .panel, .theme-notebook .extra-section {
  margin: 0 var(--gutter) 40px; padding: clamp(36px, 6vw, 96px) clamp(20px, 5vw, 80px);
  background: var(--paper); border-radius: 10px;
}
/* About reads like the maroon "About me" page in the reference */
.theme-notebook .about { background: #7a1f2a; color: var(--paper); --muted: #e9d6cb; }
.theme-notebook .about__photo > * { border: 10px solid var(--paper); box-shadow: 0 14px 34px rgba(0, 0, 0, .3); rotate: -2deg; }
.theme-notebook .extra { gap: 0; }
.theme-notebook .work-item .media { border: 8px solid #fbf7f0; box-shadow: 0 10px 26px rgba(60, 15, 20, .18); }
.theme-notebook .work-item:nth-child(odd) .media { rotate: -1deg; }
.theme-notebook .work-item:nth-child(even) .media { rotate: 1deg; }
.theme-notebook .contact { background: #7a1f2a; color: var(--paper); --muted: #e9d6cb; }
.theme-notebook .contact__mail { border-color: var(--paper); }
.theme-notebook .foot { color: #e9d6cb; padding-bottom: 32px; }

/* ---------- Phone ---------- */
@media (max-width: 767px) {
  .tile { left: var(--mx); top: var(--my); }
  .tile:nth-child(n + 6) { display: none; }
  body[data-tiles] { --tile-base: 22vw; }
  .hero { align-items: flex-end; }
  .theme-desktop .hero { padding-bottom: 120px; }
  .about { grid-template-columns: 1fr; }
  .work__grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .work-item--video { grid-column: span 1; }
  .work-item--photo, .work-item--video[data-shape="horizontal"] { grid-column: span 2; }
  .theme-desktop .nav__brand { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tile { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
