:root {
  --font-display: "Syne", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* The topbar is sticky and floats over the page, so an anchor would land
     behind it. This clears the bar plus the gap above it.

     It also makes the brand link reach the real top: #home sits on <main>,
     just below the bar, so subtracting this padding puts the target above
     zero and the browser clamps it to the top of the page. */
  scroll-padding-top: 5.75rem;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  transition: background-color 240ms var(--ease-out), color 240ms var(--ease-out);
}

body.light {
  color-scheme: light;
  --bg: #f7f0e6;
  --bg-secondary: #ecdbc6;
  --surface: rgba(255, 249, 241, 0.78);
  --surface-strong: #fff8ef;
  --surface-solid: #fff6ec;
  --text: #11223a;
  --muted: #5d6978;
  --accent: #ef6d3f;
  --accent-2: #13897a;
  --accent-soft: rgba(239, 109, 63, 0.12);
  --card-stroke: rgba(17, 34, 58, 0.08);
  --grid: rgba(17, 34, 58, 0.06);
  --shadow: 0 24px 70px rgba(17, 34, 58, 0.12);
}

body.dark {
  color-scheme: dark;
  --bg: #08111d;
  --bg-secondary: #11253a;
  --surface: rgba(11, 22, 35, 0.72);
  --surface-strong: #0f2236;
  --surface-solid: #0e1d2d;
  --text: #f8f2e8;
  --muted: #afbdd0;
  --accent: #ff8f3d;
  --accent-2: #69dbc9;
  --accent-soft: rgba(255, 143, 61, 0.14);
  --card-stroke: rgba(248, 242, 232, 0.1);
  --grid: rgba(248, 242, 232, 0.08);
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.34);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: 0.5;
  pointer-events: none;
  mask-image: radial-gradient(circle at center, #000 56%, transparent 100%);
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
}

.page-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

body.light .page-noise {
  background:
    radial-gradient(circle at 16% 18%, rgba(239, 109, 63, 0.24), transparent 30%),
    radial-gradient(circle at 85% 20%, rgba(19, 137, 122, 0.18), transparent 26%),
    radial-gradient(circle at 48% 82%, rgba(17, 34, 58, 0.1), transparent 34%),
    linear-gradient(145deg, #faf4ec 0%, #f2e8db 48%, #f9f2ea 100%);
}

body.dark .page-noise {
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 143, 61, 0.24), transparent 30%),
    radial-gradient(circle at 84% 20%, rgba(105, 219, 201, 0.16), transparent 24%),
    radial-gradient(circle at 54% 78%, rgba(17, 37, 58, 0.56), transparent 36%),
    linear-gradient(155deg, #08111d 0%, #0d1c2d 48%, #091521 100%);
}

.topbar,
.section {
  animation: rise-in 800ms var(--ease-out) both;
}

.topbar {
  position: sticky;
  top: 1rem;
  z-index: 20;
  width: min(1140px, calc(100% - 2rem));
  margin: 1rem auto 0;
  padding: 0.85rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--card-stroke);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  transition: padding 300ms var(--ease-out), border-radius 300ms var(--ease-out);
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-self: end;
}

/* Scrolling tightens the bar. It used to collapse the theme and language
   buttons instead, which left them unreachable for the rest of the page and
   still focusable by keyboard, since opacity and max-width do not remove an
   element from the tab order. */
.topbar.scrolled {
  padding: 0.6rem 1rem;
}

/* The button offers the theme you are not in: a moon while light, a sun
   while dark. Driven by the body class, so it is already correct on the
   first paint. */
.theme-icon {
  flex-shrink: 0;
}

.icon-sun {
  display: none;
}

body.dark .icon-sun {
  display: block;
}

body.dark .icon-moon {
  display: none;
}

.brand {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-decoration: none;
  text-transform: uppercase;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.topnav a {
  position: relative;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 180ms ease;
}

.topnav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.3rem;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.topnav a:hover,
.topnav a:focus-visible,
.text-link:hover,
.text-link:focus-visible {
  color: var(--text);
}

.topnav a:hover::after,
.topnav a:focus-visible::after {
  transform: scaleX(1);
}

.controls button {
  appearance: none;
  border: 1px solid var(--card-stroke);
  border-radius: 999px;
  padding: 0.75rem 1rem;
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
  font: 600 0.9rem var(--font-body);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.controls button:hover,
.controls button:focus-visible,
.button:hover,
.button:focus-visible,
.contact-link:hover,
.contact-link:focus-visible,
.footer-icons a:hover,
.footer-icons a:focus-visible {
  transform: translateY(-2px);
}

.controls button:hover,
.controls button:focus-visible,
.contact-link:hover,
.contact-link:focus-visible,
.footer-icons a:hover,
.footer-icons a:focus-visible {
  border-color: var(--accent);
}

.page-shell {
  width: min(1140px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.2rem 0 4rem;
}

.section {
  margin-top: 1.8rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 2rem;
  align-items: center;
  /* Content sits under the nav instead of centred in a full screen */
  padding: 4rem 0 2rem;
}

.hero-copy {
  max-width: 42rem;
}

.eyebrow,
.section-tag,
.signal-label,
.contact-label,
.project-status {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow,
.section-tag {
  margin: 0 0 0.8rem;
  color: var(--accent-2);
}

#site-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 8vw, 6.8rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  cursor: pointer;
}

.hero-text,
.intro-text,
.skill-block p,
.project-card p,
.contact-text,
.contact-note,
.signal-text,
.principle-card p {
  color: var(--muted);
}

.hero-text {
  max-width: 37rem;
  margin: 1.3rem 0 0;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.3rem;
  padding: 0.85rem 1.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 600;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

.button-primary {
  background: var(--text);
  color: var(--bg);
}

.button-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--card-stroke);
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--accent);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  border-color: var(--accent);
}

.hero-panel {
  position: relative;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 2rem 1.5rem auto auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 72%);
  pointer-events: none;
}

.hero-panel-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.signal-card,
.principle-card,
.project-card,
.skill-block,
.contact-card {
  position: relative;
  border: 1px solid var(--card-stroke);
  border-radius: 1.6rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.signal-card,
.principle-card,
.project-card,
.skill-block {
  padding: 1.4rem;
}

.signal-card::after,
.project-card::after,
.skill-block::after,
.principle-card::after {
  content: "";
  position: absolute;
  left: 1.4rem;
  right: 1.4rem;
  bottom: 1rem;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.55;
}

.signal-card-large {
  grid-column: span 2;
  padding: 1.75rem;
  background:
    linear-gradient(145deg, var(--surface-strong), transparent),
    var(--surface);
}

.signal-label {
  color: var(--accent-2);
}

.signal-value {
  display: inline-block;
  margin-top: 0.45rem;
  font-family: var(--font-display);
  font-size: clamp(3rem, 6vw, 4.8rem);
  line-height: 1;
  letter-spacing: -0.06em;
}

.signal-text,
.project-card p,
.skill-block p,
.principle-card p {
  margin: 0.85rem 0 0;
}

.section-heading {
  max-width: 48rem;
  margin-bottom: 1.6rem;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.2vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1.25rem;
  align-items: start;
}

.intro-text {
  margin: 0;
  padding: 1.5rem;
  border: 1px solid var(--card-stroke);
  border-radius: 1.6rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 1.08rem;
}

.principles,
.work-grid,
.skills-grid,
.contact-links {
  display: grid;
  gap: 1rem;
}

.principles {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.principle-card h3,
.project-card h3,
.skill-block h3 {
  margin: 0;
  font-size: 1.2rem;
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.project-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.project-status {
  color: var(--accent-2);
}

.work-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card-highlight {
  background:
    radial-gradient(circle at top right, var(--accent-soft), transparent 38%),
    var(--surface);
}

.card-tags,
.chip-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0;
  margin: 1.25rem 0 0;
}

.card-tags li,
.chip-list li {
  border: 1px solid var(--card-stroke);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  background: var(--surface-solid);
  font-size: 0.9rem;
}

.text-link {
  display: inline-flex;
  margin-top: 1.5rem;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  transition: color 180ms ease;
}

.skills-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.contact-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 1.2rem;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  overflow: hidden;
}

.contact-card::before {
  content: "";
  position: absolute;
  inset: auto auto -70px -50px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  pointer-events: none;
}

.contact-copy {
  position: relative;
  z-index: 1;
}

.contact-copy h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.contact-text,
.contact-note {
  max-width: 34rem;
}

.contact-note {
  margin: 1rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.contact-links {
  position: relative;
  z-index: 1;
  align-content: start;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--card-stroke);
  border-radius: 1.15rem;
  background: var(--surface-solid);
  text-decoration: none;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.contact-meta {
  display: grid;
  gap: 0.15rem;
}

.contact-meta strong {
  font-size: 1rem;
}

.contact-label {
  color: var(--muted);
}

.hero,
.intro {
  animation-delay: 80ms;
}

.work {
  animation-delay: 160ms;
}

.skills-section {
  animation-delay: 240ms;
}

.contact-section {
  animation-delay: 320ms;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(26px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .hero,
  .intro-grid,
  .contact-card,
  .skills-grid,
  .work-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 0.75rem;
  }

  .principles,
  .work-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 5.25rem;
  }

  body::before {
    background-size: 36px 36px;
  }

  /* One row: the theme label is hidden below, which frees the width the
     nav needs. Brand sizes to content, the nav takes the middle, the two
     buttons sit on the right. */
  .topbar {
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
  }

  .topbar.scrolled {
    padding: 0.5rem 0.85rem;
  }

  .topnav {
    justify-content: center;
    gap: 1rem;
    font-size: 0.88rem;
  }

  .theme-label {
    display: none;
  }

  #toggle-theme {
    padding: 0.5rem 0.6rem;
  }

  #toggle-lang {
    padding: 0.5rem 0.7rem;
  }

  #site-title {
    font-size: clamp(2.8rem, 15vw, 4.4rem);
  }

  .hero-panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .principles,
  .work-grid,
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .signal-card-large {
    grid-column: span 2;
  }

  .contact-card,
  .intro-text,
  .signal-card,
  .project-card,
  .skill-block,
  .principle-card {
    border-radius: 1.3rem;
  }

  .button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .page-shell {
    padding-top: 1.6rem;
  }

  .topbar {
    top: 0.75rem;
  }

  .topnav {
    gap: 1rem;
    font-size: 0.88rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .contact-link {
    align-items: flex-start;
  }
}

@media (max-width: 380px) {
  .topbar {
    padding: 0.5rem 0.7rem;
    gap: 0.5rem;
  }

  .hero-panel-grid {
    grid-template-columns: 1fr;
  }

  .signal-card-large {
    grid-column: auto;
  }

  .topnav {
    gap: 0.75rem;
    font-size: 0.82rem;
  }
}

/* Profile photo inside the age card: photo left, label, age and text right */
.signal-card-photo {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 1.75rem;
  align-items: center;
}

.hero-photo {
  grid-row: 1 / span 3;
  width: 128px;
  height: 128px;
  border-radius: 1.1rem;
  object-fit: cover;
  border: 1px solid var(--card-stroke);
}

/* Keeps "always learning, always refining" on two lines at every width:
   the translation holds a newline after the comma, pre-line shows it */
.signal-card-photo .signal-text {
  white-space: pre-line;
}

@media (max-width: 760px) {
  .signal-card-photo {
    column-gap: 1.1rem;
  }

  .hero-photo {
    width: 96px;
    height: 96px;
  }
}
