/* =========================================================
   mhilo.com — stylesheet
   Design tokens, layout, and component styles
   ========================================================= */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  color: var(--color-ink);
  background: var(--color-paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3, h4, p, figure { margin: 0; }
a { color: inherit; text-decoration: none; }

/* ---------- Tokens ---------- */
:root {
  /* Color palette */
  --color-ink: #0b0b0b;
  --color-paper: #f7f6f1;
  --color-smoke: #8a8a86;
  --color-smoke-dark: #a8a8a4; /* for secondary text on dark */
  --color-smoke-light: #5a5a56; /* for secondary text on light */
  --color-line: #e5e4df;
  --color-line-dark: rgba(247, 246, 241, 0.1);
  --color-line-light: rgba(11, 11, 11, 0.12);
  --color-tomato: #ff5d3b;

  /* Typography */
  --font-display: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Spacing & layout */
  --max-width: 1280px;
  --section-padding-y: clamp(5rem, 12vh, 10rem);
  --section-padding-x: clamp(1.5rem, 5vw, 4rem);
  --gutter: clamp(1rem, 3vw, 2rem);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 0.25s;
  --dur-med: 0.5s;
  --dur-slow: 0.9s;
}

/* ---------- Typography ---------- */
body { font-size: 16px; }
.headline, .hero-wordmark, .project-name, .big-email {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.02;
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  padding: 1.25rem var(--section-padding-x);
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  color: var(--color-paper);
  background: var(--color-ink);
  transition: color var(--dur-med) var(--ease-out),
              background-color var(--dur-med) var(--ease-out),
              padding var(--dur-med) var(--ease-out);
}
.nav > * { pointer-events: auto; }
.nav--on-light {
  color: var(--color-ink);
  background: var(--color-paper);
}
.nav-mark {
  display: inline-flex;
  align-items: flex-end;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.02em;
  opacity: 0;
  transform: scale(1.15);
  transform-origin: top left;
  pointer-events: none;
  transition: opacity var(--dur-med) var(--ease-out),
              transform var(--dur-med) var(--ease-out);
}
.nav-mark.nav-mark--active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.mark-m { display: inline-block; line-height: 0.9; }
.mark-tail {
  display: inline-block;
  overflow: hidden;
  max-width: 3.5em;
  white-space: nowrap;
  line-height: 0.9;
  opacity: 1;
  transition: max-width 0.55s var(--ease-out),
              opacity 0.3s var(--ease-out);
}
.nav-mark--collapsed .mark-tail {
  max-width: 0;
  opacity: 0;
}
.nav-mark .mark-dot {
  margin-left: 4px;
  margin-bottom: 3px;
}
.mark-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-tomato);
  animation: ambientPulse 4s ease-in-out infinite;
}
.mark-section {
  display: inline-block;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  white-space: nowrap;
  line-height: 0.9;
  margin-left: 4px;
  transition: max-width 0.55s var(--ease-out),
              opacity 0.3s var(--ease-out) 0.25s;
}
.nav-mark--collapsed.nav-mark--labeled .mark-section {
  max-width: 10em;
  opacity: 1;
}
.nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1.75rem;
}
.nav-jump {
  font-size: 12px;
  letter-spacing: 0.02em;
  opacity: 0.65;
  transition: opacity var(--dur-fast) var(--ease-out);
  position: relative;
}
.nav-jump:hover { opacity: 1; }
.nav-jump::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform var(--dur-med) var(--ease-out);
}
.nav-jump:hover::after {
  transform: scaleX(1);
  transform-origin: left center;
}
.nav-link {
  font-size: 12px;
  letter-spacing: 0.02em;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  opacity: 0.85;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.nav-link:hover { opacity: 1; }

@keyframes ambientPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.7; }
}

/* ---------- Section shell ---------- */
.section {
  padding: var(--section-padding-y) var(--section-padding-x);
  position: relative;
}
.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}
.section--dark { background: var(--color-ink); color: var(--color-paper); }
.section--light { background: var(--color-paper); color: var(--color-ink); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: calc(var(--section-padding-y) + 2rem);
  padding-bottom: calc(var(--section-padding-y) - 2rem);
}
.hero-wordmark {
  display: inline-flex;
  align-items: flex-end;
  gap: clamp(6px, 1vw, 10px);
  font-size: clamp(4.5rem, 15vw, 11rem);
  letter-spacing: -0.05em;
  line-height: 0.88;
  margin-bottom: 1.5rem;
}
.wm-letter {
  display: inline-block;
  line-height: 0.88;
}
.wm-dot {
  display: inline-block;
  width: clamp(12px, 1.5vw, 20px);
  height: clamp(12px, 1.5vw, 20px);
  border-radius: 50%;
  background: var(--color-tomato);
  margin-bottom: clamp(8px, 1.2vw, 14px);
}
.hero-tagline {
  font-size: clamp(1rem, 1.3vw, 1.125rem);
  line-height: 1.55;
  max-width: 30rem;
  color: var(--color-smoke-dark);
  margin-bottom: 4rem;
}
.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--color-smoke);
  text-transform: none;
}
.scroll-cue-label { display: inline-block; }
.scroll-cue-line {
  display: inline-block;
  width: 1px;
  height: 24px;
  background: var(--color-smoke);
  transform-origin: top center;
  animation: scrollPulse 1.8s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* ---------- Eyebrow label (section labels) ---------- */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 500;
  margin-bottom: 2rem;
  color: var(--color-smoke);
  width: fit-content;
}
.section--light .eyebrow { color: var(--color-smoke-light); }
.eyebrow-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-tomato);
}

/* ---------- About ---------- */
.about { padding-top: 0; }
.headline {
  font-size: clamp(2rem, 5vw, 3.5rem);
  max-width: 28ch;
  margin-bottom: 1.75rem;
}
.body {
  font-size: clamp(0.95rem, 1.1vw, 1rem);
  line-height: 1.65;
  max-width: 34rem;
  color: var(--color-smoke-dark);
}
.section--light .body { color: var(--color-smoke-light); }

/* ---------- Projects ---------- */
.projects .eyebrow { margin-bottom: 3rem; }
.project {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 1.5rem;
  padding: 1.75rem 0;
  border-top: 1px solid var(--color-line-light);
  align-items: baseline;
  transition: transform var(--dur-med) var(--ease-out);
}
.project:last-of-type { border-bottom: 1px solid var(--color-line-light); }
.project-num {
  font-size: 11px;
  color: var(--color-smoke-light);
  font-weight: 500;
  letter-spacing: 0.05em;
  padding-top: 0.75rem;
  transition: color var(--dur-fast) var(--ease-out);
}
.project:hover .project-num { color: var(--color-tomato); }
.project-body { min-width: 0; }
.project-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.project-name {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  margin: 0;
  letter-spacing: -0.02em;
}
.project-type {
  font-size: 11px;
  color: var(--color-smoke-light);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.project-desc {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--color-smoke-light);
  max-width: 30rem;
  margin: 0 0 0.875rem;
}
.project-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-ink);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-bottom: 1px;
  position: relative;
  margin-right: 1.25rem;
  margin-bottom: 0.25rem;
}
.project-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(1);
  transform-origin: right center;
  transition: transform var(--dur-med) var(--ease-out);
}
.project-link:hover::after {
  transform-origin: left center;
  animation: underlineDraw 0.6s var(--ease-out);
}
@keyframes underlineDraw {
  0% { transform: scaleX(0); transform-origin: left center; }
  100% { transform: scaleX(1); transform-origin: left center; }
}
.link-arrow {
  color: var(--color-tomato);
  display: inline-block;
  margin-left: 2px;
  transition: transform var(--dur-fast) var(--ease-out);
}
.project-link:hover .link-arrow {
  transform: translate(2px, -2px);
}
.project-link--soon {
  color: var(--color-smoke-light);
  font-style: italic;
  cursor: default;
  pointer-events: none;
}
.project-link--soon::after { display: none; }

/* ---------- Contact ---------- */
.contact .eyebrow { margin-bottom: 1rem; }
.big-email {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 5.5vw, 4rem);
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--color-paper);
  display: inline-block;
  margin-bottom: 1.5rem;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.at-symbol {
  color: var(--color-tomato);
  display: inline-block;
  animation: atWiggle 6s ease-in-out infinite;
  transform-origin: center center;
}
@keyframes atWiggle {
  0%, 92%, 100% { transform: rotate(0deg); }
  94% { transform: rotate(-6deg); }
  96% { transform: rotate(6deg); }
  98% { transform: rotate(-3deg); }
}
.big-email:hover .at-symbol {
  animation: none;
  transform: scale(1.15) rotate(-4deg);
  transition: transform var(--dur-fast) var(--ease-out);
}
.contact .body { margin-bottom: 4rem; }

/* ---------- Footer ---------- */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-line-dark);
  font-size: 11px;
  color: var(--color-smoke);
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-copy { color: var(--color-smoke); }
.footer-mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  color: var(--color-paper);
}
.footer-mark .mark-dot {
  width: 4px;
  height: 4px;
  margin-bottom: 2px;
}

/* ---------- Cursor trail ---------- */
.cursor-trail {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}
.cursor-trail-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-tomato);
  pointer-events: none;
  will-change: opacity, transform;
}
@media (hover: none) {
  .cursor-trail { display: none; }
}

/* ---------- Animation initial states (only when JS is loaded) ---------- */
.js .wm-letter { opacity: 0; transform: translateY(40px); }
.js .wm-dot { opacity: 0; transform: translateY(-10px) scale(0.4); }
.js .hero-tagline { opacity: 0; transform: translateY(20px); }
.js .scroll-cue { opacity: 0; }
.js .reveal-words .word { opacity: 0; transform: translateY(16px); display: inline-block; }
.js .reveal-fade { opacity: 0; transform: translateY(20px); }
.js .reveal-row { opacity: 0; transform: translateX(-24px); }
.js .eyebrow { opacity: 0; transform: translateY(10px); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .nav-center { display: none; }
}
@media (max-width: 640px) {
  .nav { padding: 1rem 1.25rem; }
  .hero-wordmark { font-size: 5rem; }
  .project {
    grid-template-columns: 2.25rem 1fr;
    gap: 1rem;
    padding: 1.5rem 0;
  }
  .project-name { font-size: 1.5rem; }
  .project-head { flex-direction: column; gap: 0.25rem; }
  .hero-tagline { margin-bottom: 3rem; }
  .footer { flex-direction: column-reverse; align-items: flex-start; gap: 0.75rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .js .wm-letter,
  .js .wm-dot,
  .js .hero-tagline,
  .js .scroll-cue,
  .js .reveal-words .word,
  .js .reveal-fade,
  .js .reveal-row,
  .js .eyebrow {
    opacity: 1 !important;
    transform: none !important;
  }
  .cursor-trail { display: none; }
}
