/* ─────────────────────────────────────────
   Reset & Base
───────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg:         #f8f8f6;
  --text:       #111111;
  --muted:      #888888;
  --border:     #e0e0de;
  --pad:        clamp(24px, 5vw, 80px);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* ─────────────────────────────────────────
   Splash
───────────────────────────────────────── */
.splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  pointer-events: auto;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
}

/* Wrapper gives the idle thumb an anchor to position against */
.splash-logo-wrap {
  position: relative;
  display: inline-block;
  width: clamp(280px, 42vw, 680px);
}

.splash-logo {
  display: block;
  width: 100%;
  height: auto;
}

/* Idle thumbnail — fades in through the letter mask after 6 s of inactivity */
.splash-idle-thumb {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  mask-image: url('download.png');
  -webkit-mask-image: url('download.png');
  mask-size: 100% 100%;
  -webkit-mask-size: 100% 100%;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.9s ease;
  pointer-events: none;
}

.splash-tagline {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(0.9rem, 1.4vw, 1.2rem);
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: center;
  transition: opacity 0.35s ease;
}

/* ─────────────────────────────────────────
   Portfolio Layout — two-column grid
───────────────────────────────────────── */
.portfolio-layout {
  display: grid;
  grid-template-columns: 45fr 55fr;
  min-height: 100vh;
}

/* ─────────────────────────────────────────
   Logo Panel — sticky left column
───────────────────────────────────────── */
.logo-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad) clamp(8px, 1vw, 20px);
}

/* Container sized by the invisible img */
.logo-reveal {
  position: relative;
  width: clamp(240px, 93%, 640px);
  opacity: 0;
  transition: opacity 0.45s ease;
}

.logo-reveal.is-visible {
  opacity: 1;
}

/* Invisible sizer: establishes natural PNG aspect ratio */
.logo-sizer {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  pointer-events: none;
  user-select: none;
}

/* Thumbnail layers — masked to show only through letter shapes */
.logo-thumb {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  mask-image: url('download.png');
  -webkit-mask-image: url('download.png');
  mask-size: 100% 100%;
  -webkit-mask-size: 100% 100%;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  transition: opacity 0.5s ease;
}

.logo-thumb--b {
  opacity: 0;
}

/* Film grain overlay — sits above thumbnails, masked to letter shapes */
.logo-reveal::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 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='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  mask-image: url('download.png');
  -webkit-mask-image: url('download.png');
  mask-size: 100% 100%;
  -webkit-mask-size: 100% 100%;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  opacity: 0.30;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 1;
}

/* ─────────────────────────────────────────
   Project List — scrolling right column
───────────────────────────────────────── */
.project-list {
  border-left: 1px solid var(--border);
  padding: 3rem var(--pad) 120px;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.project-list.is-visible {
  opacity: 1;
}

.project {
  border-bottom: 1px solid var(--border);
}

.project--break {
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.project a {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.1rem 0;
  color: inherit;
  text-decoration: none;
  transition: opacity 0.4s ease;
}

.project:not(.is-active) a {
  opacity: 0.28;
}

.project.is-active a {
  opacity: 1;
}

.project-num {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  flex-shrink: 0;
  min-width: 2ch;
}

.project-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.3rem, 3vw, 2.2rem);
  font-weight: 400;
  line-height: 1.15;
}

.project--featured a {
  opacity: 1 !important;
}


/* ─────────────────────────────────────────
   Section Header
───────────────────────────────────────── */
.section-header {
  padding: 2rem var(--pad) 2.5rem;
  border-top: 1px solid var(--border);
}

.section-label {
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─────────────────────────────────────────
   About View — full-screen fixed overlay
───────────────────────────────────────── */
.about-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 55fr 45fr; /* mirrored: about left, logo space right */
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
}

.about-col {
  border-right: 1px solid var(--border);
  padding: 3rem var(--pad) 4rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE / Edge */
}

.about-col::-webkit-scrollbar {
  display: none;                /* Chrome / Safari / Opera */
}

/* No top border on the opening About header */
.about-first-header {
  border-top: none;
  padding-top: 0;
}

.about-logo-col {
  /* Empty placeholder — logo panel slides here during transition */
}

.about-content {
  padding: 0 var(--pad);
}

.about-intro {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.35rem, 2.8vw, 2rem);
  font-weight: 300;
  line-height: 1.4;
  margin-bottom: 1.75rem;
}

.about-body {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.85;
  max-width: 52ch;
  margin-top: 1.25rem;
}

.about-year {
  display: block;
  color: var(--text);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.3;
}

.about-role {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.about-contact {
  padding: 2rem var(--pad) 0;
}

.about-footer {
  margin-top: auto;
  padding-top: 3rem;
}

/* ─────────────────────────────────────────
   Contact
───────────────────────────────────────── */
.contact-content {
  padding: 0 var(--pad);
}

.contact-email {
  display: inline-block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(2rem, 7vw, 6rem);
  font-weight: 300;
  line-height: 1.1;
  margin-bottom: 3rem;
  position: relative;
}

.contact-email::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--text);
  transition: width 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.contact-email:hover::after {
  width: 100%;
}

.contact-links {
  display: flex;
  gap: 2.5rem;
}

.contact-link {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  position: relative;
  transition: color 0.2s;
}

.contact-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--text);
  transition: width 0.3s ease;
}

.contact-link:hover {
  color: var(--text);
}

.contact-link:hover::after {
  width: 100%;
}

/* ─────────────────────────────────────────
   Footer
───────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: space-between;
  padding: 1.75rem var(--pad);
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ─────────────────────────────────────────
   Reveal Animation
───────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─────────────────────────────────────────
   Responsive
───────────────────────────────────────── */
@media (max-width: 768px) {
  .portfolio-layout {
    grid-template-columns: 1fr;
  }

  .logo-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    z-index: 50;
    background: var(--bg);
    padding: 2rem var(--pad) 1.5rem;
    border-bottom: 1px solid var(--border);
  }

  .project-list {
    border-left: none;
    border-top: none;
    /* padding-top set dynamically by JS to match logo panel height */
  }

  #mobileThumbOverlay {
    display: none;
  }

  /* About view: logo sits at top, content scrolls below */
  .about-view {
    grid-template-columns: 1fr;
  }

  .about-logo-col {
    display: none;
  }

  .about-col {
    border-right: none;
  }

  /* End view: scale logo and icons for small screens */
  .end-logo {
    width: clamp(200px, 72vw, 420px);
  }

  .end-icon {
    width: clamp(44px, 10vw, 64px);
    height: clamp(44px, 10vw, 64px);
  }
}

@media (max-width: 600px) {
  .contact-links {
    flex-direction: column;
    gap: 1rem;
  }

  /* About view: keep contact links in a row along the bottom */
  .about-col .contact-links {
    flex-direction: row;
    justify-content: space-between;
    gap: 0;
  }

  .footer {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* ─────────────────────────────────────────
   End view — full-bleed closing section
───────────────────────────────────────── */
.end-view {
  position: fixed;
  inset: 0;
  z-index: 160;
  background-size: cover;
  background-position: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.end-view.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.end-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
  z-index: 1;
}

.end-logo {
  width: clamp(240px, 45vw, 560px);
  height: auto;
  filter: invert(1);
}

.end-icons {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.end-icon-link {
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.end-icon-link:hover {
  opacity: 1;
}

.end-icon {
  width: clamp(56px, 6vw, 80px);
  height: clamp(56px, 6vw, 80px);
  object-fit: contain;
  display: block;
}

.end-icon--invert {
  filter: invert(1);
}

/* Film grain on end view */
.end-view::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 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='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: 0.30;
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* ─────────────────────────────────────────
   Full-bleed thumbnail (project click)
───────────────────────────────────────── */
.full-bleed {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-panel.is-expanded .full-bleed {
  opacity: 1;
  pointer-events: auto;
}

/* Film grain on full-bleed project preview */
.full-bleed::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 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='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: 0.30;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.logo-panel.is-expanded .logo-reveal {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.view-project-btn {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  font-weight: 400;
  color: white;
  text-decoration: none;
  text-shadow: 0 1px 12px rgba(0,0,0,0.5);
  position: relative;
  transition: opacity 0.2s ease;
}

.view-project-btn::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 1px;
  background: white;
  transition: width 0.3s ease;
}

.view-project-btn:hover::after {
  width: 100%;
}

/* ─────────────────────────────────────────
   Full Bio link in about-view
───────────────────────────────────────── */
.about-bio-link {
  display: block;
  padding: 2rem var(--pad) 1.5rem;
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  opacity: 0.28;
  transition: opacity 0.3s ease;
}

.about-bio-link:hover {
  opacity: 1;
}

/* ─────────────────────────────────────────
   Mobile full-thumb overlay (first tap preview)
───────────────────────────────────────── */
#mobileThumbOverlay {
  display: none;
}

@media (max-width: 768px) {
  #mobileThumbOverlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background-size: cover;
    background-position: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
  }

  #mobileThumbOverlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 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='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    opacity: 0.30;
    mix-blend-mode: overlay;
    pointer-events: none;
  }

  #mobileThumbOverlay.is-visible {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .logo-thumb {
    transition: none;
  }
}
