/* =============================================================
   Mohamed Komsan — portfolio styles
   Plain CSS, no build step. Organized top-down in the order the
   page renders: tokens → base → nav → ticker → hero → sections → footer.
   ============================================================= */

:root{
  /* Navy scale — primary brand color, darkest first. */
  --navy-950:#0a1628;
  --navy-900:#0f1f38;
  --navy-800:#152b4a;
  --navy-700:#1e3a5f;
  --navy-500:#4a6382;

  /* Gold accent. Two variants exist for a reason:
     --gold-500 is decorative (borders, rules, sparklines) and fails
     contrast as body text on the light background. --gold-700 is the
     darkened version used for any *text* on --paper (5.3:1, passes AA). */
  --gold-500:#b8934a;
  --gold-400:#cba968;
  --gold-700:#7a5f28;

  --paper:#f7f7f5;
  --white:#ffffff;
  --ink:#111418;
  --ink-soft:#5c6470;
  --line:#e4e2dc;

  --pos:#2f7d55;          /* on light bg */
  --pos-bright:#6fbf8f;   /* on navy bg */
  --neg-bright:#d3766f;

  --mono:'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif:'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans:'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --maxw:1100px;
  --gutter:28px;
  --radius:3px;
}

*{box-sizing:border-box; margin:0; padding:0;}
html{scroll-behavior:smooth;}

/* Sticky nav would otherwise cover the heading of whatever section you jump to. */
:target{scroll-margin-top:96px;}
section, .hero{scroll-margin-top:96px;}

body{
  font-family:var(--sans);
  background:var(--paper);
  color:var(--ink);
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

a{color:inherit; text-decoration:none;}
img{max-width:100%; display:block;}
ul, ol{list-style:none;}

/* Visible focus for keyboard users on every interactive element. */
a:focus-visible,
button:focus-visible{
  outline:2px solid var(--navy-700);
  outline-offset:3px;
  border-radius:2px;
}

.sr-only{
  position:absolute; width:1px; height:1px;
  padding:0; margin:-1px; overflow:hidden;
  clip:rect(0 0 0 0); white-space:nowrap; border:0;
}

.skip-link{
  position:absolute; left:12px; top:-60px; z-index:100;
  background:var(--navy-950); color:#fff;
  padding:10px 18px; font-size:14px; font-weight:600;
  transition:top .18s ease;
}
.skip-link:focus{top:12px;}

/* ---------------------------- NAV ---------------------------- */
nav{
  position:sticky; top:0; z-index:50;
  background:rgba(247,247,245,0.9);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  border-bottom:1px solid var(--line);
}
.nav-inner{
  max-width:var(--maxw); margin:0 auto;
  display:flex; align-items:center; justify-content:space-between;
  padding:18px var(--gutter);
}
.logo{
  font-family:var(--serif);
  font-size:19px; font-weight:600; letter-spacing:0.01em;
  color:var(--navy-950);
}
.logo span{color:var(--gold-500);}

.nav-links{display:flex; gap:30px; font-size:14px; font-weight:500;}
.nav-links a{
  color:var(--ink-soft); position:relative; padding:4px 0;
  transition:color .2s ease;
}
.nav-links a:hover{color:var(--navy-950);}
/* Gold underline wipes in from the left on hover. */
.nav-links a::after{
  content:''; position:absolute; left:0; bottom:0; height:1px; width:0;
  background:var(--gold-500); transition:width .25s ease;
}
.nav-links a:hover::after{width:100%;}

.nav-toggle{
  display:none;
  background:none; border:1px solid var(--line);
  padding:9px 10px; cursor:pointer; border-radius:2px;
}
.nav-toggle-bars{display:block; width:18px;}
.nav-toggle-bars span{
  display:block; height:1.5px; background:var(--navy-950);
  margin:4px 0; transition:transform .22s ease, opacity .22s ease;
}
/* Hamburger → X. Top and bottom bars converge and rotate; middle fades. */
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(1){transform:translateY(5.5px) rotate(45deg);}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(2){opacity:0;}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(3){transform:translateY(-5.5px) rotate(-45deg);}

/* --------------------- TICKER (decorative) --------------------- */
.ticker-wrap{
  background:var(--navy-950);
  border-bottom:1px solid var(--navy-700);
  display:flex; align-items:center;
  overflow:hidden;
}
.ticker-badge{
  flex:none;
  font-family:var(--mono); font-size:10px; font-weight:600;
  letter-spacing:0.14em; text-transform:uppercase;
  color:var(--gold-400);
  padding:0 16px;
  border-right:1px solid rgba(255,255,255,0.1);
  align-self:stretch; display:flex; align-items:center;
}
.ticker-viewport{flex:1; overflow:hidden;}
.ticker{
  display:flex; gap:48px;
  white-space:nowrap;
  padding:9px 0 9px 48px;
  font-family:var(--mono);
  font-size:12px;
  letter-spacing:0.02em;
  color:#8fa3bd;
  animation:scroll-left 38s linear infinite;
  width:max-content;
}
.ticker span.up{color:var(--pos-bright);}
.ticker span.down{color:var(--neg-bright);}
.ticker b{color:#e7ecf3; font-weight:600;}
@keyframes scroll-left{
  0%{transform:translateX(0);}
  100%{transform:translateX(-50%);}
}

/* ---------------------------- HERO ---------------------------- */
.hero{
  max-width:var(--maxw); margin:0 auto;
  padding:96px var(--gutter) 88px;
  display:grid; grid-template-columns:1.3fr 0.7fr; gap:60px; align-items:end;
}
.eyebrow{
  font-family:var(--mono);
  font-size:12px; letter-spacing:0.14em; text-transform:uppercase;
  color:var(--gold-700); font-weight:600;
  margin-bottom:22px; display:block;
}
h1{
  font-family:var(--serif);
  font-size:clamp(38px, 5.4vw, 66px);
  line-height:1.05;
  letter-spacing:-0.01em;
  color:var(--navy-950);
  font-weight:600;
  margin-bottom:26px;
  text-wrap:balance;
}
h1 em{font-style:italic; color:var(--gold-700);}

.hero-sub{
  font-size:17px; color:var(--ink-soft); max-width:54ch;
  margin-bottom:34px;
}
.hero-cta{display:flex; gap:12px; flex-wrap:wrap;}

.btn{
  display:inline-flex; align-items:center; gap:8px;
  padding:13px 24px; font-size:14px; font-weight:600;
  border-radius:2px;
  border:1px solid transparent;
  transition:background-color .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}
.btn:hover{transform:translateY(-1px);}
.btn-primary{background:var(--navy-950); color:#fff;}
.btn-primary:hover{background:var(--navy-800);}
.btn-outline{border-color:var(--navy-950); color:var(--navy-950);}
.btn-outline:hover{background:var(--navy-950); color:#fff;}
.btn-ghost{color:var(--ink-soft); border-color:transparent; padding-left:8px; padding-right:8px;}
.btn-ghost:hover{color:var(--navy-950);}

.hero-card{
  background:var(--navy-950);
  color:#e7ecf3;
  border-radius:var(--radius);
  padding:26px;
  font-family:var(--mono);
  font-size:12.5px;
  box-shadow:0 24px 48px -20px rgba(10,22,40,0.35);
}
.hero-card .row{
  display:flex; justify-content:space-between; gap:14px;
  padding:9px 0; border-bottom:1px solid rgba(255,255,255,0.08);
}
.hero-card .row:last-child{border-bottom:none;}
.hero-card .label{color:#7f92ac;}
.hero-card .val{color:#e7ecf3; font-weight:600; text-align:right;}
.hero-card .val.pos{color:var(--pos-bright);}

/* ------------------------ SECTION SHARED ------------------------ */
section{max-width:var(--maxw); margin:0 auto; padding:70px var(--gutter);}
.section-head{
  display:flex; align-items:baseline; gap:16px;
  margin-bottom:44px;
  border-bottom:1px solid var(--line);
  padding-bottom:18px;
}
.section-num{
  font-family:var(--mono); font-size:12px; color:var(--gold-700); font-weight:600;
}
h2{
  font-family:var(--serif);
  font-size:clamp(26px, 3.4vw, 30px); font-weight:600; color:var(--navy-950);
}

/* ---------------------------- ABOUT ---------------------------- */
.about-grid{display:grid; grid-template-columns:240px 1fr; gap:56px; align-items:start;}

/* Circular avatar. Explicit width AND height (not aspect-ratio) so the img's
   presentational height attribute can't stretch it out of round.

   object-position barely does anything with the CURRENT photo: the source is
   469x500, so cropping it to a square trims only ~15px and there's almost
   nothing to pan. It becomes the knob that matters the moment you swap in a
   photo that isn't near-square — a 3:4 headshot, say — so it's left in place.
   To make the face fill the circle, crop the source image itself to a square
   head-and-shoulders shot rather than trying to fix it here. */
.profile-pic{
  width:220px; height:220px;
  border-radius:50%;
  object-fit:cover; object-position:52% 16%;
  border:3px solid var(--white);
  outline:1px solid var(--line);
  box-shadow:0 20px 40px -22px rgba(10,22,40,0.45);
  background:var(--white);
}
.about-body p{color:var(--ink-soft); font-size:16px; margin-bottom:16px; max-width:62ch;}
.about-body p b{color:var(--navy-950); font-weight:600;}

.fact-list{margin-top:32px; border-top:1px solid var(--line);}
.fact-list li{
  display:flex; justify-content:space-between; gap:16px;
  padding:12px 0; border-bottom:1px solid var(--line);
  font-size:14px;
}
.fact-list .k{color:var(--ink-soft);}
.fact-list .v{color:var(--navy-950); font-weight:600; font-family:var(--mono); text-align:right;}

/* --------------------------- PROJECTS --------------------------- */
.project-list{display:flex; flex-direction:column; gap:24px;}
.project-card{
  border:1px solid var(--line);
  background:var(--white);
  padding:32px;
  border-radius:var(--radius);
  display:grid; grid-template-columns:1fr 220px; gap:32px;
  transition:border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.project-card:hover{
  border-color:var(--navy-700);
  box-shadow:0 20px 40px -28px rgba(10,22,40,0.3);
  transform:translateY(-2px);
}
.project-top{display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin-bottom:10px;}
.project-title{
  font-family:var(--serif);
  font-size:22px; color:var(--navy-950); font-weight:600;
}
.status{
  font-family:var(--mono); font-size:10px; font-weight:600;
  letter-spacing:0.1em; text-transform:uppercase;
  padding:4px 9px; border-radius:2px; white-space:nowrap;
}
.status-live{color:#1f5c3d; background:rgba(47,125,85,0.1); border:1px solid rgba(47,125,85,0.28);}
.status-wip{color:var(--gold-700); background:rgba(184,147,74,0.1); border:1px solid rgba(184,147,74,0.32);}

.project-desc{color:var(--ink-soft); font-size:15px; margin-bottom:18px; max-width:62ch;}

.tags{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:18px;}
.tag{
  font-family:var(--mono); font-size:11px; padding:4px 9px;
  background:var(--paper); border:1px solid var(--line); color:var(--ink-soft);
  border-radius:2px;
}

.project-links{display:flex; align-items:center; gap:20px; flex-wrap:wrap; margin-bottom:0;}
.project-link{
  font-size:13px; font-weight:600; color:var(--navy-950);
  border-bottom:1px solid var(--gold-500); padding-bottom:2px;
  transition:border-color .2s ease, color .2s ease;
}
.project-link:hover{color:var(--gold-700); border-color:var(--navy-700);}
/* Secondary link in a card (the repo, when there's also a live demo). Muted so
   the demo reads as the primary call to action. */
.project-link-alt{color:var(--ink-soft); border-bottom-color:var(--line);}
.project-link-alt:hover{color:var(--navy-950); border-bottom-color:var(--gold-500);}
.project-note{font-family:var(--mono); font-size:12px; color:var(--ink-soft);}

.mini-chart{
  background:var(--navy-950); border-radius:2px; padding:16px;
  display:flex; align-items:center; min-height:120px;
}
.mini-chart svg{width:100%; height:auto;}

/* --------------------------- TIMELINE --------------------------- */
.timeline{display:flex; flex-direction:column;}
.timeline-item{
  display:grid; grid-template-columns:180px 1fr; gap:32px;
  padding:26px 0;
  border-top:1px solid var(--line);
}
.timeline-date{
  font-family:var(--mono); font-size:12px; color:var(--gold-700);
  font-weight:600; letter-spacing:0.04em;
}
.timeline-title{
  font-family:var(--serif); font-size:19px; font-weight:600;
  color:var(--navy-950); margin-bottom:2px;
}
.timeline-org{font-size:14px; color:var(--navy-700); font-weight:500; margin-bottom:10px;}
.timeline-desc{font-size:15px; color:var(--ink-soft); max-width:64ch;}
.timeline-desc + .timeline-desc{margin-top:8px;}
.timeline-desc b{color:var(--navy-950); font-weight:600;}

/* Job bullets. Custom marker (not list-style) so the gold dot aligns with the
   first line of text and hanging indents stay flush on wrapped lines. */
.timeline-bullets{font-size:15px; color:var(--ink-soft); max-width:64ch;}
.timeline-bullets li{position:relative; padding-left:18px; margin-bottom:7px;}
.timeline-bullets li:last-child{margin-bottom:0;}
.timeline-bullets li::before{
  content:''; position:absolute; left:0; top:9px;
  width:5px; height:5px; border-radius:50%;
  background:var(--gold-500);
}

/* Visual reminder to swap in real content. Delete the span in the HTML when done. */
.placeholder-note{
  font-family:var(--mono); font-size:12px; color:var(--gold-700);
  background:rgba(184,147,74,0.1); padding:1px 6px; border-radius:2px;
}

/* ---------------------------- SKILLS ---------------------------- */
.skills-grid{
  display:grid; grid-template-columns:repeat(auto-fit, minmax(230px, 1fr));
  gap:32px;
}
.skill-heading{
  font-family:var(--mono); font-size:11px; font-weight:600;
  letter-spacing:0.12em; text-transform:uppercase;
  color:var(--navy-700); margin-bottom:14px;
  padding-bottom:10px; border-bottom:1px solid var(--line);
}
.skill-group .tags{margin-bottom:0;}

/* ---------------------------- CONTACT ---------------------------- */
.contact-grid{display:grid; grid-template-columns:1fr 1fr; gap:56px; align-items:start;}
.contact-lead{font-size:17px; color:var(--ink-soft); margin-bottom:28px; max-width:46ch;}
.contact-list{border-top:1px solid var(--line);}
.contact-list li{
  display:flex; justify-content:space-between; gap:16px;
  padding:14px 0; border-bottom:1px solid var(--line);
  font-size:14px;
}
.contact-list .k{color:var(--ink-soft);}
.contact-list .v{
  color:var(--navy-950); font-weight:600; font-family:var(--mono);
  text-align:right; word-break:break-word;
  border-bottom:1px solid transparent;
  transition:border-color .2s ease;
}
.contact-list .v:hover{border-color:var(--gold-500);}

/* ---------------------------- FOOTER ---------------------------- */
footer{border-top:1px solid var(--line); margin-top:40px;}
.footer-inner{
  padding:36px var(--gutter);
  max-width:var(--maxw); margin:0 auto;
  display:flex; justify-content:space-between; align-items:center; gap:20px; flex-wrap:wrap;
  font-size:13px; color:var(--ink-soft);
}
.footer-links{display:flex; gap:22px; flex-wrap:wrap;}
.footer-links a{font-weight:600; color:var(--navy-950);}
.footer-links a:hover{color:var(--gold-700);}

/* ------------------------ SCROLL REVEAL ------------------------
   Gated behind .js (set by the inline script in <head>) so that with
   JavaScript disabled the content is simply visible — never hidden by
   a fade-in that will never fire. main.js adds .is-visible on scroll. */
.js .reveal{
  opacity:0; transform:translateY(14px);
  transition:opacity .5s ease, transform .5s ease;
}
.js .reveal.is-visible{opacity:1; transform:none;}

/* ---------------------------- RESPONSIVE ---------------------------- */
@media (max-width:900px){
  .about-grid{grid-template-columns:200px 1fr; gap:36px;}
  .profile-pic{width:180px; height:180px;}
  .contact-grid{grid-template-columns:1fr; gap:36px;}
}

@media (max-width:820px){
  .hero{grid-template-columns:1fr; padding-top:64px; padding-bottom:64px; gap:40px;}
  /* Single column: the avatar stacks above the bio instead of beside it. */
  .about-grid{grid-template-columns:1fr;}
  .profile-pic{width:160px; height:160px;}
  .project-card{grid-template-columns:1fr; padding:26px;}
  .mini-chart{order:-1; min-height:90px;}
  .timeline-item{grid-template-columns:1fr; gap:8px;}
  section{padding:56px var(--gutter);}

  /* Nav collapses into a toggled panel below the bar. */
  .nav-toggle{display:block;}
  .nav-links{
    position:absolute; left:0; right:0; top:100%;
    flex-direction:column; gap:0;
    background:var(--paper);
    border-bottom:1px solid var(--line);
    padding:0 var(--gutter);
    /* Collapsed by default; JS toggles .is-open. visibility keeps links
       out of the tab order while hidden. */
    max-height:0; overflow:hidden; visibility:hidden;
    transition:max-height .25s ease, visibility .25s;
  }
  .nav-links.is-open{max-height:320px; visibility:visible;}
  .nav-links a{padding:14px 0; border-bottom:1px solid var(--line); font-size:15px;}
  .nav-links a:last-child{border-bottom:none;}
  .nav-links a::after{display:none;}
}

@media (max-width:520px){
  :root{--gutter:20px;}
  .hero-cta{gap:10px;}
  .btn{padding:12px 18px;}
  .ticker-badge{padding:0 12px;}
  .fact-list li, .contact-list li{flex-direction:column; gap:2px;}
  .fact-list .v, .contact-list .v{text-align:left;}
}

/* --------------------- REDUCED MOTION --------------------- */
@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto;}
  .ticker{animation:none;}
  .js .reveal{opacity:1; transform:none; transition:none;}
  *{transition-duration:.01ms !important; animation-duration:.01ms !important;}
  .btn:hover, .project-card:hover{transform:none;}
}

/* --------------------------- PRINT ---------------------------
   Recruiters do occasionally print. Strip chrome, keep content. */
@media print{
  nav, .ticker-wrap, .hero-cta, .mini-chart{display:none;}
  body{background:#fff;}
  .js .reveal{opacity:1; transform:none;}
  .project-card{break-inside:avoid; box-shadow:none;}
}
