/* ==========================================================================
   habbalco.com
   Design language: automotive instrument cluster + technical spec sheet.
   Palette is taken from the Kafo Team logo: near-black, white, signal red.
   ========================================================================== */

/* ---------- Tokens ---------- */

:root {
  --font-sans: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --shell: 1240px;
  --pad: clamp(1.25rem, 4vw, 3.5rem);

  --r-sm: 3px;
  --r-md: 6px;
  --r-lg: 12px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --dur: .5s;
}

html[data-theme='dark'] {
  --bg:         #0b0d10;
  --bg-2:       #101317;
  --surface:    #14181d;
  --surface-2:  #191e24;
  --line:       rgba(255, 255, 255, .11);
  --line-2:     rgba(255, 255, 255, .22);
  --ink:        #e9ecf0;
  --ink-2:      #a4acb6;
  --ink-3:      #6b747e;
  --red:        #ff3326;
  --red-ink:    #ffffff;
  --shadow:     0 1px 0 rgba(255,255,255,.04), 0 18px 40px -18px rgba(0,0,0,.8);
  color-scheme: dark;
}

html[data-theme='light'] {
  --bg:         #f6f5f2;
  --bg-2:       #ffffff;
  --surface:    #ffffff;
  --surface-2:  #f1efeb;
  --line:       rgba(16, 19, 23, .14);
  --line-2:     rgba(16, 19, 23, .30);
  --ink:        #101317;
  --ink-2:      #525a64;
  --ink-3:      #868e98;
  --red:        #d42418;
  --red-ink:    #ffffff;
  --shadow:     0 1px 0 rgba(255,255,255,.7), 0 18px 36px -22px rgba(16,19,23,.28);
  color-scheme: light;
}


/* ---------- Reset ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.1; }
p { margin: 0; }
ul, ol, dl { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

::selection { background: var(--red); color: var(--red-ink); }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: .75rem 1.25rem;
  background: var(--red);
  color: var(--red-ink);
  font: 600 13px/1 var(--font-mono);
}
.skip:focus { left: .5rem; top: .5rem; }

.sep { color: var(--ink-3); padding: 0 .15em; }


/* ---------- Background grid (technical drawing rules) ---------- */

/* Two rules that trace the content column, like the margin lines on a
   drawing sheet. Anything denser fought with the text. */
.grid-lines {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 2 * var(--pad)), calc(var(--shell) - 2 * var(--pad)));
  pointer-events: none;
  z-index: 0;
  opacity: .7;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
@media (max-width: 900px) { .grid-lines { display: none; } }


/* ---------- Shared layout ---------- */

main { position: relative; z-index: 1; }

.section,
.hero__inner,
.nav,
.foot__row {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--pad);
}


/* ---------- Mono label utility ---------- */

.eyebrow,
.section__label i,
.readout dt,
.project__meta,
.specs__title,
.specs dt,
.tl__when,
.cluster__name,
.cluster__res,
.cluster__caption,
.mailto__label,
.foot,
.toggle__label,
.nav__links i,
.badge,
.tags li,
.tl__tags li,
.stack h3,
.metrics span {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}


/* ==========================================================================
   NAV
   ========================================================================== */

.nav {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 60px;
  max-width: none;
  width: 100%;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background-color .3s var(--ease);
}
.nav.is-stuck { border-bottom-color: var(--line); }

.nav__mark {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .15em;
  white-space: nowrap;
  z-index: 2;
}
.nav__dot { color: var(--red); }

.nav__right { display: flex; align-items: center; gap: clamp(.75rem, 2vw, 1.25rem); z-index: 2; }

.nav__links { display: flex; align-items: center; gap: clamp(.5rem, 2vw, 1.75rem); }
.nav__links a {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: .45em;
  padding: .35rem 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  transition: color .2s var(--ease);
}
.nav__links i {
  font-size: 9.5px;
  font-style: normal;
  letter-spacing: .1em;
  color: var(--ink-3);
  transition: color .2s var(--ease);
}
.nav__links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1.5px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a.is-active { color: var(--ink); }
.nav__links a.is-active i { color: var(--red); }
.nav__links a.is-active::after { transform: scaleX(1); }

@media (max-width: 900px) {
  .nav__links { display: none; }
}

/* Theme toggle — modelled on a physical rocker switch */
.toggle { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; }
.toggle__track {
  position: relative;
  display: block;
  width: 42px;
  height: 22px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface-2);
  transition: background-color .3s var(--ease), border-color .3s var(--ease);
}
.toggle__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform .34s var(--ease), background-color .3s var(--ease);
}
html[data-theme='light'] .toggle__knob { transform: translateX(20px); background: var(--red); }
.toggle:hover .toggle__track { border-color: var(--red); }
.toggle__label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--ink-3);
  min-width: 3.4em;
}
@media (max-width: 520px) { .toggle__label { display: none; } }


/* Burger + full-screen menu (under 900px, where the inline links hide) */

.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 30px;
  height: 30px;
  align-items: flex-end;
}
.burger span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--ink);
  transition: transform .32s var(--ease), width .32s var(--ease), background-color .3s var(--ease);
}
.burger span:last-child { width: 13px; }
.burger[aria-expanded='true'] span { width: 20px; background: var(--red); }
.burger[aria-expanded='true'] span:first-child { transform: translateY(3.25px) rotate(45deg); }
.burger[aria-expanded='true'] span:last-child  { transform: translateY(-3.25px) rotate(-45deg); }

@media (max-width: 900px) { .burger { display: flex; } }

.menu {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2.5rem;
  padding: 6rem var(--pad) 3rem;
  background: var(--bg);
}
.menu[hidden] { display: none; }

.menu__nav { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.menu__nav a {
  display: flex;
  align-items: baseline;
  gap: .8rem;
  padding: clamp(.8rem, 2.4vh, 1.4rem) 0;
  border-bottom: 1px solid var(--line);
  font-size: clamp(1.75rem, 8vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
}
.menu__nav i {
  font-family: var(--font-mono);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--red);
}
.menu__nav a:active { color: var(--red); }

.menu__mail {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-2);
  align-self: flex-start;
  padding-bottom: .3rem;
}

.menu.is-open .menu__nav a,
.menu.is-open .menu__mail { animation: menuIn .48s var(--ease) both; }
.menu.is-open .menu__nav a:nth-child(1) { animation-delay: .04s; }
.menu.is-open .menu__nav a:nth-child(2) { animation-delay: .08s; }
.menu.is-open .menu__nav a:nth-child(3) { animation-delay: .12s; }
.menu.is-open .menu__nav a:nth-child(4) { animation-delay: .16s; }
.menu.is-open .menu__nav a:nth-child(5) { animation-delay: .20s; }
.menu.is-open .menu__mail { animation-delay: .26s; }

@keyframes menuIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

body.is-locked { overflow: hidden; }


/* ==========================================================================
   HERO
   ========================================================================== */

.hero {
  position: relative;
  padding-top: clamp(7rem, 16vh, 11rem);
  padding-bottom: clamp(3rem, 8vh, 6rem);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.hero__inner { position: relative; z-index: 2; }

.eyebrow {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin-bottom: clamp(1.5rem, 4vh, 2.5rem);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-2);
}
/* One flex item, so the label wraps as ordinary text instead of the
   slash-separated fragments each becoming their own column. */
.eyebrow__text { line-height: 1.7; }
.eyebrow__tick {
  width: 8px;
  height: 8px;
  margin-top: .45em;
  flex: none;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 60%, transparent);
  animation: pulse 3s var(--ease) infinite;
}
@keyframes pulse {
  0%, 70%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 55%, transparent); }
  35%           { box-shadow: 0 0 0 7px color-mix(in srgb, var(--red) 0%, transparent); }
}

.hero__title {
  font-size: clamp(2.9rem, 9.2vw, 7.6rem);
  font-weight: 800;
  line-height: .93;
  letter-spacing: -.042em;
  margin-bottom: clamp(1.5rem, 4vh, 2.25rem);
}
.hero__title em {
  font-style: normal;
  color: var(--red);
}

.hero__lede {
  max-width: 46ch;
  font-size: clamp(1rem, 1.55vw, 1.2rem);
  line-height: 1.62;
  color: var(--ink-2);
  margin-bottom: clamp(2rem, 5vh, 3rem);
  text-wrap: pretty;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: clamp(3.5rem, 10vh, 6.5rem);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  padding: .9rem 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.005em;
  transition: background-color .25s var(--ease), color .25s var(--ease),
              border-color .25s var(--ease), transform .25s var(--ease);
}
.btn--solid { background: var(--ink); color: var(--bg); }
.btn--solid:hover { background: var(--red); color: var(--red-ink); transform: translateY(-2px); }
.btn--ghost { border-color: var(--line-2); color: var(--ink); }
.btn--ghost:hover { border-color: var(--red); color: var(--red); transform: translateY(-2px); }
.btn__arrow { transition: transform .25s var(--ease); }
.btn:hover .btn__arrow { transform: translateX(4px); }

/* Dashboard readout strip */
.readout {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line);
}
.readout__cell {
  padding: 1.35rem 1.15rem 0 0;
  border-left: 1px solid var(--line);
  padding-left: 1.15rem;
}
.readout__cell:first-child { border-left: 0; padding-left: 0; }
.readout dt {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .5rem;
}
.readout dd {
  margin: 0;
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
}
.readout dd.dd--text { letter-spacing: -.03em; }
.readout dd small {
  font-size: .38em;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-3);
}
.readout__cell p {
  margin-top: .4rem;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink-2);
}

@media (max-width: 860px) {
  .readout { grid-template-columns: repeat(2, 1fr); gap: 0; }
  .readout__cell {
    border-left: 0;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--line);
  }
  .readout__cell:nth-child(odd) { padding-right: 1rem; }
  .readout__cell:nth-child(even) {
    padding-left: 1.15rem;
    border-left: 1px solid var(--line);
  }
  .readout__cell:last-child { border-bottom: 0; }
}

/* Tachometer decoration. Kept fully inside the viewport — the redline is
   the point of the graphic, so it must never be the part that gets cropped. */
.tach {
  position: absolute;
  right: clamp(0px, 1.5vw, 28px);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(300px, 33vw, 460px);
  aspect-ratio: 1;
  z-index: 1;
  pointer-events: none;
  opacity: .42;
}
.tach svg { width: 100%; height: 100%; overflow: visible; }
@media (max-width: 1180px) { .tach { opacity: .2; width: clamp(250px, 30vw, 340px); } }
@media (max-width: 900px)  { .tach { display: none; } }


/* ==========================================================================
   SECTIONS
   ========================================================================== */

.section { padding-block: clamp(4rem, 11vh, 8rem); }
.section + .section { border-top: 1px solid var(--line); }

.section__head { margin-bottom: clamp(2.25rem, 6vh, 4rem); }

.section__label {
  display: flex;
  align-items: baseline;
  gap: .9rem;
  font-size: clamp(1.35rem, 2.4vw, 1.95rem);
  font-weight: 700;
  letter-spacing: -.03em;
}
.section__label i {
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--red);
  transform: translateY(-.35em);
}
.section__label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
  transform: translateY(-.4em);
}
.section__note {
  margin-top: .85rem;
  max-width: 52ch;
  font-size: 15px;
  color: var(--ink-2);
}


/* ---------- 01 Profile ---------- */

.prose-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
@media (max-width: 900px) { .prose-grid { grid-template-columns: 1fr; } }

.prose p {
  font-size: clamp(1rem, 1.35vw, 1.1rem);
  line-height: 1.72;
  color: var(--ink-2);
  margin-bottom: 1.15em;
  max-width: 60ch;
  text-wrap: pretty;
}
.prose p:last-child { margin-bottom: 0; }
.prose__lead {
  font-size: clamp(1.25rem, 2.2vw, 1.6rem) !important;
  font-weight: 600;
  line-height: 1.34 !important;
  letter-spacing: -.022em;
  color: var(--ink) !important;
}
.prose strong { color: var(--ink); font-weight: 600; }

.specs {
  position: relative;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.specs::before,
.specs::after {
  content: '';
  position: absolute;
  width: 9px;
  height: 9px;
  border: 1px solid var(--red);
}
.specs::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.specs::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.specs__title {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: .9rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: .35rem;
}
.specs__list > div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: .75rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--line);
}
.specs__list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.specs dt {
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: .18em;
}
.specs dd { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.45; }


/* ---------- 02 Work ---------- */

.project { padding-block: clamp(2.5rem, 6vh, 4rem); }
.project + .project { border-top: 1px solid var(--line); }
.project:first-child { padding-top: 0; }

.project__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.project__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .85rem;
}

.badge {
  padding: .28em .6em;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--ink-2);
}
.badge--live {
  border-color: color-mix(in srgb, var(--red) 45%, transparent);
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
}
/* Unshipped work is marked plainly rather than dressed up as a product. */
.badge--wip {
  border-color: var(--line-2);
  background: var(--surface-2);
  color: var(--ink);
}
.badge--next { border-style: dashed; color: var(--ink-2); }

.project__title {
  display: flex;
  align-items: center;
  font-size: clamp(1.9rem, 4.4vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
}
.project__role {
  margin-top: .65rem;
  font-size: 14px;
  color: var(--ink-3);
}

.project__desc {
  max-width: 68ch;
  font-size: clamp(.98rem, 1.3vw, 1.07rem);
  line-height: 1.72;
  color: var(--ink-2);
  margin-bottom: 1.15em;
  text-wrap: pretty;
}

/* Metric row */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 2rem 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.metrics li {
  padding: 1.15rem 1.25rem;
  background: var(--bg);
}
.metrics b {
  display: block;
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.metrics span {
  display: block;
  margin-top: .3rem;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  line-height: 1.4;
}
@media (max-width: 700px) { .metrics { grid-template-columns: repeat(2, 1fr); } }

/* Tag pills */
.tags,
.tl__tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 1.5rem 0 0;
}
.tags li,
.tl__tags li {
  padding: .42em .72em;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--ink-2);
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.tags li:hover,
.tl__tags li:hover { border-color: var(--red); color: var(--ink); }

/* Feature list */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 0 2.5rem;
  margin-top: 2.25rem;
  border-top: 1px solid var(--line);
}
.features li {
  padding: .95rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
}
.features b {
  display: block;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: .3rem;
}

/* Pull quote. The text is Arabic, so the rule sits on the right and the
   block hugs the right edge — otherwise the rule strands itself across
   an empty gap. */
.pull {
  max-width: 54ch;
  margin: 2.5rem 0 0 auto;
  padding: 1.1rem 1.5rem 1.1rem 0;
  border-right: 2px solid var(--red);
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.5;
  direction: rtl;
  text-align: right;
}
.pull span {
  display: block;
  margin-top: .8rem;
  direction: ltr;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: .02em;
  line-height: 1.55;
  color: var(--ink-3);
}


/* ---------- Cluster viewer ---------- */

.cluster { margin: 2.5rem 0 0; }

/* The bezel stays dark in both themes — it is a car screen. */
.cluster__bezel {
  padding: 12px;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #23272d 0%, #14171b 42%, #0c0e11 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.09),
    0 24px 50px -24px rgba(0,0,0,.75);
}
html[data-theme='light'] .cluster__bezel {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.09),
    0 26px 46px -26px rgba(16,19,23,.55);
}

.cluster__screen {
  position: relative;
  aspect-ratio: 8 / 3;
  border-radius: 5px;
  background: #000;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07);
}
.cluster__screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .3s var(--ease);
}
.cluster__screen.is-loading img { opacity: .25; }

.cluster__glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    104deg,
    rgba(255,255,255,.055) 0%,
    rgba(255,255,255,0) 34%,
    rgba(255,255,255,0) 66%,
    rgba(255,255,255,.028) 100%
  );
}

.cluster__chin {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem .3rem .1rem;
}
.cluster__name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #e9ecf0;
}
.cluster__res {
  font-size: 10px;
  letter-spacing: .12em;
  color: #6b747e;
}

.cluster__caption {
  margin-top: 1.15rem;
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.thumbs {
  display: flex;
  gap: .5rem;
  margin-top: .85rem;
  padding-bottom: .6rem;
  overflow-x: auto;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}
.thumbs { scrollbar-color: var(--line-2) transparent; }
.thumbs::-webkit-scrollbar { height: 3px; }
.thumbs::-webkit-scrollbar-track { background: transparent; }
.thumbs::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }

.thumb {
  position: relative;
  flex: none;
  width: 132px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #000;
  overflow: hidden;
  scroll-snap-align: start;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
/* Dim the image rather than the button: the button keeps its black
   backing, so inactive thumbs read as "screen off" in both themes
   instead of washing out to grey on the light background. */
.thumb img {
  width: 100%;
  aspect-ratio: 8 / 3;
  object-fit: cover;
  opacity: .42;
  transition: opacity .25s var(--ease);
}
.thumb:hover { transform: translateY(-2px); }
.thumb:hover img { opacity: .78; }
.thumb.is-active { border-color: var(--red); }
.thumb.is-active img { opacity: 1; }
.thumb.is-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--red);
}
.thumb__cap {
  display: block;
  padding: .4rem .5rem;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: left;
  color: #737c86;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .25s var(--ease);
}
.thumb:hover .thumb__cap { color: #a4acb6; }
.thumb.is-active .thumb__cap { color: #fff; }


/* ---------- 03 Now ---------- */

.now {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
@media (max-width: 980px) { .now { grid-template-columns: 1fr; } }

.card {
  display: flex;
  flex-direction: column;
  padding: 1.75rem 1.6rem;
  background: var(--bg);
}
.card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.1rem;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.card__title {
  font-size: clamp(1.15rem, 1.9vw, 1.4rem);
  font-weight: 700;
  letter-spacing: -.028em;
  line-height: 1.22;
  margin-bottom: .9rem;
}
.card p:not(.card__meta) {
  font-size: 14.5px;
  line-height: 1.66;
  color: var(--ink-2);
  margin-bottom: .9em;
  text-wrap: pretty;
}
.card strong { color: var(--ink); font-weight: 600; }
.card .tags { margin-top: auto; padding-top: .6rem; }


/* ---------- 04 Experience ---------- */

.timeline { border-top: 1px solid var(--line); }

/* Shared logo chip, used beside project and role headings.
   Each mark keeps its own backing colour: some are drawn on black, others
   are transparent dark ink, so none of them survive a theme swap unaided. */
.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 50px;
  height: 50px;
  margin-right: .85rem;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  vertical-align: middle;
  transform: translateY(-2px);
}
.brand img { width: 100%; height: 100%; object-fit: contain; }
.brand--dark  { background: #0d1116; border-color: rgba(255, 255, 255, .16); }
.brand--light { background: #fff;     border-color: rgba(16, 19, 23, .14); }

/* The Kafo mark is drawn on an opaque dark ground, so the chip is matched to
   that exact colour and the seam disappears. */
.brand--kafo { background: #0f1d23; border-color: rgba(255, 255, 255, .15); }

/* Wide plate for the featured project heading: the Kafo wordmark is roughly
   2:1, so a square chip would render it too small to read. */
.brand--plate {
  width: auto;
  height: clamp(50px, 5.4vw, 62px);
  margin-right: 1.05rem;
  padding: 9px 15px;
  border-radius: var(--r-md);
  transform: none;
}
.brand--plate img { width: auto; height: 100%; }

.tl {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: clamp(1rem, 4vw, 3rem);
  padding-block: clamp(1.75rem, 4vh, 2.75rem);
  border-bottom: 1px solid var(--line);
}
@media (max-width: 760px) { .tl { grid-template-columns: 1fr; gap: .75rem; } }

.tl__when {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: .5em;
}
/* Flex so a wrapped role title keeps clear of the logo chip instead of
   sliding back under it. */
.tl__what h3 {
  display: flex;
  align-items: center;
  font-size: clamp(1.15rem, 2.1vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -.025em;
  margin-bottom: .75rem;
}
.tl__title { min-width: 0; }
.tl__what h3 .org { color: var(--ink-3); font-weight: 500; }
.tl__what p {
  max-width: 66ch;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-2);
  text-wrap: pretty;
}
.tl__what p + p { margin-top: 1em; }
.tl__what strong { color: var(--ink); font-weight: 600; }
.tl__tags { margin-top: 1.15rem; }


/* ---------- 04 Stack ---------- */

/* Fixed column counts that divide the six groups exactly. auto-fit left a
   single group stranded on its own row beside an empty grey track. */
.stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
@media (max-width: 900px) { .stack { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .stack { grid-template-columns: 1fr; } }

.stack__col { padding: 1.6rem 1.5rem; background: var(--bg); }
.stack h3 {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--red);
  padding-bottom: .9rem;
  margin-bottom: .9rem;
  border-bottom: 1px solid var(--line);
}
.stack ul { display: flex; flex-direction: column; gap: .5rem; }
.stack li {
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-2);
  padding-left: .95rem;
  position: relative;
}
.stack li::before {
  content: '';
  position: absolute;
  left: 0;
  top: .62em;
  width: 4px;
  height: 1px;
  background: var(--ink-3);
}


/* ---------- 05 Contact ---------- */

.section--contact { padding-bottom: clamp(4rem, 12vh, 8rem); }

.contact__pitch {
  font-size: clamp(1.8rem, 5.2vw, 3.9rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -.042em;
  margin-bottom: 1.75rem;
}
.contact__pitch em { font-style: normal; color: var(--red); }

.contact__note {
  max-width: 52ch;
  font-size: clamp(.98rem, 1.35vw, 1.08rem);
  line-height: 1.68;
  color: var(--ink-2);
  margin-bottom: 2.5rem;
  text-wrap: pretty;
}

.mailto {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  max-width: 620px;
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color .25s var(--ease), background-color .25s var(--ease),
              transform .25s var(--ease);
}
.mailto:hover {
  border-color: var(--red);
  transform: translateY(-2px);
}
.mailto__label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.mailto__addr {
  flex: 1;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  font-weight: 600;
  letter-spacing: -.02em;
  word-break: break-all;
}
.mailto__arrow { font-size: 1.3rem; color: var(--red); transition: transform .25s var(--ease); }
.mailto:hover .mailto__arrow { transform: translateX(5px); }

.social {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  margin-top: 2.25rem;
}
.social a {
  position: relative;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition: color .2s var(--ease);
}
.social a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 1px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s var(--ease);
}
.social a:hover { color: var(--ink); }
.social a:hover::after { transform: scaleX(1); }


/* ---------- Footer ---------- */

.foot {
  border-top: 1px solid var(--line);
  padding-block: 1.75rem;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.foot__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.foot__mid { text-transform: none; letter-spacing: .04em; }


/* ==========================================================================
   Tachometer SVG
   ========================================================================== */

.tach-ring {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}
.tach-arc {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 1.5;
}
.tach-red {
  fill: none;
  stroke: var(--red);
  stroke-width: 5;
  stroke-linecap: butt;
}
.tach-tick {
  stroke: var(--ink-3);
  stroke-width: 1;
  opacity: .55;
}
.tach-tick--major {
  stroke: var(--ink-2);
  stroke-width: 2.25;
  opacity: 1;
}
.tach-tick--red { stroke: var(--red); opacity: .9; }

.tach-num {
  fill: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 500;
}
.tach-num--red { fill: var(--red); }

.tach-cap {
  fill: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .16em;
}

.tach-needle {
  stroke: var(--red);
  stroke-width: 3.5;
  stroke-linecap: round;
}
.tach-needle--tail { stroke-width: 4.5; opacity: .85; }

.tach-hub {
  fill: var(--bg);
  stroke: var(--line-2);
  stroke-width: 1.5;
}
.tach-hub-dot { fill: var(--red); }


/* ==========================================================================
   Reveal on scroll
   ========================================================================== */

[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
[data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}
