/*
 * style.css
 * Layout + component styles.
 * Organised in the same order as the HTML: global → header → sections → footer.
 * Every value references a token from tokens.css.
 *
 * Table of contents
 * ─────────────────
 * 1.  Layout helpers  (.container, .section)
 * 2.  Skip link
 * 3.  Header & nav
 * 4.  Hamburger button
 * 5.  Theme toggle button
 * 6.  Hero section
 * 7.  Buttons  (.btn)
 * 8.  About section
 * 9.  Skills section
 * 10. Projects section  (.project-card)
 * 11. Contact section
 * 12. Footer
 * 13. Scroll-reveal animation
 * 14. Responsive overrides
 */

/* ═══════════════════════════════════════════════════════════════
   1. LAYOUT HELPERS
   ═══════════════════════════════════════════════════════════════ */

/*
 * .container           — centred content wrapper with inline padding.
 * .container--narrow   — prose / single-column sections.
 */
.container {
  width: 100%;
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--narrow {
  max-width: var(--content-narrow);
}

/*
 * .section             — base block with fluid vertical rhythm.
 * .section--offset     — alternating section background (replaces <hr>).
 */
.section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-32));
}

.section--offset {
  background-color: var(--color-surface);
}

/* Shared h2 across non-hero sections */
.section-heading {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: var(--space-10);
}

/* ═══════════════════════════════════════════════════════════════
   2. SKIP LINK
   ═══════════════════════════════════════════════════════════════ */

.skip-link {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════
   3. HEADER & NAV
   ═══════════════════════════════════════════════════════════════ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background-color: color-mix(in oklab, var(--color-bg) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.07);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
  gap: var(--space-8);
}

/* ── Logo ── */
.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  flex-shrink: 0;
}

.site-logo svg {
  flex-shrink: 0;
}

.site-logo-text {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ── Primary nav ── */
.primary-nav ul {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
}

.primary-nav a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  padding-block: var(--space-1);
  border-bottom: 1px solid transparent;
}

.primary-nav a:hover,
.primary-nav a:focus-visible {
  color: var(--color-text);
  border-bottom-color: var(--color-primary);
}

/* ── Right controls ── */
.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   4. HAMBURGER BUTTON
   Hidden on desktop; shown at < 640px via responsive block below.
   ═══════════════════════════════════════════════════════════════ */

.nav-hamburger {
  display: none; /* hidden by default; shown in the mobile breakpoint */
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}

.nav-hamburger:hover {
  background-color: var(--color-surface-offset);
  color: var(--color-text);
}

/* ═══════════════════════════════════════════════════════════════
   5. THEME TOGGLE BUTTON
   ═══════════════════════════════════════════════════════════════ */

[data-theme-toggle] {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}

[data-theme-toggle]:hover {
  background-color: var(--color-surface-offset);
  color: var(--color-text);
}

/* ═══════════════════════════════════════════════════════════════
   6. HERO SECTION
   ═══════════════════════════════════════════════════════════════ */

.section--hero {
  display: flex;
  align-items: center;
  min-height: calc(100dvh - var(--header-height));
  padding-block: clamp(var(--space-16), 10vw, var(--space-32));
}

.hero-eyebrow {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-4);
  max-width: none;
}

.hero-heading {
  font-size: var(--text-hero);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--color-text);
  margin-bottom: var(--space-6);
  max-width: 16ch;
}

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

.hero-sub {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-10);
  max-width: 48ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ═══════════════════════════════════════════════════════════════
   7. BUTTONS
   Base styles shared; variants layer on top.
   ═══════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  min-height: 44px; /* touch target */
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.btn-primary:active {
  background-color: var(--color-primary-active);
  border-color: var(--color-primary-active);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text-muted);
  border-color: oklch(from var(--color-text) l c h / 0.15);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  color: var(--color-text);
  border-color: oklch(from var(--color-text) l c h / 0.3);
  background-color: var(--color-surface-offset);
}

.btn-ghost:active {
  background-color: var(--color-surface-dynamic);
}

/* ═══════════════════════════════════════════════════════════════
   8. ABOUT SECTION
   ═══════════════════════════════════════════════════════════════ */

.about-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.about-body p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.75;
}

/* ═══════════════════════════════════════════════════════════════
   9. SKILLS SECTION
   ═══════════════════════════════════════════════════════════════ */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: var(--space-8);
}

.skill-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.skill-group-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
}

.skill-list li {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  padding-block: var(--space-1);
  border-bottom: 1px solid var(--color-divider);
  max-width: none;
}

.skill-list li:last-child {
  border-bottom: none;
}

/* ═══════════════════════════════════════════════════════════════
   10. PROJECTS SECTION
   ═══════════════════════════════════════════════════════════════ */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: var(--space-6);
}

/*
 * No colored side border. Elevation via surface background + alpha border
 * + hover shadow. Inner radius = outer radius − padding.
 */
.project-card {
  display: flex;
  flex-direction: column;
  background-color: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.08);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition:
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}

.project-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.project-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
}

.project-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}

.project-description {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.65;
  flex: 1;
}

.project-stack {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  max-width: none;
}

.stack-label {
  font-weight: 600;
  color: var(--color-text-muted);
}

.project-card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  /* inner radius = --radius-xl (1rem) − --space-6 (1.5rem) → 0, so no rounding needed */
  border-top: 1px solid oklch(from var(--color-text) l c h / 0.06);
  background-color: var(--color-surface-offset);
}

.project-link {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
}

.project-link:hover,
.project-link:focus-visible {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════
   11. CONTACT SECTION
   ═══════════════════════════════════════════════════════════════ */

.contact-list {
  display: flex;
  flex-direction: column;
  list-style: none;
}

.contact-list li {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}

.contact-list li:last-child {
  border-bottom: none;
}

.contact-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  min-width: 5.5rem;
  flex-shrink: 0;
}

.contact-list a {
  font-size: var(--text-base);
  color: var(--color-text-muted);
}

.contact-list a:hover,
.contact-list a:focus-visible {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════
   12. FOOTER
   ═══════════════════════════════════════════════════════════════ */

.site-footer {
  padding-block: var(--space-8);
  border-top: 1px solid var(--color-divider);
  background-color: var(--color-surface);
}

/* ═══════════════════════════════════════════════════════════════
   13. SCROLL-REVEAL ANIMATION
   ═══════════════════════════════════════════════════════════════ */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════
   14. RESPONSIVE OVERRIDES
   ═══════════════════════════════════════════════════════════════ */

/* Tablet breakpoint */
@media (max-width: 768px) {
  .header-inner {
    padding-inline: var(--space-4);
    gap: var(--space-4);
  }

  .site-logo-text {
    font-size: var(--text-xs);
  }

  .primary-nav ul {
    gap: var(--space-4);
  }

  .primary-nav a {
    font-size: var(--text-xs);
  }
}

/* Mobile breakpoint — hamburger menu */
@media (max-width: 640px) {
  html,
  body {
    overflow-x: clip;
  }

  /* Remove backdrop filter to avoid stacking for primary-nav */
  .site-header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background-color: var(--color-bg);
  }

  .nav-hamburger {
    display: flex;
  }

  .primary-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: color-mix(in oklab, var(--color-bg) 90%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    /* Subtle bottom border for definition */
    border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.07);
    padding: var(--space-6);
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    z-index: 99;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }

  .primary-nav.is-open {
    transform: translateX(0);
  }

  .primary-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .primary-nav li {
    width: 100%;
  }

  .primary-nav a {
    display: block;
    padding-block: var(--space-4);
    font-size: var(--text-lg);
    font-weight: 600;
    border-bottom: 1px solid var(--color-divider);
  }

  .primary-nav a:hover,
  .primary-nav a:focus-visible {
    border-bottom-color: var(--color-divider);
    color: var(--color-primary);
  }

  .hero-heading {
    max-width: none;
  }

  .hero-sub {
    max-width: none;
  }

  .contact-list li {
    flex-direction: column;
    gap: var(--space-2);
  }

  .contact-label {
    min-width: auto;
  }
}
