/* =========================================================
   Nethuselah Bunag — Portfolio
   Design system: warm off-white canvas, near-black ink,
   confident blue accent. Space Grotesk (display) + Inter
   (body) + JetBrains Mono (labels/utility).
   ========================================================= */

:root{
  /* Color */
  --canvas: #FAFAF8;
  --canvas-alt: #F1EFEA;
  --surface: #FFFFFF;
  --ink: #14171C;
  --body: #4B5160;
  --muted: #5B6472;
  --hairline: #E4E2DC;
  --hairline-strong: #C9C6BE;
  --accent: #3452FF;
  --accent-ink: #FFFFFF;
  --accent-soft: #E9ECFF;
  --status: #1FAE7A;
  --dark: #14171C;
  --dark-soft: #1C2027;
  --on-dark: #F5F4F0;
  --on-dark-muted: #9BA0AC;

  /* Type */
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
  --sp-9: 96px; --sp-10: 128px;

  /* Radius */
  --r-sm: 6px; --r-md: 10px; --r-lg: 18px; --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(20,23,28,.06);
  --shadow-md: 0 8px 24px rgba(20,23,28,.08);
  --shadow-lg: 0 24px 64px rgba(20,23,28,.14);

  --max: 1180px;
}

*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{ animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

body{
  margin: 0;
  background: var(--canvas);
  color: var(--body);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img{ max-width: 100%; display: block; }
a{ color: inherit; text-decoration: none; }
ul{ margin: 0; padding: 0; list-style: none; }
h1,h2,h3{ font-family: var(--font-display); color: var(--ink); margin: 0; letter-spacing: -0.02em; }
p{ margin: 0; }

::selection{ background: var(--ink); color: var(--canvas); }

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

.skip-link{
  position: absolute; left: -9999px; top: auto;
  background: var(--ink); color: var(--on-dark);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm);
  z-index: 999;
}
.skip-link:focus{ left: var(--sp-4); top: var(--sp-4); }

.mono-label{
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow{
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--sp-4);
}

.status-dot{
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--status);
  box-shadow: 0 0 0 3px rgba(31,174,122,.18);
  flex: none;
}

/* =========================
   Buttons
   ========================= */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 14px 24px;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
  white-space: nowrap;
}
.btn-sm{ padding: 10px 18px; font-size: 14px; }
.btn-primary{
  background: var(--ink);
  color: var(--canvas);
}
.btn-primary:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost{
  background: transparent;
  color: var(--ink);
  border-color: var(--hairline-strong);
}
.btn-ghost:hover{ border-color: var(--ink); transform: translateY(-2px); }

/* =========================
   Nav
   ========================= */
.nav{
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,250,248,.82);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner{
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.nav-mark{
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
}
.nav-mark-box{
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--canvas);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .02em;
}
.nav-mark-text{ font-size: 15px; }
@media (max-width: 640px){ .nav-mark-text{ display:none; } }

.nav-links{
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  font-size: 14px;
  font-weight: 500;
}
.nav-links a{ color: var(--body); transition: color .15s ease; position: relative; }
.nav-links a:not(.nav-cta):hover{ color: var(--ink); }
.nav-cta{
  background: var(--ink);
  color: var(--canvas) !important;
  padding: 9px 18px;
  border-radius: var(--r-pill);
  transition: transform .15s ease, box-shadow .15s ease;
}
.nav-cta:hover{ transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.nav-toggle{
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: none; border: none; cursor: pointer;
  padding: 0;
}
.nav-toggle span{
  display: block; height: 2px; width: 22px;
  background: var(--ink); border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1){ transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2){ opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3){ transform: translateY(-7px) rotate(-45deg); }

.nav-mobile{
  display: none;
  flex-direction: column;
  padding: var(--sp-2) var(--sp-5) var(--sp-5);
  border-top: 1px solid var(--hairline);
}
.nav-mobile a{
  padding: var(--sp-3) 0;
  font-size: 16px;
  font-weight: 500;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
}
.nav-mobile.open{ display: flex; }

@media (max-width: 860px){
  .nav-links{ display: none; }
  .nav-toggle{ display: flex; }
}

/* =========================
   Layout helpers
   ========================= */
.section{ padding: var(--sp-10) var(--sp-5); }
.section-alt{ background: var(--canvas-alt); }
.section-inner{ max-width: var(--max); margin: 0 auto; }
.section-head{ max-width: 640px; margin-bottom: var(--sp-8); }
.section-head h2{ font-size: clamp(28px, 4vw, 40px); line-height: 1.15; }
.section-lede{ margin-top: var(--sp-3); color: var(--body); font-size: 17px; }

@media (max-width: 640px){
  .section{ padding: var(--sp-8) var(--sp-4); }
  .section-head{ margin-bottom: var(--sp-6); }
}

/* =========================
   Hero
   ========================= */
.hero{ padding: var(--sp-9) var(--sp-5) var(--sp-10); }
.hero-inner{
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: var(--sp-9);
  align-items: center;
}
.hero-name{
  font-size: clamp(40px, 6.4vw, 76px);
  line-height: .98;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.hero-role{
  margin-top: var(--sp-4);
  font-family: var(--font-mono);
  font-size: clamp(15px, 2vw, 18px);
  color: var(--accent);
  font-weight: 500;
}
.hero-role-sep{ color: var(--hairline-strong); margin: 0 4px; }
.hero-intro{
  margin-top: var(--sp-5);
  font-size: 18px;
  color: var(--body);
  max-width: 46ch;
}
.hero-actions{
  margin-top: var(--sp-7);
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.hero-links{
  margin-top: var(--sp-7);
  display: flex;
  gap: var(--sp-6);
  flex-wrap: wrap;
}
.hero-link{
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--body);
  transition: color .15s ease;
}
.hero-link .icon-github, .hero-link .icon-email{ width: 18px; height: 18px; display: block; flex: none; object-fit: contain; }
.hero-link .icon-linkedin{ width: 18px; height: 18px; display: block; flex: none; object-fit: contain; }
.hero-link:hover{ color: var(--ink); }

.hero-card{
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.hero-avatar{
  height: 220px;
  display: grid; place-items: center;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 15% 0%, var(--accent-soft), transparent 55%),
    var(--ink);
}
.hero-avatar img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}
.hero-card-body{ padding: var(--sp-6); }
.hero-facts{ display: grid; gap: var(--sp-4); margin: 0 0 var(--sp-6); }
.hero-facts div{ display: flex; flex-direction: column; gap: 2px; padding-bottom: var(--sp-3); border-bottom: 1px solid var(--hairline); }
.hero-facts div:last-child{ border-bottom: none; padding-bottom: 0; }
.hero-facts dt{ font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.hero-facts dd{ margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); }

.hero-card-terminal{
  background: var(--dark);
  color: var(--on-dark);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  font-family: var(--font-mono);
  font-size: 13px;
}
.terminal-bar{ display: flex; gap: 6px; margin-bottom: var(--sp-3); }
.terminal-bar span{ width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.18); }
.hero-card-terminal p{ margin: 0; }
.terminal-prompt{ color: var(--status); }
.terminal-out{ margin-top: var(--sp-2); color: var(--on-dark-muted); word-break: break-word; }

@media (max-width: 940px){
  .hero-inner{ grid-template-columns: 1fr; gap: var(--sp-7); }
  .hero-card{ max-width: 480px; }
}

/* =========================
   About
   ========================= */
.about-grid{
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--sp-9);
}
.about-grid .section-head{ margin-bottom: 0; }
.about-body p{ margin-bottom: var(--sp-4); font-size: 17px; }
.about-meta{
  margin-top: var(--sp-6);
  display: flex;
  gap: var(--sp-8);
  flex-wrap: wrap;
}
.about-meta-item{ display: flex; flex-direction: column; gap: 4px; }
.about-meta-item span:last-child{ font-weight: 600; color: var(--ink); }

@media (max-width: 860px){
  .about-grid{ grid-template-columns: 1fr; gap: var(--sp-5); }
}

/* =========================
   Skills
   ========================= */
.skills-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: var(--sp-4);
}
.skill-card{
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  transition: border-color .18s ease, transform .18s ease;
}
.skill-card:hover{ border-color: var(--hairline-strong); transform: translateY(-3px); }
.skill-card h3{
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.skill-card h3 .mono-label{ margin: 0; }
.tag-list{ display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.tag-list li{
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  background: var(--canvas-alt);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  color: var(--ink);
}
.section-alt .tag-list li{ background: var(--surface); }

/* =========================
   Projects
   ========================= */
.project-list{
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}
.project-card{
  display: grid;
  grid-template-columns: .85fr 1.15fr;
  gap: var(--sp-8);
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.project-visual{
  background: var(--canvas-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-7);
}
.project-visual-window{
  width: 100%;
  max-width: 340px;
  background: var(--dark);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-md);
}
.project-visual-body .mono-label{ color: var(--on-dark-muted); margin-bottom: var(--sp-3); display: block; }
.project-visual-lines{ display: grid; gap: 10px; }
.project-visual-lines span{
  display: block; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, rgba(52,82,255,.55), rgba(31,174,122,.4));
}
.project-info{ padding: var(--sp-7) var(--sp-7) var(--sp-7) 0; }
.project-info h3{ font-size: 26px; margin: var(--sp-2) 0 var(--sp-4); }
.project-info > p{ font-size: 16px; margin-bottom: var(--sp-6); }
.project-features ul{ display: grid; gap: var(--sp-2); margin-top: var(--sp-3); }
.project-features li{
  font-size: 15px; color: var(--body);
  padding-left: var(--sp-5); position: relative;
}
.project-features li::before{
  content: ""; position: absolute; left: 0; top: 9px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.project-features{ margin-bottom: var(--sp-6); }
.project-stack{ margin-bottom: var(--sp-6); }
.project-stack .tag-list{ margin-top: var(--sp-3); }

.projects-note{
  margin-top: var(--sp-6);
  font-size: 14px;
  color: var(--muted);
}
.projects-note a{ color: var(--accent); font-weight: 600; }
.projects-note a:hover{ text-decoration: underline; }

@media (max-width: 860px){
  .project-card{ grid-template-columns: 1fr; }
  .project-info{ padding: var(--sp-6); }
  .project-visual{ padding: var(--sp-6); }
}

/* =========================
   Learning
   ========================= */
.learning-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: var(--sp-4);
}
.learning-card{
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}
.learning-card h3{ font-size: 18px; margin: var(--sp-2) 0 var(--sp-3); }
.learning-card p{ font-size: 15px; }

/* =========================
   Certificates
   ========================= */
.cert-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: var(--sp-5);
}
.cert-card{
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.cert-thumb{
  position: relative;
  display: block;
  background: var(--canvas-alt);
  border-bottom: 1px solid var(--hairline);
}
.cert-thumb img{
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: top center;
  transition: transform .3s ease;
}
.cert-thumb:hover img{ transform: scale(1.03); }
.cert-thumb-hint{
  position: absolute;
  right: var(--sp-3);
  bottom: var(--sp-3);
  background: rgba(20,23,28,.82);
  color: var(--on-dark);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: var(--r-pill);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease;
}
.cert-thumb:hover .cert-thumb-hint,
.cert-thumb:focus-visible .cert-thumb-hint{ opacity: 1; transform: translateY(0); }
.cert-card-body{ padding: var(--sp-6); }
.cert-card-top{
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  color: var(--accent);
}
.cert-card-top .icon-certificate{ width: 26px; height: 26px; flex: none; display: block; object-fit: contain; }
.cert-card h3{ font-size: 19px; margin-bottom: var(--sp-2); }
.cert-theme{ font-size: 15px; font-style: italic; color: var(--body); margin-bottom: var(--sp-5); }
.cert-meta{ display: flex; gap: var(--sp-7); flex-wrap: wrap; }
.cert-meta dt{ font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cert-meta dd{ margin: 2px 0 0; font-weight: 600; color: var(--ink); font-size: 14px; }
.cert-note{ margin-top: var(--sp-5); font-size: 14px; color: var(--muted); }

/* =========================
   Education
   ========================= */
.edu-card{
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--sp-6) var(--sp-7);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  flex-wrap: wrap;
}
.edu-card h3{ font-size: 20px; margin-bottom: var(--sp-2); }
.edu-card p{ color: var(--body); font-size: 15px; }
.badge{
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 8px 16px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

/* =========================
   Contact
   ========================= */
.contact{ background: var(--dark); }
.contact .eyebrow{ color: var(--on-dark-muted); }
.contact h2{ color: var(--on-dark); }
.contact .section-lede{ color: var(--on-dark-muted); }
.contact-inner{ max-width: 720px; }
.contact-grid{
  margin-top: var(--sp-7);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: var(--sp-3);
}
.contact-card{
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--dark-soft);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-lg);
  transition: transform .18s ease, border-color .18s ease, background-color .18s ease;
}
.contact-card:hover{ transform: translateY(-3px); border-color: rgba(255,255,255,.2); background: #232833; }
.contact-card .icon-email, .contact-card .icon-github, .contact-card .icon-facebook{ width: 22px; height: 22px; flex: none; display: block; object-fit: contain; }
.contact-card .icon-linkedin{ width: 22px; height: 22px; display: block; flex: none; object-fit: contain; }
.contact-card div{ display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.contact-card .mono-label{ color: var(--on-dark-muted); }
.contact-card div span:last-child{ color: var(--on-dark); font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }

/* =========================
   Footer
   ========================= */
.footer{ background: var(--dark); border-top: 1px solid rgba(255,255,255,.08); padding: var(--sp-6) var(--sp-5); }
.footer-inner{ max-width: var(--max); margin: 0 auto; color: var(--on-dark-muted); font-size: 14px; display: flex; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.footer-inner p:first-child{ color: var(--on-dark); font-weight: 600; }
.footer-meta{ font-family: var(--font-mono); font-size: 12.5px; }

/* =========================
   Back to top
   ========================= */
.to-top{
  position: fixed;
  right: var(--sp-5);
  bottom: var(--sp-5);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--canvas);
  border: none;
  display: grid; place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 90;
  box-shadow: var(--shadow-md);
}
.to-top .icon-arrow-up{ width: 18px; height: 18px; display: block; object-fit: contain; }
.to-top.visible{ opacity: 1; transform: translateY(0); pointer-events: auto; }

/* =========================
   Reveal-on-scroll (restrained)
   ========================= */
.reveal{ opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in{ opacity: 1; transform: translateY(0); }