/* ============================================================
   Edward Fields — Portfolio
   Theme: Warm Editorial. Fraunces / DM Sans / JetBrains Mono.
   Warm paper + emerald. Light/dark via [data-theme] toggle.
   ============================================================ */

:root {
  --font-disp: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --nav-h: 62px;
  --wrap: 900px;

  /* Light theme (warm paper) */
  --bg:          #FBF9F5;
  --bg-elev:     #FFFFFF;
  --text:        #1C2024;
  --muted:       #63625E;
  --line:        #E8E3D8;
  --accent:      #059669;
  --accent-hov:  #047857;
  --accent-soft: rgba(5, 150, 105, 0.10);
  --accent-ring: rgba(5, 150, 105, 0.28);
  --shadow:      rgba(28, 32, 36, 0.07);
  --nav-bg:      rgba(251, 249, 245, 0.85);
}

:root[data-theme="dark"] {
  --bg:          #14161A;
  --bg-elev:     #1B1E23;
  --text:        #ECEEF0;
  --muted:       #9BA1A8;
  --line:        #2A2E35;
  --accent:      #10B981;
  --accent-hov:  #34D399;
  --accent-soft: rgba(16, 185, 129, 0.13);
  --accent-ring: rgba(16, 185, 129, 0.32);
  --shadow:      rgba(0, 0, 0, 0.45);
  --nav-bg:      rgba(20, 22, 26, 0.85);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hov); }

/* ---------- Navigation ---------- */
nav {
  position: fixed; top: 0; left: 0; width: 100%;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: center;
  gap: 2px;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 1000;
}
nav a {
  position: relative;
  font-family: var(--font-mono);
  font-size: 12.5px; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--muted);
  padding: 9px 16px; border-radius: 7px;
  transition: color .2s, background .2s;
}
nav a:hover { color: var(--text); background: var(--accent-soft); }
nav a.active { color: var(--text); }
nav a.active::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 3px;
  height: 2px; border-radius: 2px; background: var(--accent);
}

/* Dark-mode toggle button */
.theme-toggle {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 9px;
  cursor: pointer; transition: color .2s, border-color .2s, background .2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent-ring); background: var(--accent-soft); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Layout & headings ---------- */
main {
  max-width: var(--wrap); margin: 0 auto;
  padding: calc(var(--nav-h) + 56px) 24px 100px;
}

h1, h2, h3 {
  font-family: var(--font-disp);
  font-optical-sizing: auto;
  font-weight: 600; line-height: 1.1; letter-spacing: -0.02em;
}
h1 { font-size: clamp(2.5rem, 6.5vw, 3.7rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin-bottom: .35em; }
h3 { font-size: 1.3rem; margin-bottom: .4em; }
p  { color: var(--muted); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--accent); border-radius: 2px; }

/* ---------- Hero (Home) ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: calc(var(--nav-h) + 90px) 24px 110px;
  background:
    radial-gradient(60% 80% at 85% 0%, var(--accent-soft), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--line);
}
.hero-inner { max-width: var(--wrap); margin: 0 auto; animation: rise .6s ease both; }
.hero h1 { margin-bottom: 18px; }
.lede {
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  max-width: 48ch; color: var(--text); opacity: .82; line-height: 1.5;
}
.spec-row {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.03em;
  color: var(--muted); margin-top: 28px;
}
.spec-row span::before { content: "› "; color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 0.95rem;
  color: #fff; background: var(--accent);
  padding: 12px 24px; border-radius: 9px; margin-top: 34px;
  transition: background .2s, transform .1s, box-shadow .2s;
  box-shadow: 0 4px 14px var(--accent-soft);
}
.btn:hover { background: var(--accent-hov); color: #fff; transform: translateY(-2px); box-shadow: 0 8px 22px var(--accent-soft); }
.btn:active { transform: translateY(0); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 260px 1fr; gap: 44px; align-items: start; }
.about-grid p + p { margin-top: 1em; }
.profile-img {
  width: 260px; height: 260px; object-fit: cover;
  border-radius: 14px; border: 1px solid var(--line);
  box-shadow: 0 10px 30px var(--shadow);
}

/* ---------- CV ---------- */
.section { padding: 36px 0; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: none; padding-top: 8px; }
.cv-entry { margin-bottom: 30px; }
.cv-entry:last-child { margin-bottom: 0; }
.cv-entry .meta {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted);
}
.cv-entry .role { font-family: var(--font-disp); font-weight: 600; font-size: 1.18rem; margin: 4px 0 10px; }
.cv-entry ul { list-style: none; margin-top: 8px; }
.cv-entry li { position: relative; padding-left: 20px; margin-bottom: 6px; color: var(--muted); }
.cv-entry li::before { content: ""; position: absolute; left: 4px; top: 11px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.honors { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.honors span {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  padding: 6px 13px; border-radius: 999px; white-space: nowrap;
}

main > p > a { font-family: var(--font-mono); font-size: 0.9rem; }

/* ---------- Projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; margin-top: 10px; }
.project-card {
  display: flex; flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  transition: border-color .2s, transform .18s, box-shadow .2s;
}
.project-card:hover {
  border-color: var(--accent-ring);
  transform: translateY(-4px);
  box-shadow: 0 14px 34px var(--shadow);
}
.project-img {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover;
  background: var(--accent-soft); border-bottom: 1px solid var(--line);
}
.project-body { display: flex; flex-direction: column; flex: 1; padding: 20px 20px 22px; }
.project-body .tag {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px;
}
.project-body h3 { margin-bottom: 10px; }
.project-body p { font-size: 0.95rem; flex: 1; }
.project-links { display: flex; gap: 18px; margin-top: 16px; }
.project-links a {
  font-family: var(--font-mono); font-size: 0.85rem;
  border-bottom: 1px solid transparent; padding-bottom: 1px;
  transition: border-color .2s;
}
.project-links a:hover { border-color: var(--accent); }

/* ---------- Footer ---------- */
footer {
  max-width: var(--wrap); margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 28px 24px; text-align: center;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--muted);
}
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  nav { justify-content: flex-start; gap: 0; padding: 0 46px 0 6px; overflow-x: auto; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  nav a { padding: 9px 11px; font-size: 11.5px; white-space: nowrap; flex: 0 0 auto; }
  .theme-toggle { position: fixed; top: 15px; right: 8px; transform: none; width: 32px; height: 32px; z-index: 1001; }
  .about-grid { grid-template-columns: 1fr; gap: 26px; }
  .profile-img { width: 180px; height: 180px; }
  .project-grid { grid-template-columns: 1fr; }
}

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto; }
}

/* ---------- Video (click-to-play with custom thumbnail) ---------- */
.yt-facade { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; cursor: pointer; background: #000; }
.yt-facade img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-facade iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-facade .yt-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 68px; height: 48px; border: 0; border-radius: 14px;
  background: rgba(18, 18, 18, 0.72);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .2s, transform .2s;
}
.yt-facade:hover .yt-play { background: #e50914; transform: translate(-50%, -50%) scale(1.06); }
.yt-facade .yt-play svg { width: 26px; height: 26px; fill: #fff; }
.card-facade { border-bottom: 1px solid var(--line); }   /* top of a project card */
.demos-facade { border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 10px 30px var(--shadow); }

/* ---------- Demos page ---------- */
.demos-intro { color: var(--muted); margin: -4px 0 8px; max-width: 60ch; }
.demo { padding: 36px 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--nav-h) + 20px); }
.demo:first-of-type { border-top: none; padding-top: 10px; }
.demo .tag { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.demo h3 { margin-bottom: 16px; }
.demo p { margin-top: 16px; }
.demo-back { margin-top: 12px; }
.demo-back a { font-family: var(--font-mono); font-size: 0.85rem; }
.demo-multi { display: grid; gap: 20px; }
.demo-cap { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin: 8px 0 -4px; }
