/* ==========================================================================
   aka5h.com
   Plain CSS, no build step. Sections follow page order.
   ========================================================================== */


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

:root {
  /* light theme */
  --bg:       #fafaf9;
  --surface:  #ffffff;
  --text:     #121316;
  --muted:    #5d6068;
  --line:     #e6e5e2;
  --accent:   #0077cc;   /* the cyan from the original mark, darkened for contrast */

  /* colors the mark's trail passes through while it draws (from the original animation) */
  --trail-1: #ff2d2d;
  --trail-2: #ffc81a;
  --trail-3: #00aaff;

  --font-display: "Raleway", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body:    "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1160px;
  --radius: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

/* dark theme: follows the OS unless the toggle picked light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:      #0e0f11;
    --surface: #16181b;
    --text:    #ecedef;
    --muted:   #9a9da5;
    --line:    #26292e;
    --accent:  #3cb4ff;
    color-scheme: dark;
  }
}

/* dark theme: picked with the toggle */
:root[data-theme="dark"] {
  --bg:      #0e0f11;
  --surface: #16181b;
  --text:    #ecedef;
  --muted:   #9a9da5;
  --line:    #26292e;
  --accent:  #3cb4ff;
  color-scheme: dark;
}


/* ---------- Base ---------- */

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

html { scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
  margin: 0;
  padding-inline: var(--gutter);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s, color 0.4s;
}

main, .footer { max-width: var(--max); margin-inline: auto; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-variant-numeric: lining-nums;  /* Raleway defaults to old-style numerals */
  font-kerning: normal;
  line-height: 1.08;
  letter-spacing: -0.015em;
}
p { margin: 0; }
a { color: inherit; text-decoration: none; }

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}


/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  max-width: var(--max);
  margin-inline: auto;
  padding-block: 18px;
  display: flex;
  align-items: center;
  gap: 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.nav.is-scrolled { border-bottom-color: var(--line); }

.nav__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
.nav__logo svg {
  width: 26px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 44;      /* viewBox units; matches the favicon so it holds up at 26px */
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav__links { margin-left: auto; display: flex; gap: 28px; }
.nav__links a {
  position: relative;
  font-size: 0.93rem;
  color: var(--muted);
  transition: color 0.2s;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }

.theme-toggle {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.4s var(--ease);
}
.theme-toggle:hover { border-color: var(--text); transform: rotate(25deg); }
.theme-toggle svg {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  transition: opacity 0.3s, transform 0.4s var(--ease);
}
.theme-toggle .icon-moon { fill: currentColor; stroke: none; }

/* Show the icon for the mode you'd switch to. */
.icon-sun  { opacity: 0; transform: rotate(-90deg) scale(0.5); }
:root[data-theme="dark"] .icon-sun  { opacity: 1; transform: none; }
:root[data-theme="dark"] .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun  { opacity: 1; transform: none; }
  :root:not([data-theme="light"]) .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }
}

@media (max-width: 720px) {
  .nav__links { display: none; }
  .theme-toggle { margin-left: auto; }
}


/* ---------- Hero ---------- */

.hero {
  min-height: min(calc(100svh - 80px), 880px);
  padding-block: 48px 64px;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  align-items: center;
  gap: clamp(32px, 6vw, 96px);
}

.hero__title {
  margin-block: 18px 26px;
  font-size: clamp(2.25rem, 5.6vw, 4.4rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.02;
}
.hero__title em { font-style: normal; font-weight: 700; letter-spacing: -0.012em; }

.hero__lede { max-width: 54ch; font-size: 1.1rem; color: var(--muted); }

.hero__cta { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 12px; }

/* on phones the location gets its own line instead of a dangling middot */
@media (max-width: 480px) {
  .eyebrow__sep { display: none; }
  .eyebrow__loc { display: block; margin-top: 4px; }
}

/* Tablets in portrait: the screen is tall, so don't stretch the hero to fill it. */
@media (orientation: portrait) and (min-width: 701px) {
  .hero { min-height: 0; padding-block: 72px 88px; }
}

/* Phones only: tablets in portrait keep the two-column hero. */
@media (max-width: 700px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 24px; }
  .hero .mark { order: -1; justify-self: start; width: clamp(130px, 40vw, 200px); }
}


/* ---------- The mark ---------- */

.mark {
  justify-self: center;
  width: min(100%, 400px);
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
  /* where it sits during the intro (set by script.js) */
  transform: translate(var(--ix, 0), var(--iy, 0)) scale(var(--is, 1));
  transition: transform 1.1s var(--ease);
}
.mark svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The colored copy sits exactly under the main lines and draws a beat ahead of them,
   so color leads each stroke. It fades out once the drawing is done. */
.mark__trail { stroke: var(--trail-3); opacity: 0; }
.mark.is-drawing .mark__trail { animation: trail-life 2.8s linear forwards; }
@keyframes trail-life { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* Drawing: every line uses pathLength="1", so a dash of 1 is the whole line. */
/* Undrawn lines are also hidden: with round caps, a fully dashed-out line still paints its
   end cap, which shows up as a stray dot until that line starts drawing. */
.js .mark line { stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; }
.mark__rise { --g: 0; }
.mark__fall { --g: 1; }
.mark__flat { --g: 2; }

.mark.is-drawing line {
  animation: draw 0.9s var(--ease) both;
  animation-delay: calc(var(--g) * 0.28s + var(--i, 0) * 0.05s + 0.18s);
}
.mark.is-drawing .mark__trail line {
  animation: draw 0.9s var(--ease) both, trail 1s linear forwards;
  animation-delay: calc(var(--g) * 0.28s + var(--i, 0) * 0.05s);
}

@keyframes draw  {
  0%   { stroke-dashoffset: 1; opacity: 0; }
  1%   { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}
@keyframes trail {
  0%   { stroke: var(--trail-1); }
  45%  { stroke: var(--trail-2); }
  100% { stroke: var(--trail-3); }
}

/* Drift away gently as the hero scrolls out (browsers with scroll-driven animations). */
@supports (animation-timeline: view()) {
  .mark svg {
    animation: drift linear both;
    animation-timeline: view();
    animation-range: exit 0% exit 100%;
  }
  @keyframes drift { to { transform: translateY(-80px) rotate(-6deg); opacity: 0.2; } }
}


/* ---------- Intro ---------- */
/* First visit per tab: the mark draws itself large in the middle of the screen,
   then glides into the hero while the rest of the page fades in. */

.intro body { overflow: hidden; }
.intro .mark { transition: none; }

.js .nav,
.js .hero__text > *:not(.hero__title),
.js .stats {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.is-ready .nav,
.is-ready .hero__text > *:not(.hero__title),
.is-ready .stats { opacity: 1; transform: none; }
.is-ready .hero__lede  { transition-delay: 0.25s; }
.is-ready .hero__cta   { transition-delay: 0.35s; }
.is-ready .stats       { transition-delay: 0.5s; }

/* Headline lines slide up out of their own masks. */
.hero__title .line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.js .hero__title .line > span {
  display: inline-block;
  transform: translateY(105%);
  transition: transform 1s var(--ease);
}
.hero__title .line:nth-child(2) > span { transition-delay: 0.08s; }
.hero__title .line:nth-child(3) > span { transition-delay: 0.16s; }
.is-ready .hero__title .line > span { transform: none; }


/* ---------- Buttons ---------- */

.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.4s var(--ease), border-color 0.4s;
}
/* fill wipes in from the left on hover */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease);
}
.btn:hover { color: var(--bg); border-color: var(--text); }
.btn:hover::before { transform: scaleX(1); }

.btn--solid { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn--solid::before { background: var(--accent); }
.btn--solid:hover { border-color: var(--accent); }


/* ---------- Stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-block: 1px solid var(--line);
}
.stat { padding: 28px 24px; display: grid; align-content: start; gap: 8px; }
.stat:first-child { padding-left: 0; }
.stat + .stat { border-left: 1px solid var(--line); }

.stat__num {
  font-family: var(--font-display);
  font-variant-numeric: lining-nums;
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.stat__label { font-size: 0.9rem; color: var(--muted); }

@media (max-width: 860px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .stat, .stat + .stat { padding-left: 0; border-left: 0; }
  .stat + .stat { border-top: 1px solid var(--line); }
}


/* ---------- Sections ---------- */

.section { padding-top: clamp(80px, 11vw, 140px); }

.section__head { margin-bottom: 40px; display: grid; gap: 10px; }
.section__head h2 {
  font-size: clamp(2rem, 4.4vw, 3.3rem);
  font-weight: 300;
  letter-spacing: -0.025em;
}


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

.work {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 760px) { .work { grid-template-columns: 1fr; } }

.work__item {
  position: relative;
  overflow: hidden;
  padding: 30px 30px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.5s var(--ease), border-color 0.3s, box-shadow 0.5s var(--ease);
}
/* a single accent line draws across the top on hover, echoing the mark */
.work__item::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--trail-1), var(--trail-2), var(--trail-3));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}
.work__item:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.35); }
.work__item:hover::before { transform: scaleX(1); }

.work__meta {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.work__item h3 { font-size: 1.55rem; font-weight: 600; padding-right: 32px; }
.work__item p  { color: var(--muted); }

.work__arrow {
  position: absolute;
  top: 26px;
  right: 28px;
  font-size: 1.25rem;
  color: var(--muted);
  transition: transform 0.4s var(--ease), color 0.3s;
}
.work__item:hover .work__arrow { transform: translate(3px, -3px); color: var(--accent); }

/* tighter cards on phones so the text gets the width */
@media (max-width: 480px) { .work__item { padding: 24px 22px 26px; } .work__arrow { top: 20px; right: 20px; } }


/* ---------- Projects ---------- */

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

.project {
  position: relative;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 2fr 32px;
  gap: 24px;
  align-items: baseline;
  padding-block: 28px;
  border-bottom: 1px solid var(--line);
}
.project h3 { font-size: 1.35rem; font-weight: 600; transition: color 0.3s, transform 0.4s var(--ease); }
.project p  { color: var(--muted); max-width: 62ch; }

.project__arrow { justify-self: end; color: var(--muted); transition: transform 0.4s var(--ease), color 0.3s; }
a.project:hover h3 { color: var(--accent); transform: translateX(6px); }
a.project:hover .project__arrow { color: var(--accent); transform: translateX(4px); }

@media (max-width: 720px) {
  .project { grid-template-columns: 1fr; gap: 8px; }
  .project__arrow { display: none; }
}


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

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline li {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding-block: 28px;
  border-top: 1px solid var(--line);
}
.timeline h3 { font-size: 1.45rem; font-weight: 600; }
.timeline p  { color: var(--muted); max-width: 64ch; }

/* Company logos: single-color by default (masked with the text color),
   brand color when you hover the row. Files live in assets/logos/. */
.timeline__org { display: flex; align-items: center; gap: 12px; }

.logo {
  flex: none;
  width: 30px;
  height: 30px;
  background: currentColor;
  -webkit-mask: var(--logo) center / contain no-repeat;
          mask: var(--logo) center / contain no-repeat;
  transition: background 0.4s;
}
.logo--meta         { --logo: url("assets/logos/meta.svg"); }
.logo--coenterprise { --logo: url("assets/logos/coenterprise.svg"); width: 26px; }
.logo--nyu          { --logo: url("assets/logos/nyu.svg"); width: 26px; height: 26px; }

.timeline li:hover .logo--meta         { background: #0081fb; }
.timeline li:hover .logo--coenterprise { background: linear-gradient(135deg, #3155c1, #1ca1b4); }
.timeline li:hover .logo--nyu          { background: #57068c; }

/* NYC Mesh (both projects live under nycmeshnet) */
.project__title { display: flex; align-items: center; gap: 10px; }
.project__title .logo { width: 24px; height: 24px; }
.logo--nycmesh { --logo: url("assets/logos/nycmesh.svg"); }
a.project:hover .logo--nycmesh { background: #ffcc00; }

/* greenwood-wifi is part of NYC Mesh: drop the divider between them and hang it off the
   parent with a tree line that runs from under the NYC Mesh logo into an elbow. */
.project { --tree: color-mix(in srgb, var(--muted) 45%, transparent); }
.project:has(+ .project--child) { border-bottom-color: transparent; padding-bottom: 10px; }
.project:has(+ .project--child)::after {
  content: "";
  position: absolute;
  left: 11px;              /* centre of the 24px logo */
  top: 58px;               /* just below the logo */
  bottom: 0;
  border-left: 1.5px solid var(--tree);
}
.project--child { padding-top: 6px; }
.project--child .project__title { position: relative; padding-left: 34px; font-size: 1.2rem; }
.project--child .project__title::before {
  content: "";
  position: absolute;
  left: 11px;
  top: -6px;               /* meets the parent's line across the row padding */
  width: 15px;
  height: calc(6px + 0.6em);
  border-left: 1.5px solid var(--tree);
  border-bottom: 1.5px solid var(--tree);
  border-bottom-left-radius: 5px;
}
@media (max-width: 720px) {
  /* single column: indent the whole child row so its text sits under the parent title */
  .project--child { padding-left: 34px; }
  .project--child .project__title { padding-left: 0; }
  .project--child .project__title::before { left: -23px; }
  /* keep the parent's text clear of the tree line: align it with its title, after the logo */
  .project:has(+ .project--child) p { padding-left: 34px; }
}

.timeline__when { font-size: 0.9rem; color: var(--muted); padding-top: 5px; font-variant-numeric: tabular-nums; }
.timeline .timeline__role { color: var(--text); font-weight: 500; margin-block: 4px 10px; }

@media (max-width: 640px) {
  .timeline li { grid-template-columns: 1fr; gap: 6px; }
}

.toolkit {
  margin: 48px 0 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.toolkit dt {
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.toolkit dd { margin: 0; font-size: 0.93rem; color: var(--muted); }

@media (max-width: 860px) { .toolkit { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .toolkit { grid-template-columns: 1fr; } }


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

.contact {
  padding-block: clamp(96px, 14vw, 180px) 72px;
  display: grid;
  justify-items: center;
  gap: 22px;
  text-align: center;
}

.contact__title { font-size: clamp(3rem, 10vw, 7.5rem); font-weight: 300; letter-spacing: -0.025em; }
.kern-L { letter-spacing: -0.07em; }  /* Raleway leaves a wide gap after a capital L */
.contact__title a {
  background: linear-gradient(currentColor, currentColor) left bottom / 0% 2px no-repeat;
  transition: background-size 0.6s var(--ease), color 0.3s;
}
.contact__title a:hover { color: var(--accent); background-size: 100% 2px; }

.contact__links {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}


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

.footer {
  padding-block: 24px max(24px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}


/* ---------- Scroll reveal ---------- */
/* script.js adds .is-visible as elements scroll into view. Without JS, nothing is hidden. */

.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--delay, 0s);
}
.js .reveal.is-visible { opacity: 1; transform: none; }


/* ---------- Theme switch ---------- */
/* The new theme grows out of the toggle button (View Transitions API, where supported). */

::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: theme-reveal 0.6s var(--ease); }
@keyframes theme-reveal {
  from { clip-path: circle(0 at var(--tx, 100%) var(--ty, 0)); }
  to   { clip-path: circle(150vmax at var(--tx, 100%) var(--ty, 0)); }
}


/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .js .mark line { stroke-dashoffset: 0; opacity: 1; }
  .js .reveal,
  .js .nav, .js .hero__text > *, .js .stats,
  .js .hero__title .line > span { opacity: 1; transform: none; }
}
