/* ============================================================
   Edison Liu — Portfolio
   Restrained, technical, content-first.
   Palette: near-black ink on warm off-white, single accent.
   ============================================================ */

:root {
  /* Color — keep it tight. Change --accent to re-brand the whole site. */
  --ink:        #16181d;   /* primary text */
  --ink-soft:   #4a4f5a;   /* secondary text */
  --ink-faint:  #8b909b;   /* tertiary / meta */
  --bg:         #f7f6f3;   /* page background (warm off-white) */
  --bg-alt:     #efede8;   /* alternating section */
  --surface:    #ffffff;   /* cards */
  --line:       #e2e0da;   /* borders / dividers */
  --dark:       #16181d;   /* dark sections */
  --dark-soft:  #22252c;   /* dark section cards */
  --accent:     #2f6f4f;   /* single accent — muted green. swap freely. */
  --accent-ink: #234f39;

  --maxw: 1080px;
  --pad: clamp(1.25rem, 5vw, 4rem);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: 0.6rem 1rem; border-radius: 0 0 6px 0;
  font-size: 0.85rem;
}
.skip-link:focus { left: 0; }

/* ---------- Typography helpers ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  text-transform: none;
}
.muted { color: var(--ink-faint); }

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: transparent;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}
.nav__inner {
  max-width: var(--maxw); margin-inline: auto; padding: 0.9rem var(--pad);
  display: flex; align-items: center; justify-content: space-between;
}
.nav__brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; }
.nav__mark {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--ink); color: #fff;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.02em;
}
.nav__name { font-size: 0.95rem; letter-spacing: -0.01em; }
.nav__links { display: flex; gap: 1.6rem; }
.nav__links a {
  font-size: 0.9rem; color: var(--ink-soft); font-weight: 500;
  position: relative; padding: 0.2rem 0; transition: color 0.2s var(--ease);
}
.nav__links a::after {
  content: ''; position: absolute; left: 0; bottom: -2px; height: 1.5px; width: 0;
  background: var(--accent); transition: width 0.25s var(--ease);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { width: 100%; }

.nav__toggle {
  display: none; flex-direction: column; gap: 5px; cursor: pointer;
  background: none; border: none; padding: 6px;
}
.nav__toggle span {
  width: 22px; height: 2px; background: var(--ink); border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.2s var(--ease);
}
.nav__toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle.is-open span:nth-child(2) { opacity: 0; }
.nav__toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav__mobile {
  display: none; flex-direction: column;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 0.5rem var(--pad) 1.2rem;
}
.nav__mobile a {
  padding: 0.75rem 0; font-size: 1rem; color: var(--ink-soft);
  border-bottom: 1px solid var(--line); font-weight: 500;
}
.nav__mobile a:last-child { border-bottom: none; }
.nav__mobile.is-open { display: flex; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding-top: 6rem; padding-bottom: 4rem;
  position: relative;
}
.hero .eyebrow { margin-bottom: 1.4rem; }
.hero__title {
  font-size: clamp(2.4rem, 6.5vw, 4.6rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 700;
  max-width: 16ch;
  margin-bottom: 1.6rem;
}
.hero__title-accent { color: var(--accent-ink); }
.hero__lead {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--ink-soft);
  max-width: 56ch;
  margin-bottom: 2.2rem;
  line-height: 1.65;
}
.hero__actions { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-bottom: 3rem; }
.hero__meta {
  display: flex; flex-wrap: wrap; gap: 1.8rem;
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-soft);
  padding-top: 1.6rem; border-top: 1px solid var(--line);
}
.hero__meta-k {
  display: block; color: var(--ink-faint); font-size: 0.72rem;
  margin-bottom: 0.25rem; letter-spacing: 0.03em;
}
.hero__scroll {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-faint);
  letter-spacing: 0.1em;
}
.hero__scroll-line {
  width: 1px; height: 36px;
  background: linear-gradient(to bottom, var(--ink-faint), transparent);
  animation: scrollPulse 2.2s var(--ease) infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6); transform-origin: top; }
  50%      { opacity: 1;   transform: scaleY(1);   transform-origin: top; }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-size: 0.92rem; font-weight: 600; letter-spacing: -0.005em;
  padding: 0.78rem 1.5rem; border-radius: 8px;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
  cursor: pointer; border: 1.5px solid transparent;
}
.btn:active { transform: translateY(1px); }
.btn--solid { background: var(--ink); color: #fff; }
.btn--solid:hover { background: var(--accent-ink); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--full { width: 100%; }

/* On dark sections, the solid (near-black) button has poor contrast.
   Flip it to a light button so CTAs stay legible. */
.section--dark .btn--solid { background: #fff; color: var(--ink); }
.section--dark .btn--solid:hover { background: var(--accent); color: #fff; }

/* ============================================================
   SECTION SCAFFOLD
   ============================================================ */
.section { padding-block: clamp(4rem, 10vw, 7.5rem); }
.section--alt { background: var(--bg-alt); }
.section--dark { background: var(--dark); color: #e9e8e4; }
.section--dark .section__title { color: #fff; }
.section--dark .section__index { color: #5a5f6a; }
.section--dark .section__lead { color: #a9adb6; }

.section__head {
  display: flex; align-items: baseline; gap: 1rem;
  margin-bottom: 2.6rem; padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}
.section--dark .section__head { border-bottom-color: #2c2f37; }
.section__index {
  font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink-faint);
  font-weight: 500;
}
.section__title {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 700; letter-spacing: -0.025em; line-height: 1.1;
}
.section__lead {
  font-size: clamp(1.02rem, 2vw, 1.15rem); color: var(--ink-soft);
  max-width: 60ch; margin-bottom: 2.8rem;
}

/* ============================================================
   ABOUT
   ============================================================ */
.about__grid {
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 3.5rem;
  align-items: start;
}
.about__lead p { margin-bottom: 1.2rem; color: var(--ink-soft); max-width: 60ch; }
.about__lead p:first-child {
  color: var(--ink); font-size: 1.15rem; line-height: 1.6;
}
.about__note {
  font-family: var(--font-mono); font-size: 0.85rem;
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-left: 2px solid var(--accent);
  padding: 0.9rem 1.1rem; border-radius: 0 6px 6px 0;
  line-height: 1.55;
}
.about__side { display: flex; flex-direction: column; gap: 1.2rem; }
.about__photo {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  line-height: 0;
}
.about__photo img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  filter: grayscale(0.15) contrast(1.02);
  transition: filter 0.4s var(--ease);
}
.about__photo:hover img { filter: grayscale(0) contrast(1); }
.about__card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 1.4rem 1.5rem;
}
.about__card h3 {
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 1rem;
}
.about__card dl > div { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.about__card dl > div:last-child { border-bottom: none; padding-bottom: 0; }
.about__card dl > div:first-child { padding-top: 0; }
.about__card dt { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.15rem; }
.about__card dd { font-size: 0.88rem; color: var(--ink-soft); }
.about__card dd.muted { font-family: var(--font-mono); font-size: 0.76rem; margin-top: 0.2rem; }

/* ============================================================
   PROJECTS
   ============================================================ */
.projects {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.4rem;
}
.project {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.8rem;
  display: flex; flex-direction: column;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.project:hover { border-color: var(--ink); transform: translateY(-2px); }
.project__top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.1rem;
}
.project__tag {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.03em; color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  padding: 0.28rem 0.6rem; border-radius: 5px;
}
.project__year {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint);
}
.project__title {
  font-size: 1.32rem; font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: 0.8rem; line-height: 1.2;
}
.project__desc {
  font-size: 0.95rem; color: var(--ink-soft); line-height: 1.62;
  margin-bottom: 1.3rem; flex-grow: 1;
}
.project__stack {
  display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.3rem;
}
.project__stack li {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 5px; padding: 0.22rem 0.55rem;
}
.project__links { margin-top: auto; }
.link-arrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.88rem; font-weight: 600; color: var(--accent-ink);
}
.link-arrow span { transition: transform 0.2s var(--ease); }
.link-arrow:hover span { transform: translateX(3px); }

.projects__more {
  margin-top: 2.2rem; font-family: var(--font-mono); font-size: 0.85rem;
  color: var(--ink-soft);
}
.link-inline {
  color: var(--accent-ink); font-weight: 600;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.link-inline:hover { border-bottom-color: var(--accent); }

/* ============================================================
   SKILLS
   ============================================================ */
.skills {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 2.4rem 3rem;
}
.skills__label {
  font-family: var(--font-mono); font-size: 0.76rem; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 1rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--line);
}
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips li {
  font-size: 0.86rem; font-weight: 500; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  padding: 0.4rem 0.8rem; border-radius: 7px;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.chips li:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ============================================================
   SERVICES (dark)
   ============================================================ */
.services {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem;
  margin-bottom: 2.8rem;
}
.service {
  background: var(--dark-soft); border: 1px solid #2c2f37;
  border-radius: 12px; padding: 1.6rem 1.7rem;
  transition: border-color 0.25s var(--ease);
}
.service:hover { border-color: var(--accent); }
.service h3 {
  font-size: 1.12rem; font-weight: 600; color: #fff;
  margin-bottom: 0.6rem; letter-spacing: -0.01em;
}
.service p { font-size: 0.92rem; color: #a9adb6; line-height: 1.6; }

.services__cta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1.5rem; flex-wrap: wrap;
  background: var(--dark-soft); border: 1px solid #2c2f37;
  border-radius: 12px; padding: 1.6rem 1.8rem;
}
.services__rate {
  font-size: 1.5rem; font-weight: 700; color: #fff; letter-spacing: -0.02em;
}
.services__rate span { font-size: 0.85rem; font-weight: 400; color: #8b909b; }
.services__rate-note {
  font-family: var(--font-mono); font-size: 0.74rem; color: #6a6f7a; margin-top: 0.2rem;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 3.5rem;
  align-items: start;
}
.contact__lead > p {
  font-size: 1.1rem; color: var(--ink-soft); line-height: 1.6;
  margin-bottom: 2rem; max-width: 46ch;
}
.contact__list { display: flex; flex-direction: column; gap: 0.2rem; }
.contact__list li {
  display: flex; gap: 1rem; align-items: baseline;
  padding: 0.85rem 0; border-bottom: 1px solid var(--line);
}
.contact__k {
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-faint);
  min-width: 80px; letter-spacing: 0.03em;
}
.contact__list a { color: var(--accent-ink); font-weight: 500; }
.contact__list a:hover { text-decoration: underline; }

.contact__form {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.8rem;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { margin-bottom: 1.1rem; display: flex; flex-direction: column; }
.field label {
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 500;
  color: var(--ink-soft); margin-bottom: 0.45rem; letter-spacing: 0.02em;
}
.field input, .field textarea {
  font-family: var(--font-sans); font-size: 0.95rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 0.7rem 0.85rem; width: 100%; resize: vertical;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.contact__form-note {
  margin-top: 1rem; padding: 0.8rem 1rem; border-radius: 8px;
  font-size: 0.9rem; font-weight: 500;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-ink);
}
.contact__form-hint {
  margin-top: 1rem; font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--ink-faint); line-height: 1.5;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--dark); color: #a9adb6;
  padding-block: 2.2rem;
}
.footer__inner {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1.5rem; flex-wrap: wrap;
}
.footer__brand {
  display: flex; align-items: center; gap: 0.6rem; color: #fff; font-weight: 600;
}
.footer__meta {
  display: flex; align-items: center; gap: 1.6rem;
  font-family: var(--font-mono); font-size: 0.8rem;
}
.footer__status { display: inline-flex; align-items: center; gap: 0.5rem; }
.footer__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4fbf72; position: relative;
}
.footer__dot::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: #4fbf72; animation: ping 2s var(--ease) infinite;
}
@keyframes ping {
  0% { transform: scale(1); opacity: 0.7; }
  75%, 100% { transform: scale(2.4); opacity: 0; }
}

/* ============================================================
   SCROLL REVEAL
   Progressive enhancement: content is visible by default.
   JS adds .reveal-ready to <html>, which arms the hidden state,
   then IntersectionObserver reveals each element on scroll.
   If JS never runs, everything stays visible.
   ============================================================ */
.reveal-ready .reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal-ready .reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav__toggle { display: flex; }
  .about__grid { grid-template-columns: 1fr; gap: 2.2rem; }
  .projects { grid-template-columns: 1fr; }
  .skills { grid-template-columns: 1fr; gap: 2rem; }
  .services { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; gap: 2.2rem; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .field-row { grid-template-columns: 1fr; }
  .services__cta { flex-direction: column; align-items: stretch; text-align: center; }
  .hero__actions { width: 100%; }
  .hero__actions .btn { flex: 1; }
  .hero__scroll { display: none; }
  .footer__inner { flex-direction: column; text-align: center; }
}
