/* ==========================================================================
   Fonts
   ========================================================================== */

@font-face {
  font-family: 'Titillium Web';
  src: url('../fonts/Titillium_Web/TitilliumWeb-Light.woff2') format('woff2');
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: 'Titillium Web';
  src: url('../fonts/Titillium_Web/TitilliumWeb-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Titillium Web';
  src: url('../fonts/Titillium_Web/TitilliumWeb-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: 'Titillium Web';
  src: url('../fonts/Titillium_Web/TitilliumWeb-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

/* ==========================================================================
   Tokens
   light-dark(<light>, <dark>) follows color-scheme, which the toggle sets
   through [data-theme]; with no choice saved it follows the OS.
   ========================================================================== */

:root {
  color-scheme: light dark;

  --bg: light-dark(#f7f6f3, #121214);
  --surface: light-dark(#ffffff, #1a1a1d);
  --surface-2: light-dark(#efeee9, #232327);
  --text: light-dark(#17171a, #f1f1f3);
  --muted: light-dark(#5d5d66, #a0a0aa);
  --border: light-dark(rgb(0 0 0 / 0.08), rgb(255 255 255 / 0.08));
  /* Green is the brand color */
  --accent: light-dark(#15803d, #4ade80);
  --accent-contrast: light-dark(#ffffff, #052e16);
  --shadow-color: light-dark(rgb(0 0 0 / 0.12), rgb(0 0 0 / 0.6));
  --grad: linear-gradient(90deg,
      light-dark(#c2410c, #ff6b6b),
      light-dark(#b45309, #ffa94d) 25%,
      light-dark(#a16207, #ffe066) 45%,
      light-dark(#15803d, #69db7c) 65%,
      light-dark(#2f4fb0, #74a8ff) 85%,
      light-dark(#7e22ce, #c084fc));

  --grad-green: linear-gradient(90deg, light-dark(#15803d, #4ade80), light-dark(#0f766e, #2dd4bf));

  /* Pride rainbow for the hairline at the top of the page */
  --rainbow: linear-gradient(90deg, #e40303, #ff8c00, #ffed00, #008026, #24408e, #732982);

  --font: 'Titillium Web', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 1.25rem;
  --pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-height: 4rem;
}

:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 300;
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color 300ms ease, color 300ms ease;
}

h1, h2, h3, p {
  margin: 0;
}

h1, h2, h3 {
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

strong {
  font-weight: 600;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}

.container {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.skip-link {
  position: absolute;
  top: -3rem;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--accent-contrast);
  transition: top 150ms;

  &:focus { top: 1rem; }
}

/* ==========================================================================
   Shared components
   ========================================================================== */

.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.gradient-text--green {
  background: var(--grad-green);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.status-dot {
  display: inline-block;
  flex-shrink: 0;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgb(34 197 94 / 0.6); }
  70%, 100% { box-shadow: 0 0 0 0.5rem rgb(34 197 94 / 0); }
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.7em 1.4em;
  border: 1px solid transparent;
  border-radius: var(--pill);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 200ms var(--ease), border-color 200ms, color 200ms;

  &:hover { transform: translateY(-2px); }
}

.btn--primary {
  background: var(--text);
  color: var(--bg);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--border);

  &:hover {
    border-color: var(--accent);
    color: var(--accent);
  }
}

/* Cards */

.card {
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 10px 28px -14px var(--shadow-color);
  transition: background-color 300ms ease, border-color 300ms ease, transform 300ms var(--ease);

  & p + p { margin-top: 0.9em; }
}

.card__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

/* Chips */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;

  & li {
    padding: 0.25em 0.8em;
    border: 1px solid var(--border);
    border-radius: var(--pill);
    background: var(--surface-2);
    font-size: 0.9rem;
    font-weight: 400;
    white-space: nowrap;
  }
}

.chips--small li {
  padding: 0.15em 0.65em;
  font-size: 0.8rem;
}

/* Key skill: same chip, rainbow border */
.chips li.chip--key {
  border-color: transparent;
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    var(--grad) border-box;
}

/* ==========================================================================
   Nav
   ========================================================================== */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  transition: border-color 300ms;
}

.nav--scrolled {
  border-bottom-color: var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--nav-height);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  font-weight: 600;
  text-decoration: none;
}

.nav__name {
  display: none;
}

.nav__links {
  display: flex;
  gap: clamp(0.75rem, 2.5vw, 2rem);
  font-size: 0.9rem;

  & a {
    position: relative;
    color: var(--muted);
    text-decoration: none;
    transition: color 200ms;

    &::after {
      content: '';
      position: absolute;
      right: 0;
      bottom: -0.3rem;
      left: 0;
      height: 2px;
      border-radius: 2px;
      background: var(--grad-green);
      transform: scaleX(0);
      transition: transform 300ms var(--ease);
    }

    &:hover,
    &.is-active { color: var(--text); }

    &.is-active::after { transform: scaleX(1); }
  }
}

/* Pride hairline along the top edge of the page:
   a dim base line (::before) plus a brighter wave of light (::after)
   travelling from left to right */
.nav::before,
.nav::after {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--rainbow);
  pointer-events: none;
}

.nav::before {
  opacity: 0.45;
}

.nav::after {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 50%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 50%, transparent);
  -webkit-mask-size: 35% 100%;
  mask-size: 35% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: -60% 0;
  mask-position: -60% 0;
  animation: hairline-wave 6s ease-in-out infinite;
}

@keyframes hairline-wave {
  from {
    -webkit-mask-position: -60% 0;
    mask-position: -60% 0;
  }

  to {
    -webkit-mask-position: 160% 0;
    mask-position: 160% 0;
  }
}

.mini-logo {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}

/* Theme toggle: dark theme shows the sun, light theme shows the moon */

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 300ms var(--ease);

  &:hover { transform: rotate(20deg); }

  & svg {
    grid-area: 1 / 1;
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
  }
}

.theme-toggle__moon { display: none; }

:root[data-theme='light'] {
  & .theme-toggle__sun { display: none; }
  & .theme-toggle__moon { display: block; }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    & .theme-toggle__sun { display: none; }
    & .theme-toggle__moon { display: block; }
  }
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  overflow: hidden;
}

.hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  padding-block: 3rem 4rem;
}

/* Decorative lines (paths computed in js/hero-lines.js) */
.hero__lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;

  & path {
    fill: none;
    stroke-width: 1;
    stroke-linecap: round;
    /* faint on narrow screens, where the lines sit behind the text */
    opacity: 0.22;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: hero-line-draw 2.4s var(--ease) both;
  }
}

@keyframes hero-line-draw {
  from { stroke-dashoffset: 1; }
}

/* Gradient along the lines: green, then rainbow, then green again */
.stop-green         { stop-color: var(--accent); }
.stop-red           { stop-color: light-dark(#c2410c, #ff6b6b); }
.stop-orange        { stop-color: light-dark(#b45309, #ffa94d); }
.stop-yellow        { stop-color: light-dark(#a16207, #ffe066); }
.stop-rainbow-green { stop-color: light-dark(#15803d, #69db7c); }
.stop-blue          { stop-color: light-dark(#2f4fb0, #74a8ff); }
.stop-violet        { stop-color: light-dark(#7e22ce, #c084fc); }

.hero__title {
  margin-top: 0.4rem;
  font-size: clamp(2.75rem, 1.5rem + 6vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

.hero__role {
  margin-top: 0.75rem;
  font-size: clamp(1.35rem, 1rem + 1.5vw, 2rem);
  font-weight: 600;
}

.hero__lead {
  max-width: 34rem;
  margin-top: 1.25rem;
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
  color: var(--muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.hero__meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Stagger the hero entrance */
.hero__text .reveal:nth-child(2) { transition-delay: 80ms; }
.hero__text .reveal:nth-child(3) { transition-delay: 160ms; }
.hero__text .reveal:nth-child(4) { transition-delay: 240ms; }
.hero__text .reveal:nth-child(5) { transition-delay: 320ms; }
.hero__text .reveal:nth-child(6) { transition-delay: 400ms; }

/* ==========================================================================
   Sections
   ========================================================================== */

.section {
  padding-block: clamp(3rem, 6vw, 5rem);
}

.section__head {
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

.section__title {
  margin-top: 0.4rem;
  font-size: clamp(2rem, 1.4rem + 2.5vw, 3rem);
}

/* Bento ----------------------------------------------------------------- */

.bento {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    'intro'
    'ai'
    'team';
  gap: 1rem;

  & .card:hover { transform: translateY(-3px); }
}

.bento__intro  { grid-area: intro; font-size: 1.05rem; }
.bento__team   { grid-area: team; }
.bento__ai     { grid-area: ai; }

.bento__team p,
.bento__ai p {
  font-size: 0.95rem;
  color: var(--muted);
}

.bento__ai .chips {
  margin-top: 1rem;
}

/* Team card: text, then languages as three compact tiles (side by side on desktop) */
.bento__team .langs {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 1rem;

  & li {
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface-2);

    &:last-child { padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
  }
}

/* AI card: gradient border to make it stand out */
.bento__ai {
  border-color: transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--grad) border-box;
}

.ai-icon {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}




.langs {
  display: grid;
  gap: 0.5rem;

  & li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);

    &:last-child {
      padding-bottom: 0;
      border-bottom: 0;
    }
  }
}

.langs__level {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Highlights ------------------------------------------------------------ */

.highlights {
  display: grid;
  gap: 1rem;
}

.highlight {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  overflow: hidden;

  /* gradient bar sliding in on hover */
  &::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: var(--grad);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 500ms var(--ease);
  }

  &:hover { transform: translateY(-3px); }
  &:hover::before { transform: scaleX(1); }

  & .chips { margin-top: 0.25rem; }
}

.highlight__index {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.highlight__title {
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
}

.card .highlight__result {
  margin-top: auto;
  padding-left: 0.8rem;
  border-left: 2px solid var(--accent);
  font-size: 0.95rem;
  font-weight: 400;
}

/* Career path ----------------------------------------------------------- */

.career {
  margin-top: 2.5rem;
}

.career__title {
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

/* Timeline: vertical on narrow screens, horizontal from 900px (see the end of the file) */
.career__list {
  position: relative;
  display: grid;
  gap: 1.5rem;
  padding-left: 1.75rem;

  /* the line joining the stops */
  &::before {
    content: '';
    position: absolute;
    top: 0.5rem;
    bottom: 0.5rem;
    left: 0.34rem;
    width: 1px;
    background: var(--border);
  }
}

/* phones: years, role and company stacked (from 500px: years and role on one line) */
.career__list li {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;

  /* one stop per role: filled for the current one */
  &::before {
    content: '';
    position: absolute;
    top: 0.3rem;
    left: -1.75rem;
    width: 0.7rem;
    height: 0.7rem;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: var(--bg);
  }

  &:first-child::before {
    background: var(--accent);
  }
}

.career__years {
  grid-area: years;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.career__role {
  grid-area: role;
  font-weight: 600;
}

.career__company {
  grid-area: company;
  color: var(--muted);
}

.career__more {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;

  &:hover { text-decoration: underline; }
}

/* Skills ---------------------------------------------------------------- */

.skills {
  display: grid;
  gap: 1rem;
}

/* Contact --------------------------------------------------------------- */

.contact__box {
  position: relative;
  overflow: hidden;
  padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1.25rem, 4vw, 3rem);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  background: var(--surface);
  text-align: center;

  /* soft rainbow glow behind the content */
  &::before {
    content: '';
    position: absolute;
    inset: auto -20% -60% -20%;
    height: 80%;
    background: var(--grad);
    filter: blur(80px);
    opacity: 0.18;
    pointer-events: none;
  }

  & > * { position: relative; }
}

.contact__title {
  margin-top: 0.5rem;
  font-size: clamp(2rem, 1.3rem + 3vw, 3.25rem);
}

.contact__lead {
  max-width: 32rem;
  margin: 1rem auto 0;
  color: var(--muted);
}

.contact__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* Footer ---------------------------------------------------------------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 2rem calc(2rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);

  & a {
    text-decoration: none;

    &:hover { color: var(--text); }
  }
}

/* ==========================================================================
   Reveal on scroll (class set by js/theme.js)
   ========================================================================== */

.js-reveal .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);

  &.is-visible {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (min-width: 640px) {
  .nav__name { display: inline; }

  .bento {
    grid-template-columns: repeat(2, 1fr);
    grid-template-areas:
      'intro intro'
      'ai    ai'
      'team  team';
  }

  .skills { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .hero__inner {
    min-height: calc(100dvh - var(--nav-height));
    /* lines run right below the text, then fan out to the right */
    padding-block: 3rem 8rem;
  }

  .hero__lines path {
    opacity: 0.6;
  }

  .bento {
    /* 10 columns so the first row can split 60/40 (intro/AI) */
    grid-template-columns: repeat(10, minmax(0, 1fr));
    grid-template-areas:
      'intro intro intro intro intro intro ai ai ai ai'
      'team  team  team  team  team  team  team team team team';
  }

  .bento__team {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: center;
    gap: 2rem;
  }

  .bento__team .langs { margin-top: 0; }

  .highlights { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   Secondary text: Regular instead of Light, so small grey text reads better
   ========================================================================== */

.hero__meta,
.bento__team p,
.bento__ai p,
.langs__level,
.highlight__result,
.career__years,
.career__company,
.contact__lead,
.footer {
  font-weight: 400;
}

/* ==========================================================================
   Career path: years and role on one line from 500px
   ========================================================================== */

@media (min-width: 500px) {
  .career__list li {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    grid-template-areas:
      'years role'
      '.     company';
    align-items: baseline;
    gap: 0.2rem 0.75rem;
  }
}

/* ==========================================================================
   Career path as a horizontal timeline on wide screens
   ========================================================================== */

@media (min-width: 900px) {
  .career__list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding-top: 2rem;
    padding-left: 0;

    /* the line runs across instead of down */
    &::before {
      top: 0.5rem;
      bottom: auto;
      left: 0;
      right: 0;
      width: auto;
      height: 1px;
    }
  }

  /* wide screens: years, role and company stacked in each column */
  .career__list li {
    display: flex;
    flex-direction: column;
  }

  /* stops sit on the horizontal line, above each role */
  .career__list li::before {
    top: -1.85rem;
    left: 0;
  }
}
