:root {
  --bg: #f3f3ef;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-2: #33332f;
  --muted: #5c5c57;
  --line: rgba(26, 26, 26, 0.1);
  --accent: #f97316;
  --accent-ink: #7c2d12;
  --indigo: #4f46e5;

  --sticky-yellow: #ffd95e;
  --sticky-pink: #ff9bb3;
  --sticky-blue: #8ec5ff;
  --sticky-green: #a8e063;
  --sticky-purple: #c4a7ff;

  --board-bg: #f5eedc;
  --board-sheen: rgba(255, 255, 255, 0.55);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08);
  --glow-a: rgba(142, 197, 255, 0.25);
  --glow-b: rgba(196, 167, 255, 0.22);
}

/* Dark mode follows the browser/OS preference — no toggle. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171a;
    --surface: #1f1f24;
    --text: #f2f2ef;
    --text-2: #d9d9d3;
    --muted: #a4a49c;
    --line: rgba(255, 255, 255, 0.12);
    --accent-ink: #fdba74;
    --indigo: #818cf8;
    --board-bg: #262219;
    --board-sheen: rgba(255, 255, 255, 0.045);
    --glow-a: rgba(142, 197, 255, 0.12);
    --glow-b: rgba(196, 167, 255, 0.12);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, var(--glow-a), transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, var(--glow-b), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

a {
  color: var(--accent-ink);
}

/* ---------- Top bar ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  /* Match the content column: sections are 1080px max, centered, with
   * clamp() side padding — so pad by the centering offset plus that. */
  padding: 0.65rem calc(max(0px, (100% - 1080px) / 2) + clamp(1.25rem, 4vw, 2rem));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.top__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.logo {
  width: 1.7rem;
  height: 1.7rem;
  color: var(--accent);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.top__brand:hover .logo {
  transform: rotate(60deg);
}

.top__nav {
  margin-left: auto;
  display: flex;
  gap: clamp(0.75rem, 2.5vw, 1.5rem);
  font-size: 0.9rem;
  font-weight: 600;
}

.top__nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.top__nav a:hover,
.top__nav a.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

@media (max-width: 560px) {
  .top {
    padding-inline: 0.9rem;
    gap: 0.6rem;
  }

  /* Logo only — the wordmark doesn't fit next to the nav. */
  .top__brand span {
    display: none;
  }

  .top__nav {
    gap: 0.7rem;
    font-size: 0.8rem;
  }
}

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

.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1.25rem, 4vw, 2rem) 2rem;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    /* Single column reads top-down — less air before the headline. */
    padding-top: 1.5rem;
  }
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.headline {
  margin: 0 0 0.75rem;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.headline__name {
  background: linear-gradient(120deg, var(--accent), #fb923c 55%, var(--sticky-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 0 0 1.5rem;
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  color: var(--text-2);
  max-width: 46ch;
}

.tagline code {
  background: rgba(127, 127, 127, 0.14);
  padding: 0.05em 0.35em;
  border-radius: 5px;
  font-size: 0.9em;
}

/* ---------- CTA buttons ---------- */

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 14px 30px rgba(0, 0, 0, 0.12);
}

.btn__label {
  font-weight: 700;
  font-size: 1rem;
}

.btn__sub {
  font-size: 0.78rem;
  opacity: 0.85;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

/* ---------- Hero mini whiteboard ---------- */

.board {
  position: relative;
  aspect-ratio: 5 / 4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  /* Warm paper: a soft sheen over a cream base, plus subtle grain. */
  background:
    radial-gradient(120% 90% at 20% -10%, var(--board-sheen), transparent 60%),
    repeating-linear-gradient(-42deg, rgba(0, 0, 0, 0.012) 0 2px, transparent 2px 5px),
    var(--board-bg);
  box-shadow: var(--shadow);
  /* No overflow clipping — notes are allowed to escape onto the page. */
}

.board__grid {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image:
    radial-gradient(circle, var(--line) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.7;
}

.note {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: max-content;
  max-width: 46%;
  padding: 0.95rem 1.1rem 1.35rem;
  font-family: 'Bradley Hand', 'Segoe Print', 'Comic Sans MS', cursive;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  line-height: 1.3;
  color: #1a1a1a;
  border-radius: 3px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
  /* translate first: drags move in page axes, then the note tilts. */
  transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--r));
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.15s ease;
}

.note.is-dragging {
  cursor: grabbing;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.24);
  z-index: 10;
}

.note::before {
  /* tape */
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  width: 42px;
  height: 14px;
  transform: translateX(-50%) rotate(-2deg);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 2px;
}

/* Polaroid-style photo card — same drag behavior as the sticky notes. */
.note--photo {
  margin: 0;
  width: 94%;
  max-width: 94%;
  padding: 0.7rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.note--photo img {
  display: block;
  width: 100%;
  height: auto;
  transform: scaleX(-1);
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

@media (prefers-color-scheme: dark) {
  .note--photo {
    filter: brightness(0.9);
  }
}

/* Stacked hero: the whiteboard panel disappears and the notes float
 * free as a collage. (Overrides the inline --x/--y/--r, which are
 * tuned for desktop; translate is kept so dragging still works.) */
@media (max-width: 860px) {
  .board {
    background: none;
    border: none;
    box-shadow: none;
  }

  .board__grid {
    display: none;
  }

  .note--photo {
    left: 8%;
    top: 3%;
    width: 76%;
    max-width: 76%;
    transform: translate(var(--dx, 0), var(--dy, 0)) rotate(3deg);
  }

  .note--green {
    top: 90%;
    transform: translate(var(--dx, 0), var(--dy, 0)) rotate(-4deg);
  }
}

.note--yellow { background: var(--sticky-yellow); }
.note--pink   { background: var(--sticky-pink); }
.note--blue   { background: var(--sticky-blue); }
.note--green  { background: var(--sticky-green); }
.note--purple { background: var(--sticky-purple); }

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

.section {
  max-width: 1080px;
  /* Subtle divider between sections; spacing split between margin and
   * padding so the line sits centered in the gap. */
  margin: clamp(1.5rem, 4vw, 2.75rem) auto 0;
  padding: clamp(1.5rem, 4vw, 2.75rem) clamp(1.25rem, 4vw, 2rem) 0;
  border-top: 1px solid var(--line);
}

.section__title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.01em;
}

.section__lead {
  margin: 0 0 1.75rem;
  color: var(--muted);
  max-width: 62ch;
}

.section__hint {
  font-style: italic;
}

/* A lead that follows earlier content within the same section. */
.section__lead--follow {
  margin-top: 2.25rem;
}

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

.projects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

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

.project {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* The title link stretches over the whole card, making it clickable. */
.project__title-link {
  color: inherit;
  text-decoration: none;
}

.project__title-link::after {
  content: '';
  position: absolute;
  inset: 0;
}

/* Keep the footer links clickable above the stretched title link. */
.project__links {
  position: relative;
  z-index: 1;
}

.project:hover {
  transform: translateY(-3px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 18px 38px rgba(0, 0, 0, 0.14);
}

.project__visual {
  position: relative;
  height: 150px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

/* Board card visual: floating mini sticky notes */
.project__visual--board {
  background:
    radial-gradient(circle, var(--line) 1px, transparent 1px) 0 0 / 20px 20px,
    color-mix(in srgb, var(--sticky-yellow) 7%, var(--surface));
}

.mini-note {
  position: absolute;
  padding: 0.45rem 0.7rem;
  font-family: 'Bradley Hand', 'Segoe Print', 'Comic Sans MS', cursive;
  font-size: 0.75rem;
  color: #1a1a1a;
  border-radius: 2px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
  animation: float 5s ease-in-out infinite;
}

.mini-note--yellow { background: var(--sticky-yellow); left: 10%; top: 18%; transform: rotate(-4deg); }
.mini-note--blue   { background: var(--sticky-blue);   left: 40%; top: 46%; transform: rotate(3deg); animation-delay: -1.4s; }
.mini-note--pink   { background: var(--sticky-pink);   left: 66%; top: 16%; transform: rotate(-2deg); animation-delay: -2.6s; }
.mini-note--green  { background: var(--sticky-green);  left: 74%; top: 58%; transform: rotate(5deg); animation-delay: -3.8s; }

@keyframes float {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -7px; }
}

/* Planner card visual: mini roadmap bars */
.project__visual--planner {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  padding: 18px 16px;
  align-items: center;
  background:
    linear-gradient(to right, var(--line) 1px, transparent 1px) 0 0 / 14.28% 100%,
    color-mix(in srgb, var(--indigo) 5%, var(--surface));
}

.mini-bar {
  height: 20px;
  border-radius: 6px;
  background: var(--c);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  transform-origin: left center;
  animation: grow 0.9s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.project:hover .mini-bar {
  animation: grow 0.9s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.mini-bar:nth-child(2) { animation-delay: 0.12s; }
.mini-bar:nth-child(3) { animation-delay: 0.24s; }
.mini-bar:nth-child(4) { animation-delay: 0.36s; }

@keyframes grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.project__body {
  padding: 1.25rem 1.35rem 1.35rem;
}

.project__body h3 {
  margin: 0 0 0.15rem;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.project__pkg {
  margin: 0 0 0.6rem;
}

.project__pkg code {
  font-size: 0.82rem;
  color: var(--muted);
}

.project__body > p:not(.project__pkg) {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.project__body code {
  background: rgba(127, 127, 127, 0.14);
  padding: 0.05em 0.35em;
  border-radius: 5px;
  font-size: 0.85em;
}

.chip {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.2em 0.7em;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.14);
  color: var(--muted);
}

.chip--live {
  background: color-mix(in srgb, var(--sticky-green) 35%, transparent);
  color: inherit;
}

.project__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.project__links a {
  text-decoration: none;
}

.project__links a:hover {
  text-decoration: underline;
}

.projects__more {
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 62ch;
}

/* ---------- About ---------- */

.about {
  max-width: 70ch;
}

.about p {
  margin: 0 0 1rem;
  color: var(--text-2);
}

/* ---------- Tech logos ---------- */

.tech {
  display: grid;
  /* Min column width chosen so all 8 tiles fit on one row inside the
   * 1080px section at full page width. */
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 0.9rem;
}

.tech__item {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding: 1.2rem 0.75rem 0.95rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tech__item:hover {
  transform: translateY(-3px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 14px 30px rgba(0, 0, 0, 0.12);
}

.tech__item img {
  height: 44px;
  width: auto;
  max-width: 88%;
}

.tech__item figcaption {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

/* ---------- Skills ---------- */

.skill-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

.skill-filters button {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.4em 1em;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.skill-filters button:hover {
  border-color: var(--accent);
  color: var(--text);
}

.skill-filters button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.skill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  font-weight: 600;
  transition: transform 0.15s ease, opacity 0.25s ease, filter 0.25s ease;
}

.skill:hover {
  transform: translateY(-2px) rotate(-2deg);
}

/* While hovered, pad the hit area so the tilted pill still covers the
 * cursor at its original edges — otherwise hover flickers on/off when
 * the pill rotates away from the pointer. */
.skill:hover::after {
  content: '';
  position: absolute;
  inset: -9px;
}

.skill i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--c, var(--accent));
}

.skill.is-dimmed {
  opacity: 0.25;
  filter: saturate(0);
}

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

.section--contact {
  text-align: left;
}

.contact-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Contact buttons: icon on the left, label + handle stacked on the right. */
.btn--contact {
  flex-direction: row;
  align-items: center;
  gap: 0.8rem;
}

.btn--contact .btn__icon {
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
}

.btn--contact .btn__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

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

.site-footer {
  max-width: 1080px;
  margin: 3rem auto 0;
  padding: 2rem clamp(1.25rem, 4vw, 2rem) 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0.25rem 0;
}

.license {
  color: var(--muted);
}

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .mini-note,
  .mini-bar {
    animation: none;
  }
}
