/* ─── Berry Sullivan Portfolio v2 — Hybrid Design System ─── */
/* Combines: bold Inter 900 headlines (prototype 2) + Newsreader editorial (prototype 1) */
/* Dark-first palette with tonal layering */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,wght@0,300;0,400;1,300;1,400&family=Inter:wght@300;400;500;600;800;900&display=swap');

:root {
  /* Near-white main bg, muted sage-grey surface tones */
  --bg: #f7f6f3;             /* near-white, almost no cast */
  --bg-surface: #ecede8;     /* muted sage-grey for sections/cards */
  --bg-elevated: #ffffff;    /* pure white for elevated cards */
  --bg-hover: #e3e5df;       /* sage hover */
  --text-primary: #151d22;
  --text-secondary: #5b5e66;
  --text-muted: #8a8d95;
  --primary: #006b5b;
  --primary-dim: #004d3f;
  --primary-glow: rgba(0, 107, 91, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-accent: rgba(0, 107, 91, 0.3);
  --overlay: rgba(247, 246, 243, 0.88);
  --btn-primary-text: #ffffff;
  --nav-hover: var(--primary);
}

html.dark {
  --bg: #0f1419;
  --bg-surface: #1a2129;
  --bg-elevated: #1f2830;
  --bg-hover: #253038;
  --text-primary: #e4e9f0;
  --text-secondary: #a3a7b0;
  --text-muted: #6b7a76;
  --primary: #4fdcc1;
  --primary-dim: #004d3f;
  --primary-glow: rgba(79, 220, 193, 0.12);
  --border-subtle: rgba(74, 90, 86, 0.25);
  --border-accent: rgba(79, 220, 193, 0.3);
  --overlay: rgba(15, 20, 25, 0.85);
  --btn-primary-text: #0f1419;
  --nav-hover: var(--text-primary);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg);
  transition: background-color 0.4s ease, color 0.4s ease;
}

::selection {
  background: var(--primary);
  color: #fff;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }

/* ─── Noise texture ─── */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ─── Navigation — dark, sans-serif from prototype 2 ─── */
.site-nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  padding: 1.25rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--overlay);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.4s ease;
}

.site-nav .wordmark {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.site-nav .nav-links {
  display: flex;
  gap: 2.5rem;
  align-items: center;
}
.site-nav .nav-links a {
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  transition: color 0.3s;
  position: relative;
}
.site-nav .nav-links a:hover { color: var(--nav-hover); }
.site-nav .nav-links a.active { color: var(--primary); }
.site-nav .nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.3s;
}
.theme-toggle:hover { color: var(--text-primary); }

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  padding: 4px;
}

/* Mobile nav */
.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.mobile-nav.open { display: flex; opacity: 1; }
.mobile-nav a {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  transition: color 0.3s;
}
.mobile-nav a:hover { color: var(--primary); }
.mobile-nav a.active { color: var(--primary); }
.mobile-nav .close-btn {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .site-nav .nav-links { display: none; }
  .hamburger { display: flex; }
}

/* ─── Layout ─── */
.page-content {
  position: relative;
  z-index: 1;
  padding-top: 5rem;
}

.container {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 2.5rem;
}

.section { padding: 6rem 0; }
.section-surface { background: var(--bg-surface); }
.section-elevated { background: var(--bg-elevated); }

/* ─── Typography — Hybrid: Inter 900 for headlines, Newsreader for editorial ─── */

/* BOLD Inter headlines — the striking quality from prototype 2 */
.display-xl {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: clamp(4rem, 10vw, 8rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}

.display-lg {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.headline-bold {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

/* DELICATE Newsreader — editorial accent from prototype 1 */
.headline-editorial {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.3;
  color: var(--text-primary);
}

.accent-serif {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-weight: 300;
}

.headline-md {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-size: 1.75rem;
}

.headline-lg {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(2rem, 4vw, 3.5rem);
}

/* Labels — ultra-tracked uppercase from prototype 2 */
.label-sm {
  font-family: 'Inter', sans-serif;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--text-muted);
}

.label-xs {
  font-family: 'Inter', sans-serif;
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--text-muted);
}

.label-accent {
  font-family: 'Inter', sans-serif;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--primary);
}

/* ─── Components ─── */

/* Image — greyscale-to-colour with high contrast */
.art-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.1);
  transition: filter 0.7s ease-in-out, transform 0.7s ease;
}
.art-image:hover,
.art-image-container:hover .art-image {
  filter: grayscale(0%) contrast(1);
  transform: scale(1.02);
}
.art-image-container {
  overflow: hidden;
  background: var(--bg-surface);
}

/* Caption */
.figure-caption {
  margin-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 0.25rem;
}

/* Cards — backdrop blur from prototype 2 */
.card {
  background: var(--bg-surface);
  padding: 2rem;
  transition: background 0.3s ease, transform 0.3s ease;
  border: 1px solid var(--border-subtle);
}
.card:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
}

/* Buttons */
.btn-primary {
  display: inline-block;
  background: var(--primary);
  color: var(--btn-primary-text);
  padding: 0.875rem 2.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  border: none;
  cursor: pointer;
  transition: opacity 0.3s, transform 0.2s;
}
.btn-primary:hover { opacity: 0.85; transform: translateY(-1px); }

.btn-ghost {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 2px;
  transition: color 0.3s, border-color 0.3s;
}
.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

/* Accent border */
.accent-left {
  border-left: 2px solid var(--primary);
  padding-left: 2rem;
}

/* Divider line */
.divider {
  width: 3rem;
  height: 2px;
  background: var(--primary);
  margin-top: 0.75rem;
}

/* Grid helpers */
.grid-bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
@media (max-width: 768px) {
  .grid-bento { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ─── Fade-in ─── */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
.stagger > .fade-in:nth-child(1) { transition-delay: 0s; }
.stagger > .fade-in:nth-child(2) { transition-delay: 0.12s; }
.stagger > .fade-in:nth-child(3) { transition-delay: 0.24s; }
.stagger > .fade-in:nth-child(4) { transition-delay: 0.36s; }
.stagger > .fade-in:nth-child(5) { transition-delay: 0.48s; }

/* ─── Hero section — dark, dramatic ─── */
.hero-section {
  padding: 8rem 0 10rem;
  position: relative;
}
.hero-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-accent), transparent);
}

/* Discipline list — serif italics */
.discipline-list {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-size: 1.25rem;
  line-height: 2.2;
  color: var(--text-secondary);
}

/* ─── Writing cards ─── */
.writing-card {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border-subtle);
  transition: background 0.3s;
}
.writing-card:hover {
  background: var(--bg-surface);
  margin: 0 -1.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ─── Timeline ─── */
.timeline {
  position: relative;
  padding-left: 3rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-subtle);
}
.timeline-node {
  position: relative;
  padding-bottom: 5rem;
}
.timeline-node::before {
  content: '';
  position: absolute;
  left: -3rem;
  top: 0.5rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: var(--bg-elevated);
}

@media (max-width: 768px) {
  .timeline { padding-left: 1.5rem; }
  .timeline-node::before { left: -1.5rem; }
}

/* ─── Case study cards ─── */
.case-card {
  border-top: 1px solid var(--border-subtle);
  padding-top: 2rem;
}
.case-meta {
  font-family: 'Inter', sans-serif;
  font-size: 0.6875rem;
  color: var(--text-secondary);
}
.case-meta .row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

/* ─── Footer — dark blue with subtle noise ─── */
.site-footer {
  background: #0f1419;
  padding: 4rem 2.5rem;
  border-top: none;
  position: relative;
  overflow: hidden;
}

/* Grain — two layers for density and character */
.site-footer::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.site-footer::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 300 300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n2'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.35' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n2)'/%3E%3C/svg%3E");
}

.footer-inner {
  max-width: 80rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
  position: relative;
  z-index: 1;
}

/* Newsreader italic wordmark — handmade, brushstroke feel */
.footer-wordmark {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-weight: 300;
  font-size: 1.375rem;
  color: rgba(242, 235, 218, 0.9);
  letter-spacing: -0.01em;
}

.footer-links {
  display: flex;
  gap: 2.5rem;
}
.footer-links a {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(242, 235, 218, 0.45);
  transition: color 0.3s;
}
.footer-links a:hover { color: var(--primary); }
.footer-copy {
  font-size: 0.6875rem;
  color: rgba(242, 235, 218, 0.3);
}


/* ─── Tooltips ─── */
.tooltip {
  position: relative;
  border-bottom: 1px dotted var(--text-secondary);
  cursor: help;
}
.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 0.625rem 0.875rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  line-height: 1.6;
  width: max-content;
  max-width: 280px;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
}
.tooltip:hover::after,
.tooltip:focus::after {
  opacity: 1;
}
/* ─── Responsive ─── */
@media (max-width: 768px) {
  .container { padding: 0 1.25rem; }
  .section { padding: 4rem 0; }
  .hero-section { padding: 6rem 0 7rem; }
  .site-nav { padding: 1.25rem 1.5rem; }
}
