/*
 * Portfolio — Clear Frame + Editorial Stack
 * Refined minimal, content-first, section rhythm
 */

:root {
  /* Palette: blue primary, yellow accent (sparing), warm neutrals */
  --color-text: #1a1a22;
  --color-text-muted: #5c5c6a;
  --color-bg: #fafaf8;
  --color-bg-elevated: #fff;
  --color-primary: #3076b8;
  --color-primary-hover: #2463a8;
  --color-accent: #c9a227;
  --color-accent-soft: rgba(201, 162, 39, 0.12);
  --color-border: #e8e8e6;
  --color-border-strong: #d0d0ce;

  /* Type */
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;

  /* 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;

  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3rem;

  --line-tight: 1.25;
  --line-normal: 1.5;
  --line-relaxed: 1.65;
  --line-loose: 1.8;

  --measure: 42rem;
  --header-height: 4.5rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-relaxed);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* Subtle atmosphere: very light warm tint + optional grain feel via border */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(250, 249, 246, 0.6) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* ----- Header (sticky, minimal) ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--space-xl);
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(8px);
}

.site-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  margin: 0;
  color: var(--color-text);
}

.site-name:hover {
  color: var(--color-primary);
}

.site-nav {
  display: flex;
  gap: var(--space-xl);
}

.site-nav a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
}

.site-nav a:hover {
  color: var(--color-primary);
}

/* Accent bar under nav link on focus/hover (optional) */
.site-nav a {
  position: relative;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.site-nav a:hover::after {
  transform: scaleX(1);
}

/* Social bar (header) */
.social-bar {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.social-bar a {
  color: var(--color-text-muted);
  transition: color 0.2s ease;
}

.social-bar a:hover {
  color: var(--color-primary);
}

.social-bar .social-icon {
  display: block;
}

.social-bar a::after {
  display: none !important;
}

/* ----- Main: constrained column + section rhythm ----- */
main {
  position: relative;
  z-index: 1;
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--space-4xl) var(--space-xl);
}

.section {
  margin-bottom: var(--space-4xl);
  animation: sectionReveal 0.6s ease both;
}

.section:nth-child(1) { animation-delay: 0.05s; }
.section:nth-child(2) { animation-delay: 0.1s; }
.section:nth-child(3) { animation-delay: 0.15s; }
.section:nth-child(4) { animation-delay: 0.2s; }
.section:nth-child(5) { animation-delay: 0.25s; }

@keyframes sectionReveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Section header = label + title + lede (editorial rhythm) */
.section-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.section-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin: 0 0 var(--space-sm);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
  font-weight: 600;
  line-height: var(--line-tight);
  margin: 0 0 var(--space-md);
  color: var(--color-text);
}

.section-lede {
  font-size: var(--text-lg);
  line-height: var(--line-loose);
  color: var(--color-text-muted);
  margin: 0;
  max-width: 36rem;
}

.section-body h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  margin: var(--space-2xl) 0 var(--space-md);
  color: var(--color-text);
}

.section-body h2:first-child {
  margin-top: 0;
}

.section-body p {
  margin: 0 0 var(--space-lg);
}

.section-body p:last-child {
  margin-bottom: 0;
}

p.muted {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Intro: first section gets a bit more presence */
.intro .section-title {
  font-size: clamp(var(--text-4xl), 5vw, 3.25rem);
}

/* ----- Projects grid ----- */
.project-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-xl);
}

/* Desktop: 2 columns with minimum card width so they don't squash */
@media (min-width: 48rem) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(18rem, 1fr));
  }
}

/* Large desktop: projects section breaks out to full width, 3 columns, 72rem content */
@media (min-width: 75rem) {
  #projects {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
    box-sizing: border-box;
  }

  #projects .section-header,
  #projects .section-body {
    max-width: 72rem;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }

  .project-grid {
    grid-template-columns: repeat(3, minmax(18rem, 1fr));
  }
}

.project-card {
  padding: 0;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.project-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 var(--space-xl) var(--space-xl);
}

.project-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.project-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--color-border);
}

.project-card .project-title,
.project-card .project-description,
.project-card .project-tags {
  padding-left: 0;
  padding-right: 0;
}

.project-card .project-link {
  margin-top: auto;
  align-self: flex-start;
}

.project-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  margin: 0;
  padding-top: var(--space-lg);
  padding-bottom: var(--space-sm);
  color: var(--color-text);
}

.project-description {
  font-size: var(--text-sm);
  line-height: var(--line-relaxed);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-md);
}

.project-tags {
  list-style: none;
  margin: 0 0 var(--space-md);
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.project-tags li {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
}

.project-link {
  display: inline-block;
  margin-bottom: var(--space-xl);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.project-link-primary {
  padding: var(--space-sm) var(--space-lg);
  background: var(--color-primary);
  color: #fff;
}

.project-link-primary:hover {
  background: var(--color-primary-hover);
  color: #fff;
}

.project-link-secondary {
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
}

.project-link-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.project-card a.project-link::after {
  content: "";
  display: none;
}

/* ----- Experience timeline ----- */
.experience-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  padding-left: var(--space-2xl);
  border-left: 2px solid var(--color-border);
}

.experience-item {
  position: relative;
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

.experience-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
}

.experience-item::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--space-2xl) - 5px);
  top: 0.25em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
}

.experience-date {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-primary);
  display: block;
  margin-bottom: var(--space-xs);
}

.experience-category {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  display: inline-block;
  margin-bottom: var(--space-sm);
}

.experience-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0 0 var(--space-xs);
  color: var(--color-text);
}

.experience-location {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-md);
}

.experience-content {
  font-size: var(--text-sm);
  line-height: var(--line-relaxed);
  color: var(--color-text);
  margin: 0 0 var(--space-md);
}

.experience-content:last-of-type {
  margin-bottom: 0;
}

/* ----- Footer ----- */
.site-footer {
  position: relative;
  z-index: 1;
  padding: var(--space-xl);
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.site-footer p {
  margin: 0;
}

.social-bar-footer {
  margin-top: var(--space-md);
  justify-content: center;
}

.social-bar-footer a {
  font-size: var(--text-sm);
}

.social-bar-footer .social-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.2em;
}

.footer-accent {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text);
}

/* ----- Responsive ----- */
@media (max-width: 640px) {
  .site-header {
    flex-wrap: wrap;
    height: auto;
    padding: var(--space-lg);
    gap: var(--space-md);
  }

  .site-header .social-bar {
    width: 100%;
    order: 3;
  }

  .site-nav a,
  .social-bar a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .site-nav {
    gap: var(--space-lg);
  }

  main {
    padding: var(--space-2xl) var(--space-lg);
  }

  .section-header {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
  }
}
