/* =========================================
   main.css — v13
   ========================================= */

/* ---------- Design tokens (Light default) ---------- */
:root {
  --bg: #f6f3ee;
  --text: #111111;
  --muted: #5a5a5a;
  --border: #e6e0d8;
  --accent: #111111;
  --surface: #ffffff;

  --railw: 200px;

  /* Controls for interactive elements */
  --icon-btn-size: 44px;
  --icon-glyph-size: 24px;
  --about-logo-size: 72px;

  /* Projects */
  --project-thumb-w: 300px;
  --project-thumb-r: 12px;

  /* Type scale */
  --step--1: clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem);
  --step-0:  clamp(1rem, 0.95rem + 0.4vw, 1.125rem);
  --step-1:  clamp(1.25rem, 1.1rem + 0.9vw, 1.6rem);
  --step-2:  clamp(1.6rem, 1.4rem + 1.3vw, 2.15rem);
  --step-3:  clamp(2.4rem, 2rem + 2.6vw, 3.25rem);
}

/* Explicit theme override */
:root[data-theme="light"] {
  --bg: #f6f3ee;
  --text: #111111;
  --muted: #5a5a5a;
  --border: #e6e0d8;
  --accent: #111111;
  --surface: #ffffff;
}
:root[data-theme="dark"] {
  --bg: #0e100f;
  --text: #f2f2f2;
  --muted: #b8b8b8;
  --border: #252726;
  --accent: #f2f2f2;
  --surface: #151716;
}

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

html, body { height: 100%; scroll-behavior: smooth; }

body {
  margin: 0; color: var(--text); background: var(--bg);
  font-family: "Open Sans", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--step-0); line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  line-height: 1.2; margin: 0 0 0.5em; color: var(--text);
}
h1 { font-size: var(--step-3); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }

p { margin: 0 0 1rem; }
.lede { color: var(--muted); }

/* Skip link */
.skip-link { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.skip-link:focus {
  position: fixed; left: 1rem; top: 1rem;
  background: var(--surface); color: var(--text);
  padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 999px; z-index: 1000;
}

/* ---------- Content container ---------- */
.container { padding-inline: clamp(1rem, 6vw, 6rem); margin-inline: auto; max-width: 1150px; }

/* Main content grid */
.page { max-width: 100%; margin: 0; padding: 0 0 4rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }

/* ---------- MOBILE TOP BAR / DRAWER ---------- */
.mobile-topbar {
  position: sticky; top: 0;
  height: 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 110;
  padding-inline: clamp(1rem, 4vw, 1.25rem);
  display: none;
  align-items: center;
  justify-content: space-between;
}
.topbar-theme {
  background: none; border: none; padding: 0;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.topbar-theme img { width: 22px; height: 22px; display: block; }

.hamburger {
  background: none; border: none; padding: 0;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.hamburger-lines,
.hamburger-lines::before,
.hamburger-lines::after {
  content: ""; display: block; width: 20px; height: 2px; background: var(--text);
  position: relative; border-radius: 2px;
}
.hamburger-lines::before { position: absolute; top: -6px; }
.hamburger-lines::after  { position: absolute; top: 6px; }

.mobile-drawer {
  position: fixed; top: 0; right: 0; height: 100vh;
  width: min(78vw, 320px);
  background: var(--bg);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 220ms ease;
  z-index: 120;
  padding: 72px 1.25rem 1rem; /* space for topbar */
}
.mobile-drawer.is-open { transform: translateX(0); }

.mobile-scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,0.25); z-index: 115;
}
.mobile-menu { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.mobile-menu a { color: var(--text); text-decoration: none; font-size: var(--step-1); }

body.no-scroll { overflow: hidden; }

@media (max-width: 991.98px) {
  .mobile-topbar { display: flex; }
}

/* ---------- Left scroll-spy rail ---------- */
.site-frame {
  position: fixed; top: 0; left: 0; height: 100vh; width: var(--railw);
  padding-left: clamp(0.75rem, 1.5vw, 1.25rem); display: none;
}
.rail { height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 0.75rem; }
.rail-nav { list-style: none; margin: 0; padding: 0; text-align: left; }
.rail-nav a { display: block; padding: 0.25rem 0; color: var(--muted); text-decoration: none; transition: color 180ms ease, transform 180ms ease; outline-offset: 3px; }
.rail-nav a:hover, .rail-nav a:focus { color: var(--text); }
.rail-nav a.is-active { color: var(--accent); transform: translateX(6px); }

/* THEME TOGGLE (desktop): text + icon, no background/border */
.theme-toggle {
  margin-top: 1.25rem;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: 600 var(--step--1)/1 "Open Sans", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  cursor: pointer;
}
.theme-toggle .theme-icon-img { width: 18px; height: 18px; display: block; }
.theme-toggle .theme-label { opacity: 0.9; }

/* Keep content out from under the rail on desktop */
@media (min-width: 992px) { .site-frame { display: block; } body { padding-left: var(--railw); } }

/* ---------- Sections ---------- */
.section { border-top: none; padding-block: clamp(3rem, 6vh, 6rem); }
#intro, #work, #about { min-height: 100vh; min-height: 100svh; min-height: 100dvh; }
#work > h2 { padding-bottom: clamp(3rem, 2.5vh, 2rem); }
#contact > h2 { padding-bottom: clamp(1rem, 2vh, 1.5rem); }

/* ---------- Intro ---------- */
.section-intro {
  display: grid; grid-template-columns: 200px 1fr; gap: 1.25rem 2rem;
  align-items: start; align-content: center;
}
.intro-media, .intro-copy { align-self: start; }
.avatar { width: 190px; height: 190px; border-radius: 50%; object-fit: cover; background: var(--surface); }
.intro-media { position: relative; right: 20px; } /* desktop-only nudge */
.section-intro .intro-copy { line-height: 2; max-width: 68ch; }

/* Buttons */
.intro-actions, .section-contact .contact-actions { display: flex; flex-wrap: wrap; gap: clamp(1rem, 2.2vw, 2rem); margin-top: 2.3rem; }
.icon-btn { text-decoration: none; color: var(--text); font-weight: 600; }
.icon-btn.icon-btn--img {
  width: var(--icon-btn-size); height: var(--icon-btn-size); padding: 0; border-radius: 12px; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn.icon-btn--img img { width: 100%; height: 100%; display: block; object-fit: contain; }

.pill { display: inline-block; padding: 0.5rem 0.875rem; border-radius: 999px; background: var(--text); color: var(--bg); text-decoration: none; border: 1px solid var(--text); }
.pill--outline {
  min-height: var(--icon-btn-size); display: inline-flex; align-items: center; gap: 0.8rem;
  padding: 0 1rem; border-radius: 999px; background: transparent; color: var(--text); border: 1px solid var(--text);
  text-decoration: none; font-family: "Playfair Display", Georgia, "Times New Roman", serif; font-weight: 600;
}

/* Subtle grow on hover/focus */
@media (prefers-reduced-motion: no-preference) {
  .icon-btn.icon-btn--img, .pill--outline { transition: transform 150ms ease; will-change: transform; transform-origin: center; }
  .icon-btn.icon-btn--img:hover, .icon-btn.icon-btn--img:focus-visible,
  .pill--outline:hover, .pill--outline:focus-visible { transform: scale(1.06); }
}

/* ---------- Projects ---------- */
.section-work .project {
  display: grid;
  grid-template-columns: var(--project-thumb-w) 1fr;
  gap: 1.25rem 2rem;
  align-items: start;
  margin-bottom: 2.75rem;
}
.section-work .project-thumb {
  width: 100%;
  background: var(--surface);
  border-radius: var(--project-thumb-r);
  overflow: hidden;
}
.section-work .project-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Remove accent color from featured project */
.section-work .project--featured .project-thumb { /* no special border */ }

.section-work .project-title { margin: 0 0 0.5rem; }
.section-work .project-desc { color: var(--muted); max-width: 62ch; line-height: 1.7; }

/* Hide initially hidden projects (specificity beats .project display) */
.section-work .project.is-hidden { display: none; }

/* Load more */
.section-work .load-more {
  display: block; width: 100%;
  margin-top: 1.5rem; padding: 1.1rem 1rem;
  background: transparent; color: var(--text);
  border: 1px solid var(--text);
  border-radius: 5px;
  font-weight: 700; letter-spacing: 0.04em;
  cursor: pointer;
}
@media (prefers-reduced-motion: no-preference) {
  .section-work .load-more {
    transition: transform 150ms ease, background-color 150ms ease, color 150ms ease, border-color 150ms ease;
  }
  .section-work .load-more:hover,
  .section-work .load-more:focus-visible {
    transform: scale(1.03);
  }
}

/* Reveal animation */
@keyframes projectFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.section-work .project.revealed { animation: projectFadeIn 220ms ease; }

/* ---------- About (rows) ---------- */
.section-about { display: grid; row-gap: clamp(1.25rem, 2.5vh, 2rem); }
.section-about .about-images { display: none; }
.section-about .about-images .about-logo {
  width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--surface); border: 1px solid var(--border);
}
.section-about .about-list { display: grid; row-gap: clamp(1.75rem, 2.8vh, 2.5rem); }
.section-about .about-item {
  display: grid; grid-template-columns: var(--about-logo-size) 1fr;
  column-gap: 5rem; align-items: start;
}
.section-about .about-item .about-logo { width: var(--about-logo-size); height: var(--about-logo-size); border-radius: 10px; object-fit: cover; background: var(--surface); }
.section-about .about-item p { margin: 0; line-height: 1.8; align-self: start; margin-top: -4px; }
.section-about .about-item strong { font-weight: 700; }
/* Hide only the last image but keep grid alignment */
.section-about .about-item:last-child .about-logo { visibility: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) { .site-frame { display: none; } }
@media (max-width: 768px) {
  .section-intro { grid-template-columns: 1fr; }
  .avatar { width: 150px; height: 150px; }
  .section-work .project { grid-template-columns: 1fr; }
  .section-work .project-thumb { aspect-ratio: 16 / 9; }
  /* Fix: ensure avatar respects container padding on mobile */
  .intro-media { right: 0; }
}
@media (max-width: 640px) {
  /* Show horizontal icon strip on mobile */
  .section-about .about-images { display: flex; flex-wrap: nowrap; gap: 0.75rem; margin-bottom: 0.75rem; }
  /* Hide per-row logos on mobile (text full-width) */
  .section-about .about-item { grid-template-columns: 1fr; }
  .section-about .about-item .about-logo { display: none; }
  /* Hide the last icon in the mobile About Me strip */
  .section-about .about-images .about-logo:last-child { display: none; }

}

/* ---------- Focus ---------- */
a:focus-visible, button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* Theme transition polish */
@media (prefers-reduced-motion: no-preference) {
  :root.theme-animating, :root.theme-animating * {
    transition: background-color 350ms ease, color 350ms ease, border-color 350ms ease, fill 350ms ease, stroke 350ms ease;
  }
}


/* home.css — project card link & hover polish */

/* Make project titles look like the rest of your text */
.project-title a {
  color: var(--text);
  text-decoration: none;
}
.project-title a:hover,
.project-title a:focus-visible {
  text-decoration: none; /* no underline on hover */
}

/* Ensure the image is a clean, rounded click target */
.project-thumb a {
  display: block;
  border-radius: 12px;
  overflow: hidden;
}

/* Grow images slightly on any hover within the card */
.project-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  transition: transform 150ms ease;
}
.project:hover .project-thumb img,
.project-thumb a:hover img,
.project-thumb a:focus-visible img {
  transform: scale(1.03);
}

/* About links: black & bold, no underline */
.section-about p a {
  color: var(--text) !important;
  font-weight: 700 !important;
  text-decoration: none;
}
.section-about p a:hover,
.section-about p a:focus {
  text-decoration: underline;
}
