/* ──────────────────────────────────────────────
   Midnight Fig & Antique Copper — design tokens
────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:              #18141C;   /* Void */
  --surface:         #231D28;   /* Fig */
  --surface-alt:     #332840;   /* Dusk */
  --surface-accent:  #3A2C22;   /* Copper Dark — featured sections */

  /* Text */
  --text:            #EEE4EC;   /* Mauve Pale — primary headings */
  --text-sub:        #C9B4C0;   /* Mauve Light — subheadings, captions */
  --text-muted:      #A08898;   /* Mauve Mid — body text, labels */
  --text-copper:     #F0D8B8;   /* Copper Pale — text on copper surfaces */

  /* Accent — Antique Copper */
  --accent:          #B87848;   /* Copper — CTAs, links, highlights */
  --accent-light:    #D4A878;   /* Copper Light — hover, secondary accent */
  --accent-dark:     #7A4E30;   /* Copper Mid-Dark — accent borders */

  /* Borders — always 0.5px */
  --border:          #332840;   /* Dusk — default */
  --border-accent:   #7A4E30;   /* Copper Mid-Dark — featured */

  --max-w: 960px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text-muted);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.95rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Urbanist', sans-serif;
}

.heading-accent {
  color: var(--accent-light);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-light); text-decoration: none; }

img { display: block; max-width: 100%; }

/* ──────────────────────────────────────────────
   Locked layout — no scrolling, fills viewport
────────────────────────────────────────────── */
body.locked {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Hero fills remaining space; content starts well below nav */
body.locked .hero {
  flex: 1;
  align-items: flex-start;
  padding-top: 25vh;
}

/* Projects section fills remaining space; grid starts below nav */
body.locked .projects {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 26vh 2rem 2rem;
}

/* ──────────────────────────────────────────────
   Unified site nav — fixed, centered at top
────────────────────────────────────────────── */
.site-nav {
  position: fixed;
  top: 13vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2rem;
  align-items: center;
  z-index: 100;
  transition: top 0.3s ease;
}

.site-nav.nav-hidden { top: -5rem !important; }

.site-nav a {
  position: relative;
  color: var(--accent-light);
  font-size: 0.875rem;
  padding-bottom: 3px;
  transition: color 0.2s;
  white-space: nowrap;
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent-light);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.25s ease;
}

.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a:hover::after { transform: scaleX(1); }

.nav-active { color: var(--text) !important; }
.nav-active::after { transform: scaleX(1) !important; }

/* Home icon link — color-only highlight, no underline */
.site-nav .nav-home {
  display: flex;
  align-items: center;
  padding-bottom: 0;
  color: var(--text-muted);
}

.site-nav .nav-home::after { display: none; }

.site-nav .nav-home:hover { color: var(--text-sub); }

.site-nav .nav-home.nav-active { color: var(--accent-light) !important; }

/* ──────────────────────────────────────────────
   Hero
────────────────────────────────────────────── */
.hero {
  display: flex;
  gap: 4rem;
  padding: 0 3rem;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

.hero-photo { flex-shrink: 0; }

.hero-photo img {
  width: 300px;
  height: 300px;
  border-radius: 16px;
  object-fit: cover;
  object-position: center top;
  border: 0.5px solid var(--border-accent);
}

.hero-text { flex: 1; }

.hero-text h1 {
  font-size: 3.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
  line-height: 1.05;
  color: var(--text);
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-sub);
  margin-bottom: 1.4rem;
}

.hero-bio {
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1.75;
  margin-bottom: 2rem;
  max-width: 520px;
}

.hero-cta {
  display: flex;
  gap: 1.5rem;
  font-size: 1.05rem;
}

.hero-cta a { color: var(--accent); transition: color 0.15s; }
.hero-cta a:hover { color: var(--accent-light); }

/* ──────────────────────────────────────────────
   Projects — Instagram-style tile grid
────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 680px;
  width: 100%;
}

.tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface);
  border-radius: 14px;
}

.tile-front {
  position: absolute;
  inset: 0;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: opacity 0.3s ease;
}

.tile-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-light);
  background: var(--surface-alt);
  padding: 0.2em 0.55em;
  border-radius: 3px;
}

.tile-name {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.02em;
}

.tile-org {
  font-size: 0.62rem;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.75;
  margin-top: 0.2rem;
}

.tile-back {
  position: absolute;
  inset: 0;
  padding: 1.25rem;
  background: var(--surface-accent);
  border: 0.5px solid var(--border-accent);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tile-desc {
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-copper);
}

.tile-stat {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-light);
}

.tile:hover .tile-front { opacity: 0; }
.tile:hover .tile-back  { opacity: 1; transform: translateY(0); }

/* ──────────────────────────────────────────────
   Content pages (Patents, Publications)
────────────────────────────────────────────── */
.content-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 26vh 3rem 3rem;
  width: 100%;
}

/* Placeholder state */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1;
  padding-bottom: 10vh;
  text-align: center;
}

.placeholder h2 {
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}

.placeholder-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-light);
}

/* Scrollable content variant */
.content-page.scrollable {
  overflow-y: auto;
}

/* Publication list */
.pub-list {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
}

.pub-entry {
  padding: 1.25rem 0;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pub-entry:first-child { padding-top: 0; }

.pub-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.pub-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  letter-spacing: -0.01em;
  flex: 1;
}

.pub-venue {
  font-size: 0.78rem;
  color: var(--accent-light);
  font-weight: 500;
}

.pub-authors {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.pub-authors strong {
  color: var(--text-sub);
  font-weight: 500;
}

.pub-list-footer {
  padding-top: 1.25rem;
  padding-bottom: 2rem;
}

.pub-list-footer a {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  transition: color 0.15s;
}

.pub-list-footer a:hover { color: var(--accent-light); }

/* Patent entry card */
.patent-entry {
  width: 100%;
  max-width: 680px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  padding: 2rem 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.patent-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 0.25em 0.6em;
  border-radius: 4px;
}

.badge-accent {
  color: var(--accent-light);
  background: var(--surface-accent);
}

.patent-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text);
}

.patent-desc {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.patent-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.5rem;
  border-top: 0.5px solid var(--border);
  flex-wrap: wrap;
}

.patent-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.patent-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  transition: color 0.15s;
  white-space: nowrap;
}

.patent-link:hover { color: var(--accent-light); }

/* ──────────────────────────────────────────────
   Responsive
────────────────────────────────────────────── */
@media (max-width: 680px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 5rem 1.5rem 2rem;
  }

  /* Fix specificity: override body.locked .hero padding-top for mobile */
  body.locked .hero { padding-top: 5rem; }

  .hero-photo img { width: 180px; height: 180px; }
  .hero-bio { max-width: 100%; }

  /* Projects: unlock scroll, reset padding */
  body.locked { height: auto; overflow: auto; }
  body.locked .projects { padding: 5rem 1.5rem 2rem; }

  /* Content pages: reduce top padding on mobile */
  .content-page { padding: 5rem 1.5rem 2rem; }

  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
    max-width: 460px;
    gap: 8px;
  }

  /* Tiles: stack front + back instead of hover-flip */
  .tile { aspect-ratio: auto; }

  .tile-front,
  .tile-back {
    position: relative;
    inset: auto;
    transition: none;
  }

  .tile-front {
    padding: 0.9rem 1rem 0.6rem;
    justify-content: flex-start;
    gap: 0.5rem;
    opacity: 1 !important;
  }

  .tile-back {
    border-radius: 0 0 14px 14px;
    padding: 0.6rem 1rem 0.9rem;
    opacity: 1 !important;
    transform: none !important;
    gap: 0.4rem;
  }

  .tile:hover .tile-front { opacity: 1; }
  .tile:hover .tile-back  { opacity: 1; transform: none; }

  .site-nav { gap: 1.5rem; top: 1.5rem; }
}

@media (max-width: 420px) {
  .projects-grid { grid-template-columns: 1fr; max-width: 320px; }
  .site-nav { gap: 1rem; }
  .site-nav a { font-size: 0.8rem; }
}

/* Short screens: landscape phones and small browser windows */
@media (max-height: 500px) {
  .site-nav { top: 1rem; }
  body.locked .hero { padding-top: 3.5rem; }
  body.locked .projects { padding-top: 3.5rem; }
  .content-page { padding-top: 3.5rem; }
}
