/* ---------- Tokens ---------- */
:root {
  --bg: #0a0a0a;
  --surface: #121212;
  --surface-2: #191919;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #ededed;
  --muted: #9b9b9b;
  --accent: #d2601a;
  --accent-hover: #e8732b;
  --accent-soft: rgba(210, 96, 26, 0.14);
  --on-accent: #0a0a0a;
  --success: #6fcf8e;
  --danger: #ff7a6b;

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

  --radius: 14px;
  --radius-sm: 8px;
  --container: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 64px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.7 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; }

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

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

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 15px/1 var(--font-body);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost { border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-block { width: 100%; }

.btn .arrow { transition: transform 0.2s var(--ease); }
.btn:hover .arrow { transform: translate(2px, -2px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 16px;
}

.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--accent);
}
.brand-role {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.nav { display: flex; gap: 4px; }
.nav a {
  position: relative;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 999px;
  transition: color 0.2s;
}
.nav a:hover,
.nav a.is-active { color: var(--text); }
.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Hero / About ---------- */
.hero { padding: clamp(48px, 9vw, 112px) 0 clamp(64px, 10vw, 128px); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(40px, 7vw, 96px);
  align-items: center;
}

.hero h1 {
  margin-bottom: 28px;
  font-size: clamp(40px, 6.4vw, 68px);
  font-weight: 700;
}
.hero-sub {
  display: block;
  margin-top: 14px;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 500;
  line-height: 1.35;
  color: var(--muted);
  letter-spacing: 0;
}

.hero-copy > p { max-width: 58ch; color: #cfcfcf; font-size: 17px; }

.credentials {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 32px 0 36px;
  padding: 0;
  list-style: none;
}
.credentials li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-sm);
}
.cred-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.cred-detail { font-size: 13px; color: var(--muted); line-height: 1.5; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.portrait {
  position: relative;
  margin: 0;
  max-width: 420px;
  justify-self: end;
  width: 100%;
}
.portrait::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translate(14px, 14px);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  opacity: 0.7;
}
.portrait img {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
}

/* ---------- Section heads ---------- */
.section-head { margin-bottom: clamp(32px, 5vw, 56px); }
.section-head h2,
.contact-intro h2 { font-size: clamp(32px, 4.6vw, 48px); }

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

.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "head  aside"
    "body  aside";
  column-gap: clamp(32px, 5vw, 64px);
  padding: clamp(24px, 4vw, 48px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  transition: border-color 0.3s;
}
.project + .project { margin-top: clamp(24px, 4vw, 40px); }
.project:hover { border-color: var(--line-strong); }

.project-head {
  grid-area: head;
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 28px;
}
.project-index {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.project h3 { font-size: clamp(30px, 4vw, 42px); font-weight: 700; }

.project-body { grid-area: body; }
.project-body h4 {
  margin: 28px 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.project-body p { color: #cfcfcf; font-size: 15.5px; }

.meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.meta > div { padding: 12px 14px; background: var(--surface-2); }
.meta-wide { grid-column: 1 / -1; }
.meta dt {
  margin-bottom: 2px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.meta dd { margin: 0; font-size: 14.5px; font-weight: 500; line-height: 1.45; }

.project-aside {
  grid-area: aside;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: start;
}

/* Video facade: loads the YouTube player only on click */
.video {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  color: #fff;
  font: inherit;
  text-align: left;
}
.video img,
.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video img { object-fit: cover; transition: transform 0.6s var(--ease), opacity 0.3s; opacity: 0.82; }
.video::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent 55%);
  pointer-events: none;
}
.video:hover img { transform: scale(1.03); opacity: 1; }

.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s var(--ease), background-color 0.2s;
}
.video-play::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -10px 0 0 -6px;
  border-style: solid;
  border-width: 10px 0 10px 17px;
  border-color: transparent transparent transparent var(--on-accent);
}
.video:hover .video-play { transform: scale(1.08); background: var(--accent-hover); }

.video-title {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 12px;
  z-index: 1;
  font-size: 13.5px;
  font-weight: 500;
}

.video.is-playing { cursor: default; }
.video.is-playing::after,
.video.is-playing .video-play,
.video.is-playing .video-title { display: none; }

/* Documents */
.docs { margin-top: 8px; }
.docs-label {
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.docs-grid {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.doc {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, transform 0.25s var(--ease);
}
.doc img {
  flex: none;
  width: 104px;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  object-position: top;
  background: #fff;
  border-radius: 4px;
  filter: grayscale(0.35) brightness(0.86);
  transition: filter 0.3s;
}
.doc-text { display: flex; flex-direction: column; min-width: 0; }
.doc-name { font-size: 14px; font-weight: 600; line-height: 1.35; }
.doc-type { font-size: 12px; color: var(--muted); }
.doc:hover { border-color: var(--accent); transform: translateX(2px); }
.doc:hover img { filter: none; }
.doc:hover .doc-type { color: var(--accent); }

/* ---------- Other projects ---------- */
.other {
  padding: clamp(64px, 10vw, 120px) 0;
  border-top: 1px solid var(--line);
}
.other-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.other-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.25s var(--ease);
}
.other-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.other-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.other-tag {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
}
.other-arrow { color: var(--muted); transition: color 0.2s, transform 0.2s var(--ease); }
.other-card:hover .other-arrow { color: var(--accent); transform: translate(2px, -2px); }
.other-card h3 { margin-bottom: 8px; font-size: 22px; }
.other-card p { color: var(--muted); font-size: 15px; }
.other-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  font-size: 14px;
  font-weight: 500;
}
.other-card:hover .other-link { color: var(--accent); }

/* ---------- Contact ---------- */
.contact {
  padding: clamp(64px, 10vw, 120px) 0;
  border-top: 1px solid var(--line);
}
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}
.contact-intro h2 { margin-bottom: 16px; }
.contact-intro p { max-width: 38ch; color: var(--muted); }

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.req { color: var(--accent); }

.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: 400 16px/1.5 var(--font-body);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { resize: vertical; min-height: 140px; }
.field input:hover,
.field textarea:hover { border-color: rgba(255, 255, 255, 0.26); }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field [aria-invalid="true"] { border-color: var(--danger); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.form-foot .btn { min-width: 140px; }
.form-foot .btn[disabled] { opacity: 0.6; cursor: progress; }
.form-status { margin: 0; font-size: 14px; color: var(--muted); }
.form-status.is-success { color: var(--success); }
.form-status.is-error { color: var(--danger); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 28px;
  font-size: 14px;
  color: var(--muted);
}
.footer-inner p { margin: 0; }
.footer-inner a:hover { color: var(--accent); }

/* ---------- Reveal on scroll ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { order: -1; justify-self: start; max-width: 260px; }

  .project {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
      "head"
      "aside"
      "body";
  }
  .project-aside { margin-bottom: 28px; }

  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .brand-role { display: none; }
  .nav a { padding: 8px 9px; }
  .credentials { grid-template-columns: 1fr; }
  .portrait { max-width: 200px; }
  .portrait::before { transform: translate(10px, 10px); }
  .form { grid-template-columns: 1fr; }
  .form-foot .btn { width: 100%; }
}
