/* ============================================================
   Art direction: Personal portfolio for an AI engineering student
   Palette: Cool dark navy + indigo accent (precise, technical, ambitious)
   Typography: Instrument Serif (display, personality) + DM Sans (body, clarity)
   Density: Spacious — editorial feel
   ============================================================ */

/* ---- DESIGN TOKENS ---- */
:root, [data-theme="light"] {
  --color-bg:              #f5f4f1;
  --color-surface:         #f8f7f5;
  --color-surface-2:       #fafaf8;
  --color-surface-offset:  #eeece7;
  --color-surface-dynamic: #e6e3dd;
  --color-divider:         #dedad3;
  --color-border:          #d5d1ca;
  --color-text:            #1a1916;
  --color-text-muted:      #6b6860;
  --color-text-faint:      #b0ada6;
  --color-text-inverse:    #f5f4f1;
  --color-primary:         #1d5c8c;
  --color-primary-hover:   #154d78;
  --color-primary-active:  #0e3a5b;
  --color-primary-highlight: #ccd8e6;
  --color-accent2:         #7c4f1e;
  --color-accent2-hl:      #e8ddd0;
  --color-success:         #3a7a22;
  --color-error:           #a12c3a;
  --radius-sm:  0.375rem;
  --radius-md:  0.5rem;
  --radius-lg:  0.75rem;
  --radius-xl:  1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  --transition-fast: 140ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-interactive: 200ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 3px oklch(0.2 0.02 250 / 0.07);
  --shadow-md: 0 4px 14px oklch(0.2 0.02 250 / 0.09);
  --shadow-lg: 0 12px 40px oklch(0.2 0.02 250 / 0.13);
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem;
  --space-4: 1rem; --space-5: 1.25rem; --space-6: 1.5rem;
  --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;
  --space-16: 4rem; --space-20: 5rem; --space-24: 6rem;
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-hero: clamp(3rem,     0.5rem  + 7vw,    6.5rem);
  --content-narrow:  640px;
  --content-default: 980px;
  --content-wide:    1200px;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body:    'DM Sans', 'Helvetica Neue', sans-serif;
}

[data-theme="dark"] {
  --color-bg:              #111214;
  --color-surface:         #161819;
  --color-surface-2:       #1b1d1f;
  --color-surface-offset:  #1f2123;
  --color-surface-dynamic: #262a2d;
  --color-divider:         #2b2f32;
  --color-border:          #363b3f;
  --color-text:            #d6d4cf;
  --color-text-muted:      #797672;
  --color-text-faint:      #525050;
  --color-text-inverse:    #1a1916;
  --color-primary:         #5b9fd4;
  --color-primary-hover:   #7ab8e8;
  --color-primary-active:  #9ccbf0;
  --color-primary-highlight: #1a2d3e;
  --color-accent2:         #c48a4e;
  --color-accent2-hl:      #2e2217;
  --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.25);
  --shadow-md: 0 4px 14px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 12px 40px oklch(0 0 0 / 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:              #111214;
    --color-surface:         #161819;
    --color-surface-2:       #1b1d1f;
    --color-surface-offset:  #1f2123;
    --color-surface-dynamic: #262a2d;
    --color-divider:         #2b2f32;
    --color-border:          #363b3f;
    --color-text:            #d6d4cf;
    --color-text-muted:      #797672;
    --color-text-faint:      #525050;
    --color-text-inverse:    #1a1916;
    --color-primary:         #5b9fd4;
    --color-primary-hover:   #7ab8e8;
    --color-primary-active:  #9ccbf0;
    --color-primary-highlight: #1a2d3e;
    --color-accent2:         #c48a4e;
    --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.25);
    --shadow-md: 0 4px 14px oklch(0 0 0 / 0.35);
    --shadow-lg: 0 12px 40px oklch(0 0 0 / 0.45);
  }
}

/* ---- BASE RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-20);
}
body {
  min-height: 100dvh;
  line-height: 1.65;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
}
img, picture, svg { display: block; max-width: 100%; }
ul[role="list"], ol[role="list"] { list-style: none; }
input, button, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.1; font-family: var(--font-display); }
p, li { text-wrap: pretty; max-width: 72ch; }
::selection { background: oklch(from var(--color-primary) l c h / 0.18); color: var(--color-text); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
a, button, [role="button"] {
  transition: color var(--transition-interactive),
              background var(--transition-interactive),
              border-color var(--transition-interactive),
              box-shadow var(--transition-interactive),
              opacity var(--transition-interactive);
}
button { cursor: pointer; background: none; border: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

/* ---- LAYOUT ---- */
.container {
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: clamp(var(--space-4), 4vw, var(--space-12));
}
.section { padding-block: clamp(var(--space-12), 8vw, var(--space-24)); }

/* ---- HEADER / NAV ---- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in oklab, var(--color-bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-divider);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: var(--space-6);
}
.logo-link {
  display: flex; align-items: center; gap: var(--space-3);
  text-decoration: none; color: var(--color-text);
  font-family: var(--font-display); font-size: var(--text-lg);
  flex-shrink: 0;
}
.logo-link:hover { color: var(--color-primary); }
.logo-svg { color: var(--color-primary); }
.logo-text { font-style: italic; }
.nav-links {
  display: flex; align-items: center; gap: var(--space-2);
  list-style: none; margin-left: auto;
}
.nav-links a {
  text-decoration: none; color: var(--color-text-muted);
  font-size: var(--text-sm); font-family: var(--font-body);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md); font-weight: 450;
}
.nav-links a:hover { color: var(--color-text); background: var(--color-surface-offset); }
.btn-nav-cta {
  background: var(--color-primary) !important;
  color: white !important;
  border-radius: var(--radius-full) !important;
  padding: var(--space-2) var(--space-5) !important;
}
.btn-nav-cta:hover { background: var(--color-primary-hover) !important; }
.nav-right { display: flex; align-items: center; gap: var(--space-2); }
.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-full);
  color: var(--color-text-muted); border: 1px solid var(--color-border);
}
.theme-toggle:hover { color: var(--color-text); background: var(--color-surface-offset); }
.hamburger {
  display: none; flex-direction: column; justify-content: space-between;
  width: 40px; height: 40px; padding: var(--space-3); border-radius: var(--radius-md);
}
.hamburger span {
  display: block; height: 2px; background: var(--color-text);
  border-radius: var(--radius-full);
  transition: transform var(--transition-interactive), opacity var(--transition-fast);
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-menu {
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface); padding: var(--space-4);
}
.mobile-menu ul { list-style: none; display: flex; flex-direction: column; gap: var(--space-1); }
.mobile-menu a {
  display: block; text-decoration: none; color: var(--color-text);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  font-size: var(--text-sm);
}
.mobile-menu a:hover { background: var(--color-surface-offset); }

/* ---- HERO ---- */
.hero {
  position: relative; overflow: hidden;
  min-height: 88vh; display: flex; align-items: center;
  padding-block: clamp(var(--space-16), 10vw, var(--space-24));
}
.hero-bg-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(oklch(from var(--color-primary) l c h / 0.04) 1px, transparent 1px),
    linear-gradient(90deg, oklch(from var(--color-primary) l c h / 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 100%);
}
.hero-content { position: relative; z-index: 1; }
.hero-badge {
  display: inline-block;
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-4); margin-bottom: var(--space-6);
  border: 1px solid oklch(from var(--color-primary) l c h / 0.2);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  line-height: 1; margin-bottom: var(--space-6);
}
.hero-name { display: block; font-weight: 400; font-style: italic; color: var(--color-text-muted); }
.hero-surname { display: block; font-weight: 400; }
.hero-subtitle {
  font-size: var(--text-xl); color: var(--color-text-muted);
  font-family: var(--font-body); font-weight: 300; margin-bottom: var(--space-5);
}
.hero-subtitle em { color: var(--color-primary); font-style: normal; font-weight: 500; }
.hero-desc {
  font-size: var(--text-base); color: var(--color-text-muted);
  max-width: 54ch; margin-bottom: var(--space-8); line-height: 1.7;
}
.hero-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-8); }
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full); text-decoration: none;
  font-size: var(--text-sm); font-weight: 550; font-family: var(--font-body);
  min-height: 44px; white-space: nowrap;
}
.btn-primary { background: var(--color-primary); color: white; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--color-primary-hover); box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-ghost:hover { background: var(--color-surface-offset); border-color: var(--color-text-muted); }
.hero-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tag {
  display: inline-block;
  background: var(--color-surface); color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full); font-size: var(--text-xs);
  padding: var(--space-1) var(--space-3); font-weight: 500;
}
.hero-scroll-hint {
  position: absolute; bottom: var(--space-8); left: 50%;
  transform: translateX(-50%); color: var(--color-text-faint);
  animation: bobbing 2s ease-in-out infinite;
}
@keyframes bobbing {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

/* ---- SECTION LABELS & H2 ---- */
.section-label {
  display: block; font-size: var(--text-xs); font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-primary); margin-bottom: var(--space-3);
}
h2 {
  font-size: var(--text-2xl); font-weight: 400;
  margin-bottom: var(--space-8); font-family: var(--font-display);
}
h2 em { font-style: italic; color: var(--color-text-muted); }

/* ---- ABOUT ---- */
.about-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(var(--space-8), 6vw, var(--space-16)); align-items: center;
}
.about-text p { color: var(--color-text-muted); margin-bottom: var(--space-4); max-width: 56ch; }
.about-text strong { color: var(--color-text); font-weight: 600; }
.about-meta {
  display: flex; flex-direction: column; gap: var(--space-2);
  margin-top: var(--space-6); padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
}
.meta-item {
  display: flex; align-items: center; gap: var(--space-3);
  font-size: var(--text-sm); color: var(--color-text-muted);
}
.meta-item svg { color: var(--color-primary); flex-shrink: 0; }
.about-visual { display: flex; justify-content: center; }
.about-card-stack { position: relative; width: 280px; height: 280px; }
.acard {
  position: absolute; border-radius: var(--radius-2xl);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  box-shadow: var(--shadow-md); gap: var(--space-2); padding: var(--space-6);
}
.acard-num { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 400; line-height: 1; }
.acard-label { font-size: var(--text-xs); text-align: center; font-weight: 500; color: var(--color-text-muted); }
.acard-1 { width: 160px; height: 130px; top: 0; left: 0; background: var(--color-primary); color: white; }
.acard-1 .acard-num { color: white; }
.acard-1 .acard-label { color: oklch(1 0 0 / .75); }
.acard-2 { width: 150px; height: 120px; top: 50px; right: 0; background: var(--color-surface-2); color: var(--color-text); border: 1px solid var(--color-border); }
.acard-3 { width: 200px; height: 100px; bottom: 0; left: 20px; background: var(--color-surface-offset); color: var(--color-text); border: 1px solid var(--color-border); }
.acard-3 .acard-num { font-size: var(--text-xl); color: var(--color-primary); }

/* ---- SKILLS ---- */
.skills-section { background: var(--color-surface); }
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: var(--space-4);
}
.skill-group {
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); padding: var(--space-6);
}
.skill-group h3 {
  font-family: var(--font-body); font-weight: 650; color: var(--color-text);
  margin-bottom: var(--space-4); text-transform: uppercase;
  letter-spacing: 0.05em; font-size: var(--text-xs);
}
.skill-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.skill-list li { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-sm); color: var(--color-text-muted); }
.skill-dot { width: 8px; height: 8px; border-radius: var(--radius-full); flex-shrink: 0; }
.skill-dot.ai    { background: var(--color-primary); }
.skill-dot.code  { background: #7c3aed; }
.skill-dot.tools { background: var(--color-accent2); }
.skill-dot.other { background: var(--color-success); }

/* ---- PROJECTS ---- */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
.project-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); padding: var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-3);
  transition: box-shadow var(--transition-interactive), transform var(--transition-interactive);
}
.project-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.project-featured {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--color-primary-highlight) 0%, var(--color-surface) 100%);
  border-color: oklch(from var(--color-primary) l c h / 0.25);
}
.project-wide { grid-column: span 2; }
.project-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.project-badge {
  background: var(--color-primary); color: white;
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; padding: var(--space-1) var(--space-3); border-radius: var(--radius-full);
}
.project-school { font-size: var(--text-xs); color: var(--color-text-faint); font-weight: 500; }
.project-card h3 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 400; color: var(--color-text); }
.project-card p { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.7; }
.project-card p strong { color: var(--color-text); font-weight: 600; }
.project-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: auto; padding-top: var(--space-2); }
.project-tags span {
  background: var(--color-surface-offset); color: var(--color-text-muted);
  border: 1px solid var(--color-border); border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 500; padding: 2px var(--space-3);
}

/* ---- EDUCATION TIMELINE ---- */
.education-section { background: var(--color-surface); }
.timeline { display: flex; flex-direction: column; gap: var(--space-1); padding-left: var(--space-4); }
.timeline-item { display: grid; grid-template-columns: 1px 1fr; gap: 0 var(--space-8); position: relative; padding-bottom: var(--space-10); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ''; grid-column: 1; grid-row: 1 / 99;
  width: 1px; background: var(--color-divider); margin-top: var(--space-2);
}
.timeline-dot {
  position: absolute; left: calc(var(--space-4) * -1 + 0.5px);
  top: var(--space-1); width: 12px; height: 12px;
  background: var(--color-surface); border: 2px solid var(--color-border);
  border-radius: var(--radius-full); transform: translateX(-50%);
}
.timeline-item.current .timeline-dot {
  background: var(--color-primary); border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-highlight);
}
.timeline-body { grid-column: 2; }
.timeline-date { font-size: var(--text-xs); font-weight: 600; color: var(--color-primary); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--space-2); }
.timeline-body h3 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 400; color: var(--color-text); margin-bottom: var(--space-1); }
.timeline-place { font-size: var(--text-sm); color: var(--color-text-muted); margin-bottom: var(--space-3); }
.timeline-body > p { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.7; }
.timeline-details { list-style: disc; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.timeline-details li { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.7; }
.timeline-details strong { color: var(--color-text); }

/* ---- INTERESTS ---- */
.interests-section { padding-block: clamp(var(--space-8), 5vw, var(--space-16)); }
.interests-grid { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.interest-card {
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm); color: var(--color-text-muted); font-weight: 500;
}
.interest-card svg { color: var(--color-primary); flex-shrink: 0; }

/* ---- CONTACT ---- */
.contact-section { background: var(--color-surface); border-top: 1px solid var(--color-divider); }
.contact-inner { max-width: var(--content-narrow); }
.contact-sub {
  font-size: var(--text-base); color: var(--color-text-muted);
  margin-top: calc(var(--space-8) * -1 + var(--space-4));
  margin-bottom: var(--space-8); max-width: 52ch;
}
.contact-cards { display: flex; flex-direction: column; gap: var(--space-3); }
.contact-card {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  column-gap: var(--space-4); align-items: center;
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); padding: var(--space-5);
  text-decoration: none; color: var(--color-text);
  transition: box-shadow var(--transition-interactive), border-color var(--transition-interactive), transform var(--transition-interactive);
}
.contact-card svg { grid-row: 1 / 3; color: var(--color-primary); }
.contact-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-md); transform: translateX(4px); }
.contact-label { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }
.contact-value { font-size: var(--text-sm); color: var(--color-primary); font-weight: 500; }

/* ---- FOOTER ---- */
.site-footer { border-top: 1px solid var(--color-divider); padding-block: var(--space-8); }
.footer-inner { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; font-size: var(--text-xs); color: var(--color-text-faint); }
.footer-dot { color: var(--color-divider); }

/* ---- SCROLL REVEAL ---- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .about-grid { grid-template-columns: 1fr; }
  .about-visual { display: none; }
  .projects-grid { grid-template-columns: 1fr; }
  .project-featured, .project-wide { grid-column: span 1; }
  .contact-cards { gap: var(--space-2); }
  .footer-inner { justify-content: center; }
}
@media (max-width: 480px) {
  .hero-actions { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
}
