/* ================================================================
   Portfolio — Noah Carpiso
   Warm editorial palette · Restrained accent · Typography hierarchy
   ================================================================ */

/* ===== Font Face: Geist family (local woff2) ===== */
@font-face {
  font-family: 'Geist';
  src: url('fonts/Geist[wght].woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('fonts/GeistMono[wght].woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

/* ===== CSS Variables ===== */
:root {
  /* Warm palette */
  --bg: #faf9f7;
  --surface: #f5f3ef;
  --ink: #2a2724;
  --text-2: #6b6660;
  --text-3: #9a948c;
  --border: #e6e2db;
  --border-strong: #d6d1c8;
  --accent: #3b5a7e;
  --accent-hover: #34517a;
  --accent-bg: rgba(59, 90, 126, 0.07);
  --halftone-color: rgba(42, 39, 36, 0.08);

  /* Fonts */
  --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', monospace;

  /* Layout */
  --sidebar-w: 15rem;
  --content-max: 48rem;
  --content-wide: 56rem;

  /* Radii */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 150ms var(--ease);
  --t-med: 250ms var(--ease);
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  --bg: #1a1816;
  --surface: #232120;
  --ink: #f0ede8;
  --text-2: #a09a92;
  --text-3: #7a746c;
  --border: #33302c;
  --border-strong: #44403a;
  --accent: #6b8db8;
  --accent-hover: #7da0cb;
  --accent-bg: rgba(107, 141, 184, 0.1);
  --halftone-color: rgba(240, 237, 232, 0.04);
}

/* ===== Base ===== */
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  transition: background-color 400ms var(--ease), color 400ms var(--ease);
}
::selection { background: var(--accent); color: #fff; }
::-moz-selection { background: var(--accent); color: #fff; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

/* ===== Typography ===== */
h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
p { line-height: 1.65; color: var(--ink); }
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ===== Layout ===== */
.main {
  min-height: 100vh;
  transition: margin var(--t-med);
}

.section {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  padding-top: 4rem;
  scroll-margin-top: 2rem;
}
.section-wide {
  max-width: var(--content-wide);
}

/* ===== Section Label ===== */
.section-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.section-number { color: var(--accent); }
.section-dash { opacity: 0.5; }

/* ===== Hero ===== */
.hero {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 5rem 1.5rem 3rem;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}
.hero-heading {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 600;
  line-height: 1.25;
  max-width: 42rem;
  margin-bottom: 1.25rem;
}
.hero-body {
  font-size: 1rem;
  color: var(--text-2);
  max-width: 38rem;
  margin-bottom: 2rem;
}
.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.hero-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  color: var(--text-3);
}
.hero-links a { color: var(--text-2); }
.hero-links a:hover { color: var(--accent); }
.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  margin-top: 2rem;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #4a9c5e;
  animation: pulse 2s ease-in-out infinite;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 0.5rem 1.125rem;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: all var(--t-fast);
  cursor: pointer;
  text-decoration: none;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn-primary:hover {
  opacity: 0.85;
  color: var(--bg);
}
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  border-color: var(--ink);
  background: var(--surface);
  color: var(--ink);
}

/* ===== Metrics (Proof) ===== */
.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 2rem;
}
.metric {
  padding: 1.5rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.metric:nth-child(2n) { border-right: none; }
.metric:nth-last-child(-n+2) { border-bottom: none; }
.metric-value {
  display: block;
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.375rem;
}
.metric-label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.4;
}
.trust-statement {
  font-size: 14px;
  color: var(--text-2);
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
  line-height: 1.6;
}
@media (min-width: 768px) {
  .metrics { grid-template-columns: repeat(4, 1fr); }
  .metric { border-right: 1px solid var(--border); border-bottom: none; }
  .metric:nth-child(2n) { border-right: 1px solid var(--border); }
  .metric:nth-child(4n) { border-right: none; }
}

/* ===== About ===== */
.about-content p {
  margin-bottom: 1rem;
  font-size: 1rem;
  color: var(--ink);
  max-width: 42rem;
}
.about-content p:last-child {
  color: var(--text-2);
}

/* ===== Timeline (Experience) ===== */
.timeline {
  position: relative;
  padding-left: 0;
}
.timeline-entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  padding-bottom: 2.5rem;
  border-left: 2px solid var(--border);
  padding-left: 1.5rem;
  position: relative;
}
.timeline-entry:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}
.timeline-entry::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.timeline-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.timeline-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}
.timeline-org {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 0.75rem;
}
.timeline-list {
  list-style: none;
  margin-bottom: 0.75rem;
}
.timeline-list li {
  position: relative;
  padding-left: 1.125rem;
  margin-bottom: 0.375rem;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
}
.timeline-list li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--text-3);
}
.timeline-tools {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
@media (min-width: 640px) {
  .timeline-entry {
    grid-template-columns: 10rem 1fr;
    gap: 1.5rem;
  }
  .timeline-date { padding-top: 0.125rem; }
}

/* ===== Projects ===== */
.project {
  margin-bottom: 4rem;
}
.project-screenshot {
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 1.5rem;
}
.screenshot-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: radial-gradient(circle, var(--halftone-color) 1px, transparent 1px);
  background-size: 9px 9px;
}
.screenshot-placeholder span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.project-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.project-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}
.project-status {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}
.status-wip {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent);
}
.status-done {
  background: rgba(74, 156, 94, 0.08);
  color: #4a9c5e;
  border: 1px solid rgba(74, 156, 94, 0.3);
}
.project-summary {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 1.5rem;
  max-width: 44rem;
}
.project-details {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.project-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem;
}
.detail-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 500;
}
.project-detail p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.55;
}
@media (min-width: 640px) {
  .project-detail {
    grid-template-columns: 8rem 1fr;
  }
}

/* Split layout */
@media (min-width: 880px) {
  .project-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
  }
  .project-split .project-screenshot { margin-bottom: 0; }
  .project-split-reverse .project-screenshot { order: 2; }
}

/* Archive */
.project-archive {
  border-top: 1px solid var(--border);
  padding-top: 2rem;
  margin-top: 1rem;
}
.archive-heading {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}
.archive-list {
  list-style: none;
}
.archive-list li {
  font-size: 14px;
  color: var(--text-2);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.archive-list li:last-child { border-bottom: none; }
.archive-list strong { color: var(--ink); font-weight: 500; }

/* ===== Capabilities ===== */
.capabilities-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.capability-group {
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
}
.capability-group:last-child { border-bottom: 1px solid var(--border); }
.capability-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.375rem;
}
.capability-items {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
}
@media (min-width: 768px) {
  .capabilities-grid {
    grid-template-columns: 1fr 1fr;
  }
  .capability-group:nth-child(odd) { border-right: 1px solid var(--border); padding-right: 1.5rem; }
  .capability-group:nth-child(even) { padding-left: 1.5rem; }
  .capability-group { border-top: 1px solid var(--border); }
  .capability-group:first-child { border-top: 1px solid var(--border); }
  .capability-group:last-child { border-bottom: 1px solid var(--border); }
}

/* ===== Setup ===== */
.setup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) {
  .setup-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
}
.setup-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.setup-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.setup-value {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}

/* ===== Education ===== */
.education-entry {
  padding: 1.5rem 0;
}
.edu-degree {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.25rem;
}
.edu-school {
  font-size: 14px;
  color: var(--text-2);
}
.edu-meta {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 0.25rem;
}

/* ===== Contact ===== */
.contact-heading {
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 600;
  max-width: 36rem;
  margin-bottom: 1rem;
}
.contact-body {
  font-size: 1rem;
  color: var(--text-2);
  margin-bottom: 2rem;
}
.contact-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.contact-location {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}

/* ===== Sidebar ===== */
.sidebar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 1.5rem;
  border-right: 1px solid var(--border);
  background: var(--bg);
  z-index: 50;
}

.sidebar-identity { margin-bottom: 1.5rem; }
.sidebar-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}
.sidebar-role {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 0.125rem;
}
.sidebar-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}
.nav-item {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  padding: 0.375rem 0;
  transition: color var(--t-fast), padding-left var(--t-fast);
}
.nav-item:hover, .nav-item.active {
  color: var(--accent);
  padding-left: 0.5rem;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}
.sidebar-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--t-fast);
}
.sidebar-link:hover { color: var(--accent); }
.theme-toggle {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
  transition: color var(--t-fast);
}
.theme-toggle:hover { color: var(--accent); }
.sidebar-location {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  margin-top: 0.5rem;
}

/* ===== Mobile Header ===== */
.mobile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.mobile-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.menu-bar {
  width: 20px;
  height: 1.5px;
  background: var(--ink);
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.menu-toggle.open .menu-bar:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.menu-toggle.open .menu-bar:nth-child(2) { opacity: 0; }
.menu-toggle.open .menu-bar:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* ===== Mobile Menu ===== */
.mobile-menu {
  position: fixed;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-fast), visibility var(--t-fast);
  z-index: 99;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 1.5rem;
}
.mobile-menu.open { opacity: 1; visibility: visible; }
.mobile-nav { display: flex; flex-direction: column; gap: 0.5rem; }
.mobile-nav-item {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--t-fast);
}
.mobile-nav-item:hover, .mobile-nav-item:active { color: var(--accent); }
.mobile-menu-footer {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.mobile-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  text-decoration: none;
}
.mobile-link:hover { color: var(--accent); }

/* ===== Desktop Layout ===== */
@media (min-width: 1024px) {
  .sidebar { display: flex; }
  .mobile-header { display: none; }
  .main { margin-left: var(--sidebar-w); }
  .hero { padding-top: 6rem; }
}

/* ===== Animations ===== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Print ===== */
@media print {
  .sidebar, .mobile-header, .mobile-menu { display: none !important; }
  .main { margin: 0 !important; }
  body { font-size: 11pt; color: #000; background: #fff; }
  a { color: #000; text-decoration: underline; }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .status-dot { animation: none; }
}
