/**
 * ============================================
 * SARAH EMILY BROWN PORTFOLIO
 * Main Stylesheet
 * ============================================
 * 
 * Design: Minimalist Academic Portfolio
 * Inspiration: danielfountain.com
 * 
 * Architecture:
 * 1. CSS Custom Properties (Variables)
 * 2. Reset & Base Styles
 * 3. Typography
 * 4. Layout Components
 * 5. Navigation
 * 6. Hero Section
 * 7. Content Sections
 * 8. Footer
 * 9. Utilities
 * 10. Media Queries
 */

/* ============================================
   1. CSS CUSTOM PROPERTIES
   ============================================ */

:root {
  /* Colors */
  --color-primary: #000000;
  --color-secondary: #333333;
  --color-text: #1a1a1a;
  --color-text-light: #666666;
  --color-background: #ffffff;
  --color-background-alt: #fafafa;
  --color-border: #e5e5e5;
  --color-accent: #000000;
  
  /* Typography - Font Families */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
  
  /* Typography - Font Sizes (using fluid typography) */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
  --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.625vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.25rem + 1.25vw, 2rem);
  --text-3xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);
  --text-4xl: clamp(2.5rem, 1.75rem + 3.75vw, 4.5rem);
  
  /* Typography - Line Heights */
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;
  
  /* Typography - Font Weights */
  --weight-light: 300;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  
  /* Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;
  --space-5xl: 8rem;
  
  /* Layout */
  --max-width: 1200px;
  --max-width-narrow: 800px;
  --max-width-content: 65ch;
  --column-gap: clamp(2rem, 4vw, 4rem);
  --section-padding: clamp(4rem, 8vw, 8rem);
  --header-height: 80px;
  
  /* Breakpoints (for reference - can't use in media queries directly) */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  
  /* Border Radius */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;
}

/* ============================================
   2. RESET & BASE STYLES
   ============================================ */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  min-height: 100vh;
}

/* Prevent content shift when nav is open */
body.nav-open {
  overflow: hidden;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-secondary);
}

ul,
ol {
  list-style-position: inside;
}

/* ============================================
   3. TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  color: var(--color-primary);
}

h1 {
  font-size: var(--text-4xl);
  font-weight: var(--weight-light);
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-normal);
  margin-bottom: var(--space-lg);
}

h3 {
  font-size: var(--text-xl);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-md);
}

h4 {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
}

p {
  margin-bottom: var(--space-md);
  max-width: var(--max-width-content);
}

p:last-child {
  margin-bottom: 0;
}

strong {
  font-weight: var(--weight-semibold);
}

em {
  font-style: italic;
}

blockquote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--text-lg);
  padding-left: var(--space-xl);
  border-left: 2px solid var(--color-border);
  margin: var(--space-xl) 0;
  color: var(--color-text-light);
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-2xl) 0;
}

/* Lists in content */
.section-text ul,
.section-text ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
  list-style-position: outside;
}

.section-text li {
  margin-bottom: var(--space-sm);
  max-width: var(--max-width-content);
}

/* ============================================
   4. LAYOUT COMPONENTS
   ============================================ */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.section-container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

/* ============================================
   5. NAVIGATION
   ============================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
  transition: background-color var(--transition-base);
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
  height: 100%;
}

.nav-logo {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  letter-spacing: -0.01em;
  color: var(--color-primary);
}

.nav-logo:hover {
  color: var(--color-secondary);
}

.nav-links {
  display: flex;
  gap: var(--space-xl);
  list-style: none;
}

.nav-link {
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-sm) 0;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--color-primary);
  transition: width var(--transition-base);
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--color-primary);
}

.nav-link:hover::after,
.nav-link.is-active::after {
  width: 100%;
}

/* Mobile Navigation Toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-toggle-bar {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--color-primary);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   6. HERO SECTION
   ============================================ */

.hero-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--header-height) var(--space-xl) var(--space-4xl);
  text-align: center;
  background-color: var(--color-background);
}

.hero-content {
  max-width: var(--max-width-narrow);
}

.hero-title {
  font-size: var(--text-4xl);
  font-weight: var(--weight-light);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-lg);
  line-height: 1.1;
}

.hero-tagline {
  font-size: var(--text-xl);
  font-weight: var(--weight-light);
  color: var(--color-text-light);
  margin-bottom: var(--space-3xl);
  letter-spacing: 0.02em;
}

.hero-cta {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-text-light);
  transition: color var(--transition-base), transform var(--transition-base);
}

.hero-cta:hover {
  color: var(--color-primary);
  transform: translateY(4px);
}

.hero-cta-text {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-cta-arrow {
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(8px);
  }
  60% {
    transform: translateY(4px);
  }
}

/* ============================================
   7. CONTENT SECTIONS
   ============================================ */

.content-section {
  padding: var(--section-padding) 0;
  scroll-margin-top: var(--header-height);
}

.content-section:nth-child(even) {
  background-color: var(--color-background-alt);
}

/* Section Header */
.section-header {
  margin-bottom: var(--space-2xl);
}

.section-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-normal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  width: 2rem;
  height: 1px;
  background-color: var(--color-primary);
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-light);
  margin-top: var(--space-md);
}

/* Two-Column Layout */
.section-content--two-column {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--column-gap);
  align-items: start;
}

@media (min-width: 768px) {
  .section-content--two-column {
    grid-template-columns: 1fr 1fr;
  }
  
  .section-content--two-column.image-right .section-media {
    order: 2;
  }
  
  .section-content--two-column.image-right .section-text {
    order: 1;
  }
}

/* Single-Column Layout */
.section-content--single-column {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
}

/* Section Media */
.section-media {
  position: relative;
}

.section-figure {
  position: relative;
  overflow: hidden;
}

.section-image {
  width: 100%;
  height: auto;
  display: block;
  transition: transform var(--transition-slow);
}

.section-figure:hover .section-image {
  transform: scale(1.02);
}

.section-caption {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  margin-top: var(--space-md);
  font-style: italic;
}

.section-figure--centered {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.section-figure--centered .section-image {
  max-width: 600px;
  margin: 0 auto;
}

/* Section Text */
.section-text {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

.section-text--full {
  grid-column: 1 / -1;
  max-width: var(--max-width-narrow);
}

/* Subsections */
.subsection {
  margin-top: var(--space-3xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--color-border);
}

.subsection:first-child {
  margin-top: var(--space-2xl);
  padding-top: 0;
  border-top: none;
}

.subsection-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-lg);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.subsection-figure {
  margin-top: var(--space-xl);
}

.subsection-figure img {
  max-width: 100%;
  height: auto;
}

.subsections-container {
  margin-top: var(--space-2xl);
}

/* Artwork Section Specific */
.artwork-section .section-text {
  text-align: center;
  max-width: var(--max-width-content);
  margin: 0 auto;
}

/* ============================================
   INLINE CONTENT FIGURES
   For images placed within Markdown content
   ============================================ */

.content-figure {
  margin: var(--space-2xl) 0;
  padding: 0;
}

.content-figure img {
  width: 100%;
  height: auto;
  display: block;
}

.content-figure figcaption {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  margin-top: var(--space-md);
  font-style: italic;
  text-align: left;
}

/* Centered variant for standalone images */
.content-figure--centered {
  text-align: center;
}

.content-figure--centered img {
  max-width: 800px;
  margin: 0 auto;
}

.content-figure--centered figcaption {
  text-align: center;
}

/* Side-by-side images */
.content-figures-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin: var(--space-2xl) 0;
}

@media (min-width: 768px) {
  .content-figures-row {
    grid-template-columns: 1fr 1fr;
  }
}

.content-figures-row .content-figure {
  margin: 0;
}

/* ============================================
   VIDEO EMBEDS (Vimeo/YouTube)
   ============================================ */

.video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  margin: var(--space-lg) 0;
  background: var(--color-background-alt);
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ============================================
   READ MORE LINK
   ============================================ */

.read-more-link {
  display: inline-block;
  margin-top: var(--space-lg);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--color-primary);
  transition: all var(--transition-fast);
}

.read-more-link:hover {
  color: var(--color-secondary);
  border-bottom-color: var(--color-secondary);
}

/* ============================================
   FULL PAGE LAYOUT
   For dedicated content pages
   ============================================ */

.full-page {
  padding-top: calc(var(--header-height) + var(--space-3xl));
  padding-bottom: var(--space-4xl);
  min-height: 100vh;
}

.full-page-container {
  width: 100%;
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.full-page-header {
  margin-bottom: var(--space-3xl);
}

.back-link {
  display: inline-block;
  font-size: var(--text-sm);
  color: var(--color-text-light);
  text-decoration: none;
  margin-bottom: var(--space-lg);
  transition: color var(--transition-fast);
}

.back-link:hover {
  color: var(--color-primary);
}

.full-page-title {
  font-size: var(--text-3xl);
  font-weight: var(--weight-light);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}

.full-page-subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-light);
}

.full-page-hero {
  margin-bottom: var(--space-3xl);
}

.full-page-hero-image {
  width: 100%;
  height: auto;
  display: block;
}

.full-page-hero-caption {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  margin-top: var(--space-md);
  font-style: italic;
}

.full-page-content {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

.full-page-content h2 {
  margin-top: var(--space-3xl);
  margin-bottom: var(--space-lg);
}

.full-page-content h3 {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
}

.full-page-content p {
  margin-bottom: var(--space-md);
}

.full-page-content ul,
.full-page-content ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

.full-page-content li {
  margin-bottom: var(--space-sm);
}

/* ============================================
   CV PAGE STYLES
   ============================================ */

.cv-page .full-page-container {
  max-width: 800px;
}

.cv-content {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

.cv-header-info {
  text-align: left;
  margin-bottom: var(--space-3xl);
  padding-bottom: var(--space-xl);
  border-bottom: 2px solid var(--color-primary);
}

.cv-header-info p {
  margin: 0;
  line-height: 1.4;
}

.cv-header-info .cv-name {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-xs);
}

.cv-header-info .cv-title {
  font-size: var(--text-base);
  color: var(--color-text-light);
  margin-bottom: var(--space-xs);
}

.cv-header-info .cv-email {
  font-size: var(--text-sm);
}

.cv-content h2 {
  font-family: var(--font-primary);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--color-border);
}

.cv-content h2:first-of-type {
  margin-top: var(--space-lg);
}

.cv-content p {
  margin-bottom: var(--space-md);
}

.cv-content p strong {
  display: block;
  font-weight: var(--weight-semibold);
  margin-bottom: 0;
}

.cv-content p em {
  color: var(--color-text-light);
}

.cv-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-xl) 0;
}

.cv-content ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: var(--space-lg);
}

.cv-content li {
  margin-bottom: var(--space-sm);
  padding-left: var(--space-md);
  position: relative;
}

.cv-content li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--color-text-light);
}

.cv-download {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 2px solid var(--color-primary);
  text-align: center;
}

.cv-download a {
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--text-sm);
}

/* ============================================
   8. FOOTER
   ============================================ */

.site-footer {
  padding: var(--space-3xl) var(--space-xl);
  background-color: var(--color-background);
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-content p {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  max-width: none;
}

/* ============================================
   9. UTILITIES
   ============================================ */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center {
  text-align: center;
}

.text-light {
  color: var(--color-text-light);
}

.mt-0 { margin-top: 0; }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

/* ============================================
   10. MEDIA QUERIES
   ============================================ */

/* Tablet and below */
@media (max-width: 1023px) {
  :root {
    --header-height: 70px;
  }
  
  .section-container {
    padding: 0 var(--space-lg);
  }
}

/* Mobile Navigation */
@media (max-width: 767px) {
  :root {
    --header-height: 60px;
  }
  
  .nav-toggle {
    display: flex;
  }
  
  .nav-links {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    background-color: var(--color-background);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: opacity var(--transition-base), 
                visibility var(--transition-base), 
                transform var(--transition-base);
  }
  
  .nav-links.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  
  .nav-link {
    font-size: var(--text-lg);
  }
  
  .main-nav {
    padding: 0 var(--space-lg);
  }
  
  .section-container {
    padding: 0 var(--space-md);
  }
  
  .hero-section {
    padding: var(--header-height) var(--space-md) var(--space-3xl);
  }
  
  .hero-title {
    font-size: var(--text-3xl);
  }
  
  .hero-tagline {
    font-size: var(--text-lg);
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .section-title {
    font-size: var(--text-xl);
  }
  
  .section-content--two-column {
    gap: var(--space-xl);
  }
}

/* Large Screens */
@media (min-width: 1280px) {
  .section-content--two-column {
    grid-template-columns: 2fr 3fr;
  }
  
  .section-content--two-column.image-right {
    grid-template-columns: 3fr 2fr;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Styles */
@media print {
  .site-header,
  .hero-cta,
  .site-footer {
    display: none;
  }
  
  .hero-section {
    min-height: auto;
    padding: var(--space-xl);
  }
  
  .content-section {
    padding: var(--space-xl) 0;
    page-break-inside: avoid;
  }
}
