/* ==========================================================================
   Kyle Malitig — Portfolio
   Minimal, single-page, dependency-free. Dark theme by default.
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #0b0b0f;
  --surface: #141419;
  --surface-2: #101015;
  --text: #f2f2f5;
  --muted: #9d9daa;
  --border: #26262f;
  --accent: #8b87ff;
  --accent-soft: #1c1b33;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 14px;
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fbfbfd;
  --surface: #ffffff;
  --surface-2: #f4f4f7;
  --text: #16161a;
  --muted: #64646e;
  --border: #e6e6ec;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --shadow: 0 1px 2px rgba(16, 16, 32, .04), 0 8px 24px rgba(16, 16, 32, .06);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 .5rem; }

ul { margin: 0; padding: 0; list-style: none; }

p { margin: 0 0 1rem; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.accent { color: var(--accent); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background .25s ease;
}
.site-header.scrolled { border-bottom-color: var(--border); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #6d63ff;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-text { font-size: 15px; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  transition: color .2s ease, background .2s ease;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--text); }
.nav-links a.nav-cta {
  color: #fff;
  background: var(--accent);
  padding: 8px 16px;
}
.nav-links a.nav-cta:hover { filter: brightness(1.08); color: #fff; }
.nav-links a.nav-cta.active { color: #fff; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 18px;
  margin: 0 auto;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s 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); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}
.theme-toggle:hover { color: var(--text); background: var(--surface-2); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(3rem, 9vw, 7rem) 0 clamp(2.5rem, 6vw, 4.5rem);
  background:
    radial-gradient(1000px 500px at 12% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.hero-inner { max-width: 820px; }

.eyebrow {
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: .9rem;
}

.hero h1 {
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 750;
  margin-bottom: 1rem;
}

.hero-role {
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}

.hero-lead {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 640px;
  margin-bottom: 1.9rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 2.8rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 1.8rem;
}
.stats li { display: flex; flex-direction: column; gap: 2px; }
.stats strong { font-size: 1.9rem; font-weight: 750; letter-spacing: -0.02em; }
.stats span { font-size: 13px; color: var(--muted); }

/* ---------- Sections ---------- */
.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section-alt { background: var(--surface-2); }

.section-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .6rem;
}
.section-title {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  font-weight: 700;
  margin-bottom: 1.6rem;
}
.section-intro { color: var(--muted); max-width: 620px; margin: -0.6rem 0 2.4rem; }

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 40px;
  align-items: start;
}
.about-copy p { color: var(--muted); }
.about-copy p:first-child { color: var(--text); font-size: 1.08rem; }

.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.about-card h3 { font-size: 1rem; margin-bottom: 1rem; }
.fact-list { display: grid; gap: 10px; }
.fact-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.fact-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.fact-list span { color: var(--muted); }
.fact-list strong { font-weight: 600; text-align: right; }

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.skill-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.skill-card h3 { font-size: .98rem; margin-bottom: 1rem; }
.skill-card:last-child { grid-column: span 1; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips li {
  font-size: 12.5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 550;
  white-space: nowrap;
}
.chips-sm li { font-size: 12px; padding: 4px 10px; }

/* ---------- AI Engineering ---------- */
.ai-banner { margin-bottom: 26px; }
.ai-banner img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}
.ai-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.ai-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.ai-logo { width: 34px; height: 34px; margin-bottom: 14px; }
.ai-card h3 { font-size: 1rem; margin-bottom: 2px; }
.ai-vendor { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; }

.ai-workflow {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}
.ai-workflow h3 { font-size: 1.05rem; margin-bottom: 16px; }
.ai-workflow ul { display: grid; gap: 10px; }
.ai-workflow li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: .93rem;
}
.ai-workflow li:last-child { border-bottom: 0; padding-bottom: 0; }
.ai-workflow li span { color: var(--muted); }
.ai-workflow li strong { font-weight: 600; color: var(--text); }

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  display: grid;
  gap: 26px;
  padding-left: 26px;
  border-left: 2px solid var(--border);
}
.timeline-item { position: relative; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -34px;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid var(--accent);
}
.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  margin-bottom: .7rem;
}
.timeline-head h3 { font-size: 1.12rem; margin-bottom: .15rem; }
.timeline-company { color: var(--accent); font-weight: 600; font-size: .94rem; margin: 0; }
.timeline-date { font-size: 13px; color: var(--muted); margin: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline-points { display: grid; gap: 6px; }
.timeline-points li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
  font-size: .95rem;
}
.timeline-points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .68em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .55;
}
.tag-inline {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 22px;
}
.project-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.project-media {
  display: block;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform .5s ease;
}
.project-card:hover .project-media img { transform: scale(1.035); }

.project-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.project-kicker {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .5rem;
}
.project-body h3 { font-size: 1.18rem; margin-bottom: .5rem; }
.project-body > p { color: var(--muted); font-size: .93rem; margin-bottom: 1rem; }
.project-body .chips { margin-bottom: 1.1rem; }
.project-link {
  margin-top: auto;
  font-size: .9rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.project-link span { transition: transform .2s ease; }
.project-link:hover span { transform: translateX(3px); }

/* ---------- Two column (education / strengths) ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 48px;
  align-items: start;
}
.edu-school { color: var(--muted); margin-bottom: 1.8rem; }
.subhead { font-size: 1rem; margin: 0 0 .8rem; }

.strength-list { display: grid; gap: 10px; }
.strength-list li {
  position: relative;
  padding-left: 24px;
  color: var(--muted);
  font-size: .95rem;
}
.strength-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .42em;
  width: 12px;
  height: 7px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

/* ---------- Contact ---------- */
.section-contact {
  background:
    radial-gradient(800px 400px at 85% 120%, var(--accent-soft), transparent 60%),
    var(--surface-2);
  text-align: center;
}
.contact-inner { max-width: 640px; }
.contact-inner .section-eyebrow { text-align: center; }
.contact-lead { color: var(--muted); margin-bottom: 1.8rem; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 1.4rem; }
.contact-meta { font-size: 14px; color: var(--muted); margin: 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; }
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
}
.footer-inner a { color: var(--accent); font-weight: 550; }

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s ease, transform .6s ease;
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .project-card:hover, .skill-card:hover { transform: none; }
  .project-card:hover .project-media img { transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; gap: 28px; }
  .two-col { grid-template-columns: 1fr; gap: 40px; }
}

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

  .nav-links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 16px 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
  }
  .nav-links.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-links a { padding: 12px 14px; font-size: 15px; }
  .nav-links a.nav-cta { text-align: center; margin-top: 4px; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .timeline { padding-left: 20px; }
  .timeline-item::before { left: -28px; }
  .timeline-head { flex-direction: column; align-items: flex-start; }
}
