/* ---------------------------------------------------------------
   Foued Portfolio
   Minimal, calm, clear.
   --------------------------------------------------------------- */

/* Light theme (default). Claire: cream paper, graphite ink */
:root {
  --paper:      #F8F5EF;   /* warm soft white */
  --paper-soft: #F0ECE3;
  --ink:        #1C1A16;   /* warm near-black */
  --ink-soft:   #54514A;
  --ink-faint:  #8C887E;
  --line:       #E8E2D8;
  --accent:     #2A2825;   /* warm graphite */
  --accent-ink: #2A2620;
  --accent-soft:#ECE6DB;   /* warm light chip */

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans:  ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --maxw: 1000px;
  --pad: clamp(1.25rem, 5vw, 2.5rem);
  --section-y: clamp(4.5rem, 11vw, 8rem);
}

/* Dark theme: applied when the user OS prefers dark AND hasn't chosen manually */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper:      #181714;   /* warm graphite */
    --paper-soft: #211F1B;
    --ink:        #ECE8E0;   /* warm off-white */
    --ink-soft:   #C2BCB0;
    --ink-faint:  #8B867B;
    --line:       #2D2B26;
    --accent:     #CBC4B5;   /* warm light */
    --accent-ink: #E2DDD2;
    --accent-soft:#2B281F;
  }
}

/* Manual overrides via the toggle */
:root[data-theme="dark"] {
  --paper:      #181714;
  --paper-soft: #211F1B;
  --ink:        #ECE8E0;
  --ink-soft:   #C2BCB0;
  --ink-faint:  #8B867B;
  --line:       #2D2B26;
  --accent:     #CBC4B5;
  --accent-ink: #E2DDD2;
  --accent-soft:#2B281F;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .4s ease, color .4s ease;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.12; letter-spacing: -0.01em; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: 0 0 .4rem 0;
}
.skip-link:focus { left: 0; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background-color .4s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); }

.nav { display: flex; align-items: center; justify-content: space-between; height: 4.25rem; }
.wordmark { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
.nav-right { display: flex; align-items: center; gap: clamp(.85rem, 2.5vw, 1.75rem); }
.nav-links { display: flex; gap: clamp(.9rem, 2.5vw, 2rem); }
.nav-links a { font-size: .9rem; color: var(--ink-soft); transition: color .2s ease; }
.nav-links a:hover { color: var(--ink); }

.theme-toggle {
  position: fixed; left: 1.1rem; bottom: 1.1rem; z-index: 60;
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; padding: 0;
  border: none; background: transparent; color: var(--ink-faint);
  cursor: pointer; transition: color .2s ease, transform .15s ease;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle:active { transform: scale(.9); }
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-moon { display: block; }
  :root:not([data-theme]) .theme-toggle .icon-sun  { display: none; }
}

@media (max-width: 600px) {
  .nav-links { gap: .9rem; }
  .nav-links a { font-size: .82rem; }
  .nav-links li:nth-child(3) { display: none; } /* hide "Side projects" on small screens */
}
@media (max-width: 420px) {
  .nav-links li:nth-child(2) { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding-top: clamp(4rem, 12vw, 8rem); padding-bottom: var(--section-y); }
.eyebrow {
  font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: 1.5rem; font-weight: 600;
}
.hero-title { font-size: clamp(2.25rem, 6vw, 3.75rem); max-width: 16ch; margin-bottom: 1.75rem; }
.hero-lede { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--ink-soft); max-width: 56ch; line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .85rem; margin-top: 2.5rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .7rem 1.4rem; border-radius: 999px; font-size: .95rem; font-weight: 500;
  border: 1px solid transparent; cursor: pointer; font-family: inherit;
  -webkit-appearance: none; appearance: none;
  transition: transform .15s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-faint); }

/* ---------- Sections ---------- */
.section { padding-block: var(--section-y); }
.section-muted { background: var(--paper-soft); transition: background-color .4s ease; }
.section-head { margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.section-title { font-size: clamp(1.6rem, 3.5vw, 2.25rem); }
.section-note { color: var(--ink-faint); margin-top: .6rem; font-size: 1rem; }

/* ---------- Project list (visual + text) ---------- */
.project-list { display: flex; flex-direction: column; gap: clamp(3rem, 7vw, 5.5rem); }
.project {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(1.5rem, 5vw, 3.5rem);
  align-items: center;
}
.project:nth-child(even) .project-visual { order: 2; }

.project-visual {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper-soft);
  padding: clamp(.75rem, 2vw, 1.25rem);
  overflow: hidden;
  transition: background-color .4s ease, border-color .4s ease;
}
.project-visual svg, .project-visual img { display: block; width: 100%; height: auto; border-radius: 8px; }

.project-index { font-family: var(--serif); color: var(--ink-faint); font-size: 1rem; display: block; margin-bottom: 1rem; }
.project-tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .9rem; }
.tag {
  font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; font-weight: 600;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: .25rem .6rem; border-radius: 999px;
}
.project-title { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: .65rem; }
.project-desc { color: var(--ink-soft); max-width: 50ch; }
.project-metric { margin-top: 1.1rem; display: flex; align-items: baseline; gap: .55rem; color: var(--ink-soft); font-size: .95rem; }
.metric-num { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; line-height: 1; color: var(--ink); letter-spacing: -0.01em; }
.project-approach { margin-top: 1rem; color: var(--ink-soft); font-size: .95rem; max-width: 50ch; }
.project-approach span {
  display: inline-block; margin-right: .5rem; font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; font-weight: 700; color: var(--accent-ink);
}
@media (max-width: 720px) {
  .project { grid-template-columns: 1fr; gap: 1.5rem; }
  .project:nth-child(even) .project-visual { order: 0; }
}

/* ---------- SVG mockup palette (theme-aware) ---------- */
.m-bg     { fill: var(--paper); }
.m-panel  { fill: var(--paper-soft); stroke: var(--line); }
.m-card   { fill: var(--paper); stroke: var(--line); }
.m-soft   { fill: var(--paper-soft); }
.m-line   { fill: var(--ink-faint); opacity: .35; }
.m-dot    { fill: var(--ink-faint); opacity: .4; }
.m-dot2   { fill: var(--ink-faint); opacity: .3; }
.m-accent { fill: var(--accent); }
.m-accent-soft { fill: var(--accent-soft); }
.project-visual svg [class^="m-"][class*="card"],
.project-visual svg .m-panel { stroke-width: 1; }
.m-amount { fill: var(--ink); font-family: var(--serif); font-size: 26px; font-weight: 600; }

/* ---------- How I work ---------- */
.principles { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(1.5rem, 4vw, 2.75rem); }
.principle { border-top: 1px solid var(--line); padding-top: 1.25rem; }
.principle-num { font-family: var(--serif); color: var(--accent-ink); font-size: .95rem; }
.principle-title { font-size: 1.25rem; margin: .6rem 0 .55rem; }
.principle-desc { color: var(--ink-soft); max-width: 46ch; }
@media (max-width: 640px) { .principles { grid-template-columns: 1fr; } }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(1.75rem, 5vw, 4rem); align-items: start; }
.about-body p { color: var(--ink-soft); max-width: 56ch; }
.about-body p + p { margin-top: 1.1rem; }
.skills { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.75rem; }
.certs { margin-top: 1.75rem; font-size: .95rem; color: var(--ink-faint); }
.facts { display: grid; gap: 0; }
.fact { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; padding-block: .85rem; border-top: 1px solid var(--line); }
.fact:last-child { border-bottom: 1px solid var(--line); }
.fact dt { color: var(--ink-faint); font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; }
.fact dd { margin: 0; color: var(--ink); }
@media (max-width: 720px) {
  .about-grid { grid-template-columns: 1fr; }
  .fact { grid-template-columns: 7rem 1fr; }
}

.stat-strip { display: flex; flex-wrap: wrap; gap: clamp(1.25rem, 4vw, 2.5rem); margin-top: 1.9rem; }
.stat { display: flex; flex-direction: column; }
.stat-num { font-family: var(--serif); font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 600; line-height: 1; color: var(--ink); letter-spacing: -0.01em; }
.stat-label { margin-top: .35rem; font-size: .85rem; color: var(--ink-faint); max-width: 14ch; }

/* ---------- Cards (side projects) ---------- */
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem; }
@media (max-width: 620px) { .card-grid { grid-template-columns: 1fr; max-width: 460px; margin-inline: auto; } }
.card { padding: 2rem; }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 1rem;
  padding: 1.75rem; transition: transform .2s ease, box-shadow .25s ease, border-color .4s ease, background-color .4s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px -18px rgba(0,0,0,.25); }
.card-visual {
  position: relative; aspect-ratio: 4 / 3;   /* both cards identical size */
  margin: 0 0 1.4rem; padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper-soft);
  transition: background-color .4s ease, border-color .4s ease;
}
.card-visual svg { display: block; width: 100%; height: 100%; }
/* Desktop screenshot fills the frame; show the variant matching the theme */
.card-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left top; display: block; }
.card-shot.dark { display: none; }
:root[data-theme="dark"] .card-shot.light { display: none; }
:root[data-theme="dark"] .card-shot.dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .card-shot.light { display: none; }
  :root:not([data-theme]) .card-shot.dark { display: block; }
}
.card-title { font-size: 1.4rem; margin-bottom: .6rem; }
.card-desc { color: var(--ink-soft); }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact-lede { color: var(--ink-soft); max-width: 46ch; margin: 1rem auto 2rem; }
.contact-email {
  display: inline-block; font-family: var(--serif);
  font-size: clamp(1.5rem, 5vw, 2.5rem); color: var(--ink);
  border-bottom: 2px solid var(--line); padding-bottom: .15rem; transition: border-color .2s ease;
}
.contact-email:hover { border-color: var(--accent); }
.contact-links { margin-top: 1.75rem; }
.contact-links a { color: var(--ink-soft); border-bottom: 1px solid var(--line); padding-bottom: .1rem; transition: color .2s ease, border-color .2s ease; }
.contact-links a:hover { color: var(--ink); border-color: var(--ink-faint); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 2rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; font-size: .9rem; color: var(--ink-faint); }
.footer-note { font-size: .78rem; color: var(--ink-faint); opacity: .8; }
.footer-inner a { transition: color .2s ease; }
.footer-inner a:hover { color: var(--ink); }

/* ---------- Reveal on scroll ---------- */
/* Suppress all transitions during initial load (prevents a theme/color flash on navigation) */
.no-anim, .no-anim * { transition: none !important; }
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .45s ease, transform .45s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

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