/* ==========================================
   1. TOKENS & SYSTEM VARIABLES
   ========================================== */
:root {
  interpolate-size: allow-keywords;
  --clr-bg: #f4f7f3;
  --clr-surface: #ffffff;
  --clr-text: #182419;
  --clr-muted: #415848;
  --clr-primary: #0f8f67;
  --clr-accent: #ffffff;

  --clr-border: color-mix(in srgb, var(--clr-text) 14%, transparent);
  --clr-primary-emphasis: color-mix(in srgb, var(--clr-primary) 72%, var(--clr-text));
  --clr-primary-soft: color-mix(in srgb, var(--clr-primary) 14%, transparent);
  --clr-primary-soft-strong: color-mix(in srgb, var(--clr-primary) 22%, transparent);

  --surface-94: color-mix(in srgb, var(--clr-surface) 94%, transparent);
  --surface-92: color-mix(in srgb, var(--clr-surface) 92%, transparent);
  --surface-90: color-mix(in srgb, var(--clr-surface) 90%, transparent);
  --surface-88: color-mix(in srgb, var(--clr-surface) 88%, transparent);
  --surface-86: color-mix(in srgb, var(--clr-surface) 86%, transparent);
  --surface-78: color-mix(in srgb, var(--clr-surface) 78%, transparent);

  --surface-with-bg-12: color-mix(in srgb, var(--clr-surface) 88%, var(--clr-bg) 12%);
  --surface-with-bg-8: color-mix(in srgb, var(--clr-surface) 92%, var(--bg) 8%);
  --surface-with-bg-20: color-mix(in srgb, var(--clr-surface) 80%, var(--clr-bg) 20%);

  --border-primary-soft: color-mix(in srgb, var(--clr-primary) 36%, var(--clr-border));
  --border-primary-strong: color-mix(in srgb, var(--clr-primary) 62%, var(--clr-border));

  --shadow-link: 0 0 4px color-mix(in srgb, var(--clr-primary) 50%, transparent);
  --shadow-soft: 0 18px 50px -32px color-mix(in srgb, var(--clr-text) 30%, transparent);

  --ff-base: "Inter", system-ui, -apple-system, sans-serif;
  --ff-heading: "Plus Jakarta Sans", system-ui, sans-serif;
  --ff-reading: "Inter", system-ui, sans-serif;
  --ff-mono: "JetBrains Mono", monospace;

  --fs-base: 1.06rem;
  --radius-pill: 999px;
  --content-boundary: 83ch;
}

[data-theme="dark"] {
  --clr-bg: #081311;
  --clr-surface: #10211c;
  --clr-text: #e7f8ef;
  --clr-muted: #9ac5b0;
  --clr-primary: #6af0c0;
  --clr-accent: #ffffff;
  --clr-border: color-mix(in srgb, var(--clr-text) 17%, transparent);
  --shadow-soft: 0 22px 65px -35px rgba(0, 0, 0, 0.7);
}

/* ==========================================
   2. BASE HTML RULES
   ========================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 8% -8%, color-mix(in srgb, var(--clr-accent) 19%, transparent), transparent 56%),
    radial-gradient(900px 500px at 92% 4%, color-mix(in srgb, var(--clr-primary) 22%, transparent), transparent 50%),
    linear-gradient(170deg, var(--clr-bg), color-mix(in srgb, var(--clr-bg) 88%, #ffffff 12%));
  color: var(--clr-text);
  font-family: var(--ff-base);
  font-size: var(--fs-base);
  line-height: 1.6;
  transition: background-color 0.4s ease, color 0.4s ease;
}

.container {
  width: min(100% - 2rem, 920px);
  margin-inline: auto;
  padding-bottom: 3rem;
}

main {
  display: grid;
  gap: 2rem;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  color: var(--clr-text);
  line-height: 1.2;
  font-family: var(--ff-heading);
  letter-spacing: -0.02em;
  font-weight: 800;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

h2 {
  font-size: clamp(1.4rem, 3.2vw, 2rem);
  margin-bottom: 0.5rem;
}

p {
  color: var(--clr-muted);
  font-family: var(--ff-reading);
}

a {
  color: var(--clr-primary);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--clr-primary-emphasis);
  outline-offset: 3px;
}

footer {
  margin-top: 4rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--clr-muted);
}

/* ==========================================
   3. LAYOUT COMPONENT HOOKS
   ========================================== */
.site-header {
  margin-block: 1.5rem 3.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-nav {
  position: relative;
  anchor-scope: --nav-link;
  padding-block-end: 0.45rem;
}

.nav-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 0.45rem;
  anchor-name: --nav-link;
}

.nav-list li {
  position: relative;
  z-index: 1;
}

.nav-list a {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.95rem;
  border-radius: 0.65rem;
  color: var(--clr-text);
  text-decoration: none;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  transition: color 0.3s ease;
}

.nav-list a:hover,
.nav-list a:focus-visible,
.nav-list a[aria-current="page"] {
  color: var(--clr-primary-emphasis);
  anchor-name: --nav-link;
}

.site-nav::after {
  content: "";
  position: absolute;
  z-index: 0;
  border-radius: 0.65rem;
  opacity: 1;
  background-color: var(--clr-primary-soft);
  position-anchor: --nav-link;
  inset-block-start: anchor(end);
  inset-inline-start: anchor(start);
  inset-inline-end: anchor(end);
  inset-block-end: anchor(end);
  block-size: 1px;
  transition: background-color 0.4s, block-size 0.4s, opacity 0.4s, inset 0.4s, inset-inline 0.4s 0.5s;
}

.site-nav:has(a:hover, a:focus-visible, a[aria-current="page"])::after {
  block-size: auto;
  inset-block-start: anchor(start);
  background-color: var(--clr-primary-soft-strong);
  transition: background-color 0.4s, block-size 0.4s 0.4s, opacity 0.4s, inset 0.4s, inset-block 0.4s 0.5s;
}

@supports not (position-anchor: --nav-link) {
  .site-nav::after {
    display: none;
  }

  .nav-list a:hover,
  .nav-list a:focus-visible,
  .nav-list a[aria-current="page"] {
    background-color: var(--clr-primary-soft);
  }
}

.theme-label {
  padding-left: 12px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 0.5rem 0.9rem;
  font-family: var(--ff-base);
  font-weight: 600;
  color: var(--clr-text);
  background: color-mix(in srgb, var(--clr-surface) 88%, transparent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--clr-primary) 35%, transparent);
  cursor: pointer;
  transition: transform 0.25s ease, background-color 0.35s ease;
}

.theme-dot {
  inline-size: 1rem;
  block-size: 1rem;
  border-radius: 50%;
  background: var(--clr-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--clr-text) 12%, transparent);
  transition: transform 0.35s ease, background-color 0.35s ease;
}

[data-theme="dark"] .theme-dot {
  transform: translateX(0.8rem);
  background: var(--clr-accent);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  transform: translateY(-1px);
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--clr-primary) 80%, var(--clr-text));
}

/* ==========================================
   4. COMPONENT ARCHITECTURES
   ========================================== */
.contact-links {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-block: 0.5rem;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.58rem 1.2rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-primary-soft);
  background: var(--surface-90);
  color: var(--clr-text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 700;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.contact-link:hover,
.contact-link:focus-visible {
  transform: translateY(-1px);
  border-color: var(--border-primary-strong);
  color: var(--clr-primary);
  outline: none;
}

.contact-icon {
  inline-size: 1.1rem;
  block-size: 1.1rem;
}

/* Dynamic Direction Button Architecture */
.cool-button {
  position: relative;
  margin-top: 0.75rem;
  display: inline-grid;
  place-items: center;
  min-inline-size: 14rem;
  padding: 0.9rem 1.6rem;
  text-decoration: none;
  color: var(--clr-text);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--clr-primary) 52%, transparent);
  background-color: var(--surface-86);
  overflow: clip;
  anchor-scope: --active-cell;
  isolation: isolate;
}

.btn-label {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.btn-cells {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
}

.btn-cells span {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  position: relative;
}

.btn-cells span:hover {
  anchor-name: --active-cell;
}

.btn-cells:not(:hover) span {
  transition: anchor-name 0ms;
  transition-delay: 0.4s;
  transition-behavior: allow-discrete;
}

.btn-cells::before {
  --size: 2.8rem;
  content: "";
  position: absolute;
  position-anchor: --active-cell;
  left: anchor(left);
  bottom: anchor(top);
  inline-size: var(--size);
  block-size: var(--size);
  border-radius: 50%;
  background: color-mix(in srgb, var(--clr-primary) 46%, var(--accent, #fff) 16%);
  transition: all 0.9s ease, inset 0.1s;
  transform: scale(0);
  opacity: 0.5;
}

.btn-cells:hover::before {
  opacity: 1;
  transform: scale(40);
}

.btn-cells:has(> :nth-child(11):hover)::before {
  bottom: calc(anchor(center) - var(--size) / 2);
  left: calc(anchor(center) - var(--size));
}

.btn-cells:has(> :nth-child(20):hover)::before {
  bottom: calc(anchor(center) - var(--size) / 2);
  right: calc(anchor(center) - var(--size));
}

.btn-cells:has(> :nth-child(n + 21):hover)::before {
  bottom: calc(anchor(bottom) - var(--size));
}

.btn-cells:not(:hover)::before {
  transition: opacity 0.4s, inset 50ms, transform 0.4s;
  transition-delay: 0.4s, 0.4s, 0s;
}

/* ==========================================
   5. PAGE LAYOUTS & OVERRIDES
   ========================================== */

/* Shared Subpage Headers */
.about-header,
.exp-header,
.showcase-header {
  text-align: center;
  padding: 4rem 1rem 2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.about-header h1,
.exp-header h1,
.showcase-header h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
}

.exp-header p,
.showcase-header p {
  font-size: 1.2rem;
  color: var(--clr-muted);
}

.exp-header p {
  max-width: 55ch;
}

.showcase-header p {
  max-width: 50ch;
}

/* Button Wrappers */
.btn-container {
  margin-top: 1rem;
}

/* Home Page Specific (Stark Hero) */
.stark-hero {
  text-align: center;
  padding: 5rem 1rem;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.stark-hero h1 {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 800;
  max-width: 15ch;
  margin-inline: auto;
}

.stark-hero p.tagline {
  font-size: 1.35rem;
  color: var(--clr-muted);
  max-width: 45ch;
  margin-inline: auto;
  text-align: center;
}

.stark-hero .contact-links {
  justify-content: center;
  width: 100%;
  margin-top: 1.5rem;
}

/* About Page Specific (Hybrid Layout) */
.hybrid-container {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 4rem;
  align-items: start;
  max-width: var(--content-boundary);
  margin: 2rem auto;
}

.hybrid-copy {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  font-size: 1.1rem;
}

.hybrid-copy .cool-button {
  margin: 0;
  min-inline-size: auto;
  width: fit-content;
  padding-inline: 2.5rem;
}

.hybrid-media {
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  background: var(--surface-92);
  border: 1px solid var(--clr-border);
  aspect-ratio: 1 / 1;
  transition: all 0.3s ease;
}

.hybrid-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.focus-section {
  max-width: var(--content-boundary);
  margin: 4rem auto 2rem auto;
  border-top: 1px solid var(--clr-border);
  padding-top: 3rem;
}

.focus-section h2 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 2rem;
}

.focus-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 1.5rem;
}

.focus-card h3 {
  font-size: 1.2rem;
  color: var(--clr-primary);
  margin-bottom: 0.5rem;
}

.focus-card p {
  font-size: 0.95rem;
}

/* Experience Page Specific (Timeline) */
.timeline-container {
  position: relative;
  max-width: var(--content-boundary);
  margin: 3rem auto;
  padding-inline: 1rem;
}

.timeline-container::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--clr-border);
  transform: translateX(-50%);
}

.timeline-item {
  position: relative;
  width: 50%;
  margin-bottom: 4rem;
  padding-inline: 2rem;
}

.timeline-item:nth-child(odd) {
  left: 0;
  text-align: right;
}

.timeline-item:nth-child(even) {
  left: 50%;
  text-align: left;
}

.timeline-dot-marker {
  position: absolute;
  top: 0.35rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--clr-primary);
}

.timeline-item:nth-child(odd) .timeline-dot-marker {
  right: -4.5px;
}

.timeline-item:nth-child(even) .timeline-dot-marker {
  left: -4.5px;
}

.timeline-item .date {
  font-weight: 600;
  letter-spacing: 0.05em;
  font-size: 0.85rem;
  color: var(--clr-muted);
}

.exp-role-title {
  font-size: 1.4rem;
  color: var(--clr-text);
  font-weight: 700;
  margin-top: 0.25rem;
}

.exp-company {
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-primary);
  margin-bottom: 0.5rem;
}

/* Projects Page Specific (Showcase Stack) */
.showcase-stack {
  display: flex;
  flex-direction: column;
  gap: 6rem;
  margin-top: 3rem;
  max-width: var(--content-boundary);
  margin-inline: auto;
}

.showcase-item {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 3rem;
  align-items: center;
}

.showcase-item:nth-child(even) {
  direction: rtl;
}

.showcase-item:nth-child(even) .showcase-text {
  direction: ltr;
}

.showcase-text {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.showcase-text h3 {
  font-size: 1.6rem;
}

.showcase-text a {
  margin-top: 0.5rem;
  font-weight: 600;
}

.showcase-media {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  background: var(--surface-92);
  border: 1px solid var(--clr-border);
  aspect-ratio: 16 / 10;
}

.showcase-media img,
.showcase-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==========================================
   6. SPECIAL EFFECTS & TRANSITIONS
   ========================================== */
#mouse-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.5s ease;
}

[data-theme="dark"] #mouse-overlay {
  opacity: 1;
}

[data-theme="dark"][data-glow="off"] #mouse-overlay {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {

  .nav-list a,
  .site-nav::after,
  .theme-toggle,
  .theme-dot,
  .cool-button,
  .contact-link,
  #mouse-overlay {
    transition: none !important;
  }
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

.theme-transitioning {
  overflow: hidden;
}

/* ==========================================
   7. RESPONSIVE LAYER OVERRIDES
   ========================================== */

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--clr-text);
  text-decoration: none;
}

#nav-toggle,
.mobile-menu-btn,
.mobile-nav {
  display: none;
}

/* Global Container for Sun/Moon SVGs (hidden on desktop view) */
.theme-icon-container {
  display: none;
}

/* Typewriter Effect Styles */
.typewriter-cursor {
    display: inline-block;
    color: currentColor; /* Matches the eyebrow text color */
    margin-left: 2px;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ==========================================
   6. RESPONSIVE LAYER OVERRIDES - MOBILE OVERHAUL
   ========================================== */
/* Hide theme SVGs on desktop screen sizes */
.theme-svgs {
  display: none;
}
/* Add this right above your media query to handle desktop visibility */
.theme-svgs {
  display: none;
}

/* ==========================================
   7. RESPONSIVE LAYER OVERRIDES
   ========================================== */
@media (max-width: 768px) {
  
  /* --- A. HEADER & 2X2 NAVIGATION MATRIX --- */
  #nav-toggle,
  .mobile-menu-btn,
  .desktop-nav {
    display: none !important;
  }

  .site-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    width: 100%;
    margin-block: 1rem 2.5rem;
    padding-top: 0.5rem;
  }

  .logo {
    display: block !important;
    text-align: center !important;
    margin: 0 auto 1.2rem auto !important;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  /* Round Sun/Moon Icon Toggle */
  .theme-toggle {
    display: flex !important;
    position: absolute !important;
    top: 0.2rem;
    right: 0;
    width: 40px;
    height: 40px;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center !important;
    align-items: center !important;
    background: color-mix(in srgb, var(--clr-surface) 90%, transparent) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    transform: none !important;
  }

  .theme-toggle .theme-dot,
  .theme-toggle .theme-label {
    display: none !important;
  }

  .theme-svgs {
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: var(--clr-text);
  }

  [data-theme="light"] .theme-svgs .sun-icon { display: none !important; }
  [data-theme="light"] .theme-svgs .moon-icon { display: block !important; }
  [data-theme="dark"] .theme-svgs .sun-icon { display: block !important; }
  [data-theme="dark"] .theme-svgs .moon-icon { display: none !important; }

  /* 2x2 Matrix with Underline */
  .mobile-nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(110px, max-content)) !important;
    gap: 0.5rem 2rem !important;
    justify-content: center !important;
    align-items: center !important;
    position: static !important;
    width: max-content !important;
    margin: 0 auto !important;
    padding-bottom: 0.75rem !important;
    border-bottom: 2px solid var(--clr-primary-soft-strong) !important;
    pointer-events: auto !important;
  }

  .mobile-nav a {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.45rem 0.95rem !important;
    color: var(--clr-text) !important;
    text-decoration: none !important;
    font-size: 0.88rem !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0.65rem !important;
    opacity: 1 !important;
    transform: none !important;
    transition: color 0.3s ease, background-color 0.3s ease;
  }

  .mobile-nav a:hover,
  .mobile-nav a:focus-visible,
  .mobile-nav a[aria-current="page"] {
    color: var(--clr-primary-emphasis) !important;
    background-color: var(--clr-primary-soft) !important;
  }

  .mobile-nav a.is-clicking {
    animation: mobileLinkFeedback 0.3s ease-in-out forwards !important;
  }

  /* --- B. RESTORED SUBPAGE CONTENT OVERRIDES --- */
  
  /* About Layout[cite: 10] */
  .hybrid-container {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .hybrid-copy {
    text-align: center;
  }

  .hybrid-media {
    grid-row: 1;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 2px solid var(--clr-primary);
    margin-inline: auto;
  }

  .hybrid-copy .cool-button {
    margin-inline: auto;
  }

  .focus-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .focus-card {
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--clr-border);
  }

  .focus-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  /* Experience Timeline[cite: 10] */
  .timeline-container::before {
    left: 1rem;
  }

  .timeline-item {
    width: 100%;
    left: 0 !important;
    text-align: left !important;
    padding-left: 2.5rem;
    padding-right: 0;
  }

  .timeline-dot-marker {
    left: calc(1rem - 4.5px) !important;
    right: auto !important;
  }

  /* Projects Showcase[cite: 10] */
  .showcase-item,
  .showcase-item:nth-child(even) {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    direction: ltr;
  }
}

/* Nav Link Interaction Animation Sequence */
@keyframes mobileLinkFeedback {
  0% { transform: scale(1); background-color: var(--clr-primary-soft-strong); }
  50% { transform: scale(0.94); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}