/* ----- tokens ----- */
:root {
  --bg:    #0f0f10;
  --bg-2:  #161617;
  --line:  #26262a;
  --ink:   #ededeb;
  --muted: #8d8d88;
  --faint: #5a5a55;
  --accent:#c8a87a;  /* warm sand, used very sparingly */

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

  --pad-x: clamp(20px, 5vw, 56px);
  --max:   1080px;

  --ease:  cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--ink); }

img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: 0; border: 0; cursor: pointer; padding: 0; }

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

.meta {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin: 0;
}

/* ----- nav ----- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--pad-x);
  background: rgba(15,15,16,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.nav__brand { font-weight: 500; }
.nav__links { display: flex; gap: 24px; }
.nav__links a { color: var(--muted); transition: color .2s; }
.nav__links a:hover { color: var(--ink); }
.nav__burger { display: none; flex-direction: column; gap: 5px; }
.nav__burger span { display: block; width: 20px; height: 1.5px; background: var(--ink); }

@media (max-width: 720px) {
  .nav__links { display: none; }
  .nav__burger { display: flex; }
  .nav.is-open .nav__links {
    display: flex; flex-direction: column; gap: 0;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 8px var(--pad-x) 20px;
  }
  .nav.is-open .nav__links a { padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
}

/* ----- hero ----- */
.hero {
  padding: clamp(80px, 14vw, 160px) var(--pad-x) clamp(64px, 10vw, 120px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  max-width: 1080px;
  margin: 0 auto;
}
.hero__inner { max-width: 620px; min-width: 0; }
.hero .meta { margin-bottom: 28px; }

.hero__portrait {
  width: clamp(220px, 24vw, 320px);
  margin: 0;
  align-self: center;
  position: relative;
}

.portrait-frame {
  position: relative;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
}
/* offset shadow plate behind the frame */
.portrait-frame::before {
  content: '';
  position: absolute;
  inset: 12px -12px -12px 12px;
  border: 1px solid var(--line);
  z-index: -1;
  pointer-events: none;
}
/* corner tick marks */
.portrait-frame__corner {
  position: absolute;
  width: 10px; height: 10px;
  pointer-events: none;
}
.portrait-frame__corner::before,
.portrait-frame__corner::after {
  content: ''; position: absolute; background: var(--accent);
}
.portrait-frame__corner::before { left: 0; right: 0; height: 1px; top: 50%; }
.portrait-frame__corner::after  { top: 0; bottom: 0; width: 1px; left: 50%; }
.portrait-frame__corner--tl { top: -5px;    left: -5px; }
.portrait-frame__corner--tr { top: -5px;    right: -5px; }
.portrait-frame__corner--bl { bottom: -5px; left: -5px; }
.portrait-frame__corner--br { bottom: -5px; right: -5px; }

.portrait-frame__mat {
  background:
radial-gradient(120% 80% at 30% 0%, #111111 0%, transparent 60%), linear-gradient(160deg, #000000 0%, #2f2d28 55%, #0a0a0a 100%);  overflow: hidden;
  display: block;
}
.portrait-frame__mat img {
  width: 100%; height: auto;
  display: block;
  filter: grayscale(0.1) contrast(1.03);
}

/* tablet — keep two columns but tighten everything */
@media (max-width: 960px) {
  .hero { gap: 32px; }
  .hero__portrait { width: clamp(180px, 22vw, 240px); }
}

/* mobile — stack vertically, portrait above text */
@media (max-width: 720px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-top: clamp(64px, 12vw, 96px);
  }
  .hero__portrait {
    width: min(220px, 60vw);
    justify-self: center;
    order: -1;
  }
  .hero__title { font-size: clamp(24px, 7vw, 32px); }
  .hero__sub { font-size: 15px; }
  .hero__links { gap: 20px; }
}

@media (max-width: 420px) {
  .hero__portrait { width: min(180px, 56vw); }
  .portrait-frame { padding: 10px; }
  .portrait-frame::before { inset: 9px -9px -9px 9px; }
  .hero__links { flex-direction: column; gap: 14px; }
}

.hero__title {
  font-size: clamp(28px, 3.6vw, 40px);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.18;
  margin: 0 0 24px;
  max-width: 18ch;
}

.hero__sub {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  max-width: 56ch;
  margin: 0 0 40px;
}

.hero__links {
  display: flex; gap: 28px; flex-wrap: wrap;
  font-size: 14px;
}
.hero__links a {
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  transition: border-color .2s;
}
.hero__links a:hover { border-color: var(--ink); }

/* ----- section heads ----- */
.section__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  max-width: var(--max); margin: 0 auto 40px;
  padding: 0 var(--pad-x);
}
.section__head h2 {
  font-size: 18px; font-weight: 500;
  letter-spacing: -0.005em;
  margin: 0;
}

/* ----- work ----- */
.work { padding: clamp(48px, 8vw, 96px) 0 clamp(64px, 10vw, 120px); border-top: 1px solid var(--line); }

.work__list {
  max-width: var(--max); margin: 0 auto;
  padding: 0 var(--pad-x);
  display: flex; flex-direction: column;
}

.case {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 36px;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: opacity .25s;
}
.case:first-child { border-top: 1px solid var(--line); }
.work__list:hover .case { opacity: 0.45; }
.work__list:hover .case:hover { opacity: 1; }

.case__preview {
  position: relative;
  aspect-ratio: 16/10;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.case__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
  transition: transform .8s var(--ease);
}
.case:hover .case__img { transform: scale(1.02); }

.case__live {
  position: absolute;
  top: 10px; right: 10px;
  font-family: var(--mono); font-size: 10px;
  padding: 4px 8px;
  background: rgba(15,15,16,0.78);
  border: 1px solid var(--line);
  color: var(--ink);
  backdrop-filter: blur(6px);
  letter-spacing: 0.02em;
}

.case__body { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.case__row {
  display: flex; gap: 12px; align-items: baseline;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  margin-bottom: 12px;
}
.case__row span { color: var(--faint); }
.case__title { font-size: 18px; font-weight: 500; margin: 0 0 8px; letter-spacing: -0.005em; }
.case__desc { color: var(--muted); font-size: 14.5px; margin: 0 0 16px; max-width: 48ch; }
.case__tech { display: flex; flex-wrap: wrap; gap: 6px; }
.case__tech span,
.proj-tech span {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
  cursor: default;
}
.case__tech span:hover,
.proj-tech span:hover {
  color: var(--ink);
  border-color: var(--ink);
  background: rgba(255,255,255,0.03);
  transform: translateY(-1px);
}

.case.is-hidden { display: none; }
.case.is-revealed {
  display: grid;
  animation: case-in .4s var(--ease);
}
@keyframes case-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.work__more {
  max-width: var(--max); margin: 32px auto 0;
  padding: 0 var(--pad-x);
  display: flex; justify-content: center;
}
#showMore {
  font-size: 13px;
  font-family: var(--font);
  color: var(--muted);
  padding: 12px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: color .2s, border-color .2s, background .2s;
}
#showMore:hover { color: var(--ink); border-color: var(--ink); }
#showMore span {
  font-family: var(--mono); font-size: 11px;
  color: var(--faint); margin-left: 4px;
}
#showMore:hover span { color: var(--muted); }

@media (max-width: 720px) {
  .case { grid-template-columns: 1fr; gap: 20px; padding: 28px 0; }
  .work__list:hover .case { opacity: 1; }
}

/* ----- about ----- */
.about { padding: clamp(48px, 8vw, 96px) 0 clamp(64px, 9vw, 112px); border-top: 1px solid var(--line); }
.about__body {
  max-width: var(--max); margin: 0 auto;
  padding: 0 var(--pad-x);
}
.about__body p { color: var(--muted); margin: 0 0 16px; max-width: 60ch; font-size: 15.5px; }
.about__body p:first-child { color: var(--ink); }

.facts { margin: 32px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 18px 32px; max-width: 480px; }
.facts > div { display: flex; flex-direction: column; gap: 2px; }
.facts dt { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.facts dd { margin: 0; font-size: 14px; color: var(--ink); }

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

/* ----- experience ----- */
.exp { padding: clamp(48px, 8vw, 96px) 0 clamp(64px, 10vw, 112px); border-top: 1px solid var(--line); }
.exp__list {
  max-width: var(--max); margin: 0 auto;
  padding: 0 var(--pad-x);
  list-style: none;
}
.exp__list li {
  display: grid;
  grid-template-columns: 120px 1fr 1.4fr;
  gap: 32px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  align-items: baseline;
}
.exp__list li:last-child { border-bottom: 1px solid var(--line); }

.exp__year { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.exp__role { font-size: 15px; font-weight: 500; }
.exp__org  { font-family: var(--mono); font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.exp__list p { margin: 0; color: var(--muted); font-size: 14px; }
.exp__link {
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: border-color .2s;
}
.exp__link span { font-size: 0.78em; color: var(--faint); margin-left: 2px; transition: transform .2s var(--ease), color .2s; display: inline-block; }
.exp__link:hover { border-color: var(--ink); }
.exp__link:hover span { color: var(--accent); transform: translate(2px, -2px); }

@media (max-width: 720px) {
  .exp__list li { grid-template-columns: 1fr; gap: 4px; }
  .exp__year { order: -1; }
}

/* ----- contact ----- */
.contact { padding: clamp(64px, 9vw, 112px) var(--pad-x); border-top: 1px solid var(--line); max-width: var(--max); margin: 0 auto; }
.contact h2 { font-size: 18px; font-weight: 500; margin: 0 0 14px; }
.contact p { color: var(--muted); margin: 0 0 32px; max-width: 50ch; }

.contact__list { list-style: none; padding: 0; margin: 0; }
.contact__list li {
  display: grid; grid-template-columns: 100px 1fr; gap: 24px;
  padding: 14px 0; border-top: 1px solid var(--line);
  align-items: baseline;
}
.contact__list li:last-child { border-bottom: 1px solid var(--line); }
.contact__list span { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.contact__list a { color: var(--ink); border-bottom: 1px solid transparent; padding-bottom: 1px; transition: border-color .2s; }
.contact__list a:hover { border-color: var(--ink); }

/* ----- footer ----- */
.foot {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 32px var(--pad-x);
  font-family: var(--mono); font-size: 11px; color: var(--faint);
  border-top: 1px solid var(--line);
}

/* ----- reveal (subtle, optional) ----- */
[data-reveal] { transition: opacity .6s var(--ease), transform .6s var(--ease); }
.js [data-reveal] { opacity: 0; transform: translateY(8px); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ----- modal ----- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  pointer-events: none;
  opacity: 0; transition: opacity .25s;
}
.modal[aria-hidden="false"] { opacity: 1; pointer-events: auto; }
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(8,8,9,0.75);
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.modal__panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(840px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  transform: translateX(16px);
  transition: transform .35s var(--ease);
}
.modal[aria-hidden="false"] .modal__panel { transform: none; }

.modal__close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px;
  border: 1px solid var(--line); border-radius: 4px;
  font-size: 20px; line-height: 1; color: var(--muted);
  transition: color .2s, border-color .2s;
}
.modal__close:hover { color: var(--ink); border-color: var(--ink); }

.modal__content { padding: 56px clamp(24px, 5vw, 48px) 64px; }
body.modal-open { overflow: hidden; }

.proj-head { margin-bottom: 24px; }
.proj-head__meta { font-family: var(--mono); font-size: 11px; color: var(--muted); margin: 0 0 12px; }
.proj-head__title { font-size: 22px; font-weight: 500; margin: 0 0 6px; letter-spacing: -0.005em; }
.proj-head__sub { font-family: var(--mono); font-size: 11px; color: var(--faint); }

/* carousel */
.carousel {
  position: relative;
  aspect-ratio: 16/10;
  border: 1px solid var(--line);
  background: #08080a;
  overflow: hidden;
  margin: 24px 0 12px;
  user-select: none;
}
.carousel__track {
  position: absolute; inset: 0; display: flex;
  transition: transform .5s var(--ease);
  cursor: grab;
}
.carousel__track.is-dragging { cursor: grabbing; transition: none; }
.carousel__slide { flex: 0 0 100%; height: 100%; position: relative; }
.carousel__slide img {
  width: 100%; height: 100%; object-fit: contain;
  pointer-events: none; user-select: none;
}

.carousel__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  background: rgba(15,15,16,0.7); border: 1px solid var(--line);
  color: var(--ink); font-size: 14px; line-height: 1;
  transition: background .2s;
}
.carousel__nav:hover { background: var(--bg); }
.carousel__nav--prev { left: 12px; }
.carousel__nav--next { right: 12px; }

.carousel__thumbs { display: flex; gap: 6px; margin-bottom: 32px; }
.carousel__thumb {
  flex: 1; height: 44px; overflow: hidden;
  border: 1px solid var(--line); cursor: pointer;
  opacity: 0.45; transition: opacity .2s;
}
.carousel__thumb img { width: 100%; height: 100%; object-fit: cover; }
.carousel__thumb:hover { opacity: 0.8; }
.carousel__thumb.is-active { opacity: 1; border-color: var(--ink); }

/* proj content */
.proj-block { margin-top: 28px; }
.proj-block h4 {
  font-family: var(--mono); font-size: 10.5px; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin: 0 0 10px;
}
.proj-block p { margin: 0 0 8px; color: var(--ink); font-size: 14.5px; }
.proj-block ul { list-style: none; padding: 0; margin: 0; }
.proj-block li {
  padding: 8px 0; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 14px;
}
.proj-block li:last-child { border-bottom: 1px solid var(--line); }

.proj-tech { display: flex; flex-wrap: wrap; gap: 6px; }

.proj-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  transition: border-color .2s, color .2s;
}
.proj-link span { color: var(--muted); transition: transform .25s var(--ease), color .2s; }
.proj-link:hover { border-color: var(--ink); }
.proj-link:hover span { color: var(--ink); transform: translate(2px, -2px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* =============================================================
   PHONE — consolidated responsive polish
   ============================================================= */

@media (max-width: 720px) {
  /* shorten long brand name so it fits next to the burger */
  .nav__brand { font-size: 13px; }
  .nav { padding: 14px var(--pad-x); }

  /* section heads — let them wrap cleanly */
  .section__head { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* project cards — tighter rhythm, smaller meta row */
  .case { gap: 16px; padding: 24px 0; }
  .case__title { font-size: 17px; }
  .case__desc  { font-size: 14px; }
  .case__live  { top: 8px; right: 8px; font-size: 9px; padding: 3px 6px; }

  /* show-more button */
  .work__more { padding-top: 24px; }

  /* about facts — single column reads better on phones */
  .facts { gap: 14px; max-width: 100%; }
  .about__body p { font-size: 15px; }

  /* experience rows — already collapse to 1fr; tighten gaps */
  .exp__list li { padding: 18px 0; }

  /* contact — narrower label column on phones */
  .contact__list li { grid-template-columns: 80px 1fr; gap: 16px; padding: 12px 0; }
  .contact__list a { word-break: break-all; }

  /* footer — stack on small screens */
  .foot { flex-direction: column; gap: 6px; padding: 24px var(--pad-x); }

  /* modal — full-width feels right on phones, tighten inner padding */
  .modal__panel { border-left: 0; }
  .modal__content { padding: 48px 20px 56px; }
  .modal__close { top: 12px; right: 12px; }
  .carousel__nav { width: 28px; height: 28px; }
  .carousel__thumbs { display: none; } /* dots/thumbs eat space — rely on swipe */
}

@media (max-width: 420px) {
  :root { --pad-x: 18px; }

  .nav__brand { font-size: 12.5px; }
  .case__row { font-size: 10.5px; }
  .case__title { font-size: 16px; }
  .case__tech span,
  .proj-tech span { font-size: 10px; padding: 5px 7px; }

  .exp__year { font-size: 11px; }
  .exp__role { font-size: 14.5px; }

  .contact__list li { grid-template-columns: 1fr; gap: 4px; }
  .contact__list span { font-size: 10.5px; }

  .proj-head__title { font-size: 20px; }
  .proj-block li, .proj-block p { font-size: 13.5px; }
}
