/*  1. DESIGN TOKENS */
:root {
  /* — Surfaces & backgrounds — */
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface2: #eeece7;
  --surface2-translucent: rgba(238, 236, 231, 0.8);
  --surface-glass: rgba(255, 255, 255, 0.7);
  --nav-bg: rgba(246, 245, 241, 0.93);

  /* — Borders — */
  --border: #e4e1da;
  --border-h: #c4c1ba;

  /* — Text — */
  --text-s: #171714;
  --muted: #9a9890;
  --muted-2: #b5b3ae;

  /* — Accent — */
  --accent: #171714;
  --accent-i: #f6f5f1;

  /* — Shape — */
  --radius: 12px;
  --radius-sm: 6px;
  --radius-xl: 999px;

  /* — Shadows — */
  --sh-sm: none;
  --sh-md: none;

  /* — Layout — */
  --container: 1200px;
  --col-body: 680px;
  --col-aside: 188px;
  --col-gap: 4rem;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);

  /* — Transitions — */
  --t-fast: 150ms ease;
  --t-base: 250ms ease;
  --t-slow: 400ms ease;

  /* — Type scale — */
  --text-xs: 0.6875rem;
  /* 11px */
  --text-sm: 0.8125rem;
  /* 13px */
  --text-md: 0.9375rem;
  /* 15px */
  --text-base: 1rem;
  /* 16px */
  --text-lg: 1.125rem;
  /* 18px */
  --text-xl: 1.25rem;
  /* 20px */
  --text-2xl: 1.5rem;
  /* 24px */
  --text-3xl: 2rem;
  /* 32px */
  --text-4xl: 2.75rem;
  /* 44px */
  --text-5xl: 3.75rem;
  /* 60px */
  --text-6xl: 5rem;
  /* 80px */

  /* — Font families — */
  --font-serif: 'Playfair Display', 'Playfair Display Fallback', Georgia, serif;
  --font-serif-alt: 'Lora', serif;
  --font-sans: 'Inter', 'Inter Fallback', system-ui, sans-serif;
}

/* — Dark mode overrides — */
html.dark {
  --bg: #111110;
  --surface: #1a1a18;
  --surface2: #222220;
  --surface2-translucent: rgba(34, 34, 32, 0.8);
  --surface-glass: rgba(26, 26, 24, 0.7);
  --nav-bg: rgba(17, 17, 16, 0.93);

  --border: #2c2c29;
  --border-h: #3d3d3a;

  --text-s: #f0ede8;
  --muted: #6b6a68;
  --muted-2: #4a4a48;

  --accent: #f0ede8;
  --accent-i: #111110;

  --sh-sm: none;
  --sh-md: none;
}


/*  2. RESET & BOX MODEL */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-s);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1, 'liga' 1;
  min-height: 100dvh;
  width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}

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

a {
  color: inherit;
  text-decoration: none;
  overflow-wrap: break-word;
}

ul,
ol {
  list-style: none;
}

li {
  overflow-wrap: break-word;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

input,
textarea {
  font: inherit;
}


/*  3. TYPOGRAPHY SYSTEM */

/* Headings — Playfair Display */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--text-s);
  overflow-wrap: break-word;
  word-wrap: break-word;
  -ms-word-break: break-all;
  word-break: break-word;
}

h1 {
  font-size: clamp(var(--text-4xl), 6vw, var(--text-6xl));
}

h2 {
  font-size: clamp(var(--text-3xl), 4vw, var(--text-4xl));
}

h3 {
  font-size: clamp(var(--text-xl), 3vw, var(--text-2xl));
}

h4 {
  font-size: var(--text-xl);
}

/* Italic — serif-native */
em {
  font-style: italic;
  font-family: var(--font-serif);
}

/* Body copy */
p {
  color: var(--text-s);
  overflow-wrap: break-word;
}


/*  4. GLOBAL UTILITIES */

.glass {
  background-color: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
}

/* Layout container */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Generic section spacing */
.section {
  padding-block: clamp(5rem, 10vw, 8rem);
}

/* Eyebrow label */
.eyebrow {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

/* — Branding (Global) — */
.brand {
  display: inline-flex;
  align-items: baseline;
  text-decoration: none;
  line-height: 1;
  transition: opacity var(--t-fast);
}

.brand:hover {
  opacity: 0.75;
}

.brand__name {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-s);
}

/* — Common Section Header Typography — */

.section__title {
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 3.5vw, 2.5rem);
  font-weight: 500;
  line-height: 1.15;
  color: var(--text-s);
  max-width: 22ch;
}

.section__title .text-muted {
  display: block;
  font-family: var(--font-serif-alt);
  font-style: italic;
  font-size: 0.9em;
  color: var(--muted);
}



.section__description {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--muted);
  max-width: 52ch;
  margin-top: 1.5rem;
}

/* Generic section head spacing */
.section-head {
  margin-bottom: 2.5rem;
}

/* Muted text helper */
.text-muted {
  color: var(--muted);
}

/* Spacing utilities */
.mt-0 {
  margin-top: 0 !important;
}

/* Visually hidden (a11y) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* Section divider — reusable horizontal rule */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  max-width: var(--container);
  margin: 0 auto;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.5rem;
  align-items: start;
}

@media (max-width: 820px) {
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}


/*  5. LANGUAGE SWITCHER */
.nav__lang {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 0.5rem;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.nav__lang-link {
  color: inherit;
  text-decoration: none;
  transition: color var(--t-fast);
  opacity: 0.6;
}

.nav__lang-link:hover {
  color: var(--text-s);
}

.nav__lang-link.is-active {
  color: var(--text-s);
  opacity: 1;
  pointer-events: none;
}

.nav__lang-sep {
  opacity: 0.3;
  font-weight: 300;
}


/*  6. BUTTON PRIMITIVES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.375rem;
  border-radius: var(--radius-xl);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--t-fast),
    color var(--t-fast),
    border-color var(--t-fast),
    box-shadow var(--t-fast),
    opacity var(--t-fast),
    transform var(--t-fast);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background-color: var(--accent);
  color: var(--accent-i);
  border: 1px solid var(--accent);
  opacity: 0.85;
}

.btn--ghost {
  background-color: transparent;
  color: var(--text-s);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  border-color: var(--border-h);
  background-color: var(--surface2);
}

.btn--compact {
  height: 32px;
  padding-block: 0;
  padding-inline: 1.125rem;
  font-size: var(--text-sm);
  line-height: 1;
}

.btn--compact svg {
  width: 13px !important;
  height: 13px !important;
}


/*  6. FOCUS & SELECTION */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background-color: var(--accent);
  color: var(--accent-i);
}


/*  7. SCROLLBAR */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border-h);
  border-radius: 999px;
}


/*  8. SKILLS LIST */
.skills-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-s);
  line-height: 1.4;
}

.skill-tag {
  font-weight: 500;
  color: var(--text-s);
}

.skill-sep {
  color: var(--muted-2);
  font-weight: 300;
  user-select: none;
}

@media (max-width: 640px) {
  .skills-list {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .skill-sep {
    display: none;
  }
}


/*  9. REVEAL ANIMATIONS */
@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal {
  opacity: 0;
}

.reveal--active {
  animation: revealUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Stagger delays for children */
.reveal-stagger > * {
  opacity: 0;
}

.reveal-stagger.reveal--active > * {
  animation: revealUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.reveal-stagger.reveal--active > *:nth-child(1) { animation-delay: 0.1s; }
.reveal-stagger.reveal--active > *:nth-child(2) { animation-delay: 0.2s; }
.reveal-stagger.reveal--active > *:nth-child(3) { animation-delay: 0.3s; }
.reveal-stagger.reveal--active > *:nth-child(4) { animation-delay: 0.4s; }
.reveal-stagger.reveal--active > *:nth-child(5) { animation-delay: 0.5s; }

/*  10. UX ENHANCEMENTS */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--accent);
  color: var(--accent-i);
  padding: 0.75rem 1.5rem;
  z-index: 9999;
  font-family: var(--font-sans);
  font-weight: 500;
  transition: top var(--t-fast);
}

.skip-link:focus {
  top: 1rem;
}

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  background-color: var(--surface);
  color: var(--text-s);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transition: 
    opacity var(--t-base),
    visibility var(--t-base),
    transform var(--t-base),
    border-color var(--t-fast);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  border-color: var(--border-h);
  transform: translateY(-2px);
}

/*  11. SHARED CAROUSEL STYLES */
.carousel-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.carousel-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-s);
  cursor: pointer;
  transition: all var(--t-base);
  padding: 0;
}

.carousel-btn:hover:not(:disabled) {
  border-color: var(--border-h);
  background-color: var(--surface2);
  transform: translateY(-2px);
}

.carousel-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.carousel-wrapper {
  margin-inline: calc(var(--gutter) * -1);
  padding-inline: var(--gutter);
  position: relative;
  overflow: visible;
}

.carousel-grid {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  gap: 2rem;
  padding: 1rem 0 3rem;
  margin-top: 0;
  -ms-overflow-style: none; /* Hide scrollbar */
  scrollbar-width: none;
}

.carousel-grid::-webkit-scrollbar {
  display: none;
}

.carousel-grid > * {
  flex: 0 0 calc((100% - 4rem) / 3);
  scroll-snap-align: start;
}

@media (max-width: 640px) {
  .carousel-grid > * {
    flex: 0 0 calc(100vw - (var(--gutter) * 2));
  }
}
