/* ==========================================================================
   CRAFTEVA — design system
   Dark / minimal / premium. Bronze is an accent: use it sparingly.
   ========================================================================== */

:root {
  --bg: #101116;
  --bg-2: #17181F;
  --card: #1C1D25;
  --text: #F4F4F2;
  --text-2: #A1A1AA;
  --muted: #777B86;
  --border: #30313A;
  --bronze: #A68C68;
  --bronze-soft: rgba(166, 140, 104, 0.14);

  --font-head: "Manrope", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --wrap: 1240px;
  --gutter: clamp(20px, 4vw, 48px);
  --section: clamp(88px, 12vw, 160px);
  --radius: 14px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --nav-h: 72px;
}

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.28s; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--bronze); color: var(--bg); }
:focus-visible { outline: 2px solid var(--bronze); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 200;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--radius-sm);
  font: 600 14px var(--font-head); transition: top 0.2s;
}
.skip-link:focus { top: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: var(--section) 0; }
.section + .section { padding-top: 0; }
.section--alt { background: var(--bg-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section--alt + .section { padding-top: var(--section); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; letter-spacing: -0.025em; line-height: 1.08; margin: 0; }
.display { font-size: clamp(44px, 8.2vw, 112px); font-weight: 800; letter-spacing: -0.045em; line-height: 0.98; }
.h1 { font-size: clamp(40px, 6vw, 80px); font-weight: 800; letter-spacing: -0.04em; line-height: 1.02; }
.h2 { font-size: clamp(32px, 4.4vw, 56px); letter-spacing: -0.035em; }
.h3 { font-size: clamp(22px, 2.2vw, 28px); letter-spacing: -0.02em; line-height: 1.2; }
.lead { font-size: clamp(18px, 1.6vw, 21px); color: var(--text-2); line-height: 1.6; max-width: 40ch; margin: 0; }
.muted { color: var(--muted); }
p { margin: 0 0 1em; }
.prose p { color: var(--text-2); max-width: 64ch; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--text); font-weight: 600; }

.label {
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 12px/1 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.label--accent::before { content: ""; width: 18px; height: 1px; background: var(--bronze); }
.mono { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.04em; }

.section-head { display: grid; gap: 20px; margin-bottom: clamp(48px, 6vw, 80px); }
.section-head--split { grid-template-columns: 1fr; align-items: end; }
@media (min-width: 900px) { .section-head--split { grid-template-columns: 1.2fr 1fr; gap: 48px; } }
.section-head .lead { max-width: 46ch; }

/* ---------- Buttons ---------- */
.btn {
  --b: var(--border);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 0 24px; border-radius: 999px;
  font: 600 15px/1 var(--font-head); letter-spacing: -0.005em; white-space: nowrap;
  border: 1px solid var(--b); background: transparent; color: var(--text); cursor: pointer;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn svg { width: 16px; height: 16px; transition: transform 0.25s var(--ease); }
.btn:hover { --b: var(--bronze); color: var(--text); }
.btn:hover svg { transform: translateX(3px); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--text); color: var(--bg); --b: var(--text); }
.btn--primary:hover { background: var(--bronze); --b: var(--bronze); color: var(--bg); }
.btn--sm { min-height: 40px; padding: 0 18px; font-size: 14px; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 14px var(--font-head); color: var(--text);
  transition: color 0.25s var(--ease), gap 0.25s var(--ease);
}
.link-arrow svg { width: 15px; height: 15px; }
.link-arrow:hover { color: var(--bronze); gap: 12px; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100; height: var(--nav-h);
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s;
}
.nav.is-scrolled, .nav.is-open {
  background: rgba(16, 17, 22, 0.78);
  -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%);
  border-bottom-color: var(--border);
}
.nav__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand__mark { width: 36px; height: 36px; transition: transform 0.4s var(--ease); }
.brand:hover .brand__mark { transform: rotate(-8deg); }
.brand__word { font: 800 15px/1 var(--font-head); letter-spacing: 0.26em; margin-right: -0.26em; }

.nav__links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav__links a {
  position: relative; display: block; padding: 10px 14px;
  font: 500 14px var(--font-head); color: var(--text-2); transition: color 0.2s var(--ease);
}
.nav__links a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 1px;
  background: var(--bronze); transform: scaleX(0); transform-origin: left; transition: transform 0.3s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a[aria-current="page"] { color: var(--text); }
.nav__links a[aria-current="page"]::after { transform: scaleX(1); }
.nav__actions { display: flex; align-items: center; gap: 12px; }
.nav__toggle {
  display: none; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent; cursor: pointer; position: relative;
}
.nav__toggle span { position: absolute; left: 13px; right: 13px; height: 1.5px; background: var(--text); transition: transform 0.3s var(--ease), top 0.3s var(--ease); }
.nav__toggle span:nth-child(1) { top: 17px; }
.nav__toggle span:nth-child(2) { top: 25px; }
.nav.is-open .nav__toggle span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.nav.is-open .nav__toggle span:nth-child(2) { top: 21px; transform: rotate(-45deg); }

/* Language switcher */
.lang { position: relative; }
.lang__btn {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px 0 11px;
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer; list-style: none;
  font: 500 12px/1 var(--font-mono); letter-spacing: 0.1em; color: var(--text-2);
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.lang__btn::-webkit-details-marker { display: none; }
.lang__btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.lang__btn .lang__chev { width: 13px; height: 13px; transition: transform 0.25s var(--ease); }
.lang__btn:hover, .lang[open] .lang__btn { border-color: var(--bronze); color: var(--text); }
.lang[open] .lang__chev { transform: rotate(180deg); }
.lang__menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 120; min-width: 190px;
  margin: 0; padding: 6px; list-style: none;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  animation: lang-in 0.2s var(--ease);
}
@keyframes lang-in { from { opacity: 0; transform: translateY(-4px); } }
.lang__menu a {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  font: 500 15px/1 var(--font-head); color: var(--text-2);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.lang__menu a span { font: 500 11px/1 var(--font-mono); letter-spacing: 0.12em; color: var(--muted); }
.lang__menu a:hover { background: var(--bg-2); color: var(--text); }
.lang__menu a[aria-current="true"] { color: var(--text); }
.lang__menu a[aria-current="true"] span { color: var(--bronze); }
@media (prefers-reduced-motion: reduce) { .lang__menu { animation: none; } }

@media (max-width: 900px) {
  .nav__toggle { display: block; }
  .nav__actions .btn { display: none; }
  .nav__menu {
    position: fixed; inset: var(--nav-h) 0 auto 0; height: calc(100dvh - var(--nav-h));
    background: var(--bg); padding: 32px var(--gutter) 40px;
    display: flex; flex-direction: column; justify-content: space-between;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0.3s;
  }
  .nav.is-open .nav__menu { opacity: 1; visibility: visible; transform: none; }
  .nav__links { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__links li { border-bottom: 1px solid var(--border); }
  .nav__links a { padding: 20px 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); display: flex; justify-content: space-between; align-items: center; }
  .nav__links a::after { left: auto; right: 0; top: 50%; bottom: auto; width: 8px; height: 8px; border-radius: 50%; transform: translateY(-50%) scale(0); }
  .nav__links a[aria-current="page"]::after { transform: translateY(-50%) scale(1); }
  .nav__menu .btn { width: 100%; }
}
@media (min-width: 901px) { .nav__menu { display: contents; } .nav__menu-cta { display: none; } }
body.nav-locked { overflow: hidden; }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: min(100svh, 980px); display: flex; align-items: flex-end; overflow: hidden; isolation: isolate; }
.hero__media { position: absolute; inset: 0; z-index: -2; }
.hero__media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; transform: scale(1.06); animation: hero-settle 2.4s var(--ease) forwards; }
@keyframes hero-settle { to { transform: scale(1); } }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(16,17,22,0.72) 0%, rgba(16,17,22,0.15) 32%, rgba(16,17,22,0.55) 66%, var(--bg) 100%),
    linear-gradient(90deg, rgba(16,17,22,0.85) 0%, rgba(16,17,22,0.2) 70%);
}
.hero__content { padding-top: calc(var(--nav-h) + 80px); padding-bottom: clamp(56px, 8vw, 104px); width: 100%; }
.hero__label { margin-bottom: 28px; }
.hero__title { max-width: 13ch; }
.hero__title span { display: block; }
.hero__title .soft { color: var(--text-2); }
.hero__bottom { margin-top: 40px; display: grid; gap: 36px; }
@media (min-width: 900px) { .hero__bottom { grid-template-columns: minmax(0, 1fr) auto; align-items: end; } }
.hero__meta { display: flex; gap: 32px; flex-wrap: wrap; padding-top: 28px; margin-top: clamp(48px, 7vw, 88px); border-top: 1px solid rgba(244,244,242,0.12); }
.hero__meta div { display: grid; gap: 6px; }
.hero__meta dt { font: 500 11px var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.hero__meta dd { margin: 0; font: 500 14px var(--font-head); color: var(--text-2); }
.hero__scroll { display: none; }
@media (min-width: 900px) {
  .hero__scroll { display: inline-flex; align-items: center; gap: 12px; margin-left: auto; font: 500 11px var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
  .hero__scroll i { width: 1px; height: 36px; background: linear-gradient(var(--bronze), transparent); }
}

/* Page header (inner pages) */
.page-head { padding: calc(var(--nav-h) + clamp(72px, 10vw, 140px)) 0 clamp(56px, 7vw, 96px); border-bottom: 1px solid var(--border); position: relative; overflow: hidden; }
.page-head__grid { display: grid; gap: 28px; }
@media (min-width: 900px) { .page-head__grid { grid-template-columns: 1.3fr 1fr; align-items: end; gap: 64px; } }
.page-head .label { margin-bottom: 24px; }
.page-head__mark { position: absolute; right: -6%; top: 50%; width: min(52vw, 620px); transform: translateY(-46%); opacity: 0.035; pointer-events: none; }

/* ---------- Project cards ---------- */
.grid-work { display: grid; gap: clamp(20px, 2.4vw, 32px); grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid-work { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .grid-work--3 { grid-template-columns: repeat(3, 1fr); } }
.grid-work--featured > :first-child { grid-column: 1 / -1; }
.grid-work--featured > :first-child .card__media { aspect-ratio: 21 / 9; }
@media (max-width: 699px) { .grid-work--featured > :first-child .card__media { aspect-ratio: 4 / 3; } }

.card { position: relative; display: flex; flex-direction: column; gap: 20px; }
.card__media {
  position: relative; overflow: hidden; border-radius: var(--radius); aspect-ratio: 16 / 10;
  background: var(--card); border: 1px solid var(--border); transition: border-color 0.4s var(--ease);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease), opacity 0.5s; }
.card__media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(16,17,22,0.55)); pointer-events: none; }
.card__num { position: absolute; top: 16px; left: 18px; z-index: 1; font: 500 12px var(--font-mono); letter-spacing: 0.1em; color: var(--text); background: rgba(16,17,22,0.6); backdrop-filter: blur(8px); padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(244,244,242,0.12); }
.card:hover .card__media { border-color: var(--bronze); }
.card:hover .card__media img { transform: scale(1.04); }
.card__body { display: grid; gap: 10px; }
.card__meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card__cat { font: 500 11px var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--bronze); }
.card__status { font: 500 11px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 4px 8px; border: 1px solid var(--border); border-radius: 999px; }
.card__title { font-size: clamp(20px, 1.8vw, 24px); letter-spacing: -0.02em; }
.card__title a::before { content: ""; position: absolute; inset: 0; z-index: 2; }
.card__desc { color: var(--text-2); font-size: 15.5px; margin: 0; max-width: 52ch; }
.card .link-arrow { margin-top: 4px; }
.card:hover .link-arrow { color: var(--bronze); gap: 12px; }
.card.is-hidden { display: none; }
.card.is-entering { animation: card-in 0.45s var(--ease) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(12px); } }

/* Placeholder cover for projects without screenshots (development) */
.code-cover { position: absolute; inset: 0; background: radial-gradient(120% 90% at 85% 0%, rgba(166,140,104,0.12), transparent 60%), var(--card); display: flex; align-items: center; padding: clamp(20px, 4vw, 40px); }
.code-cover pre { margin: 0; font: 400 clamp(11px, 1.1vw, 13.5px)/1.8 var(--font-mono); color: var(--muted); white-space: pre; overflow: hidden; }
.code-cover .k { color: var(--bronze); }
.code-cover .s { color: var(--text-2); }
.code-cover .c { color: #50535e; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: clamp(36px, 5vw, 56px); }
.filter {
  display: inline-flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; cursor: pointer;
  font: 600 14px var(--font-head); color: var(--text-2);
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease), background-color 0.25s var(--ease);
}
.filter sup { font: 500 11px var(--font-mono); color: var(--muted); }
.filter:hover { color: var(--text); border-color: #464854; }
.filter[aria-pressed="true"] { color: var(--bg); background: var(--text); border-color: var(--text); }
.filter[aria-pressed="true"] sup { color: var(--bg); opacity: 0.6; }
.work-count { font: 500 12px var(--font-mono); letter-spacing: 0.1em; color: var(--muted); margin-left: auto; align-self: center; text-transform: uppercase; }
.empty-state { padding: 64px 0; text-align: center; color: var(--muted); }

/* ---------- Services ---------- */
.services-split { display: grid; gap: 20px; }
@media (min-width: 900px) { .services-split { grid-template-columns: 1fr 1fr; } }
.service-panel {
  position: relative; display: flex; flex-direction: column; gap: 32px; overflow: hidden;
  padding: clamp(28px, 4vw, 48px); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); transition: border-color 0.4s var(--ease);
}
.service-panel:hover { border-color: #464854; }
.service-panel__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.service-panel__icon { width: 52px; height: 52px; border-radius: 12px; border: 1px solid var(--border); display: grid; place-items: center; color: var(--bronze); background: var(--bg-2); }
.service-panel__icon svg { width: 24px; height: 24px; }
.service-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.service-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); font: 500 16px var(--font-head); color: var(--text-2); transition: color 0.25s var(--ease), padding 0.25s var(--ease); }
.service-list li span { font: 500 11px var(--font-mono); color: var(--muted); letter-spacing: 0.1em; }
.service-panel:hover .service-list li { color: var(--text); }

/* Services page detail rows */
.svc-group { display: grid; gap: clamp(32px, 4vw, 56px); }
.svc-group + .svc-group { margin-top: var(--section); }
.svc-group__head { display: grid; gap: 20px; padding-bottom: 32px; border-bottom: 1px solid var(--border); }
@media (min-width: 900px) { .svc-group__head { grid-template-columns: 1fr 1fr; align-items: end; } }
.svc { display: grid; gap: 28px; padding: clamp(28px, 3vw, 40px) 0; border-bottom: 1px solid var(--border); }
@media (min-width: 900px) { .svc { grid-template-columns: 80px minmax(0, 1fr) minmax(0, 1.1fr) 320px; gap: 40px; align-items: start; } }
.svc__num { font: 500 12px var(--font-mono); color: var(--bronze); letter-spacing: 0.1em; padding-top: 6px; }
.svc__title { font-size: clamp(22px, 2.2vw, 28px); }
.svc__text { color: var(--text-2); margin: 0; }
.svc__deliver { margin: 18px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.svc__deliver li { font: 500 12px var(--font-mono); color: var(--text-2); padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; }
.svc__visual { aspect-ratio: 16 / 10; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: var(--card); position: relative; }
.svc__visual img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease); }
.svc:hover .svc__visual img { transform: scale(1.04); }
.svc__visual .code-cover pre { font-size: 11px; }

/* ---------- About / split blocks ---------- */
.split { display: grid; gap: clamp(40px, 6vw, 96px); align-items: center; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; } .split--reverse > :first-child { order: 2; } }
.frame { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); aspect-ratio: 4 / 5; background: var(--card); }
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame__tag { position: absolute; left: 16px; bottom: 16px; font: 500 11px var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-2); background: rgba(16,17,22,0.7); backdrop-filter: blur(8px); padding: 8px 12px; border-radius: 999px; border: 1px solid rgba(244,244,242,0.1); }
.stack { display: grid; gap: 28px; }
.stack .btn-row { margin-top: 12px; }

.principles { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 700px) { .principles { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .principles--3 { grid-template-columns: repeat(3, 1fr); } }
.principle { background: var(--bg); padding: clamp(28px, 3.4vw, 44px); display: grid; gap: 16px; align-content: start; }
.section--alt .principle { background: var(--bg-2); }
.principle__num { font: 500 12px var(--font-mono); color: var(--bronze); letter-spacing: 0.1em; }
.principle h3 { font-size: 22px; }
.principle p { color: var(--text-2); margin: 0; font-size: 16px; }

.quote { font: 700 clamp(28px, 4vw, 52px)/1.12 var(--font-head); letter-spacing: -0.035em; max-width: 22ch; margin: 0; }
.quote em { font-style: normal; color: var(--bronze); }

/* ---------- CTA ---------- */
.cta { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: calc(var(--radius) + 6px); padding: clamp(48px, 8vw, 112px) clamp(28px, 6vw, 88px); background: var(--bg-2); isolation: isolate; }
.cta__mark { position: absolute; right: -80px; bottom: -120px; width: 460px; opacity: 0.05; z-index: -1; transition: transform 1.2s var(--ease); }
.cta:hover .cta__mark { transform: rotate(-6deg) scale(1.03); }
.cta__inner { display: grid; gap: 28px; max-width: 720px; }

/* ---------- Project detail ---------- */
.project-hero { padding-top: calc(var(--nav-h) + clamp(48px, 7vw, 96px)); }
.back-link { display: inline-flex; align-items: center; gap: 8px; font: 500 13px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 40px; transition: color 0.2s, gap 0.25s var(--ease); }
.back-link svg { width: 14px; height: 14px; transform: rotate(180deg); }
.back-link:hover { color: var(--text); gap: 12px; }
.project-hero__head { display: grid; gap: 24px; margin-bottom: clamp(40px, 5vw, 64px); }
@media (min-width: 900px) { .project-hero__head { grid-template-columns: 1.4fr 1fr; align-items: end; gap: 64px; } }
.project-cover { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); aspect-ratio: 21 / 9; background: var(--card); position: relative; }
.project-cover img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 699px) { .project-cover { aspect-ratio: 4 / 3; } }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; border-top: 1px solid var(--border); margin: 0; }
@media (min-width: 900px) { .facts { grid-template-columns: repeat(4, 1fr); } }
.facts div { padding: 22px 0; border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
.facts dt { font: 500 11px var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; font: 600 15px var(--font-head); }
.project-body { display: grid; gap: clamp(40px, 6vw, 96px); }
.project-body > * { min-width: 0; }
@media (min-width: 900px) { .project-body { grid-template-columns: 280px minmax(0, 1fr); } }
.project-body aside { display: grid; gap: 32px; align-content: start; align-self: start; }
@media (min-width: 900px) { .project-body aside { position: sticky; top: calc(var(--nav-h) + 32px); } }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 14px 0 0; padding: 0; }
.tag-list li { font: 500 12px var(--font-mono); padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.check-list li { position: relative; padding-left: 26px; color: var(--text-2); }
.check-list li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 12px; height: 1px; background: var(--bronze); }
.project-block + .project-block { margin-top: 56px; }
.project-block h2 { font-size: clamp(22px, 2.2vw, 28px); margin-bottom: 20px; }
.placeholder-note { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border: 1px dashed #464854; border-radius: var(--radius-sm); color: var(--muted); font-size: 14.5px; margin-bottom: 40px; }
.placeholder-note b { color: var(--text-2); font-weight: 600; }
.placeholder-note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; color: var(--bronze); }
.code-block { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 20px 22px; overflow-x: auto; font: 400 13.5px/1.75 var(--font-mono); color: var(--text-2); margin: 0; }
.code-block .k { color: var(--bronze); }
.code-block .c { color: var(--muted); }

.gallery { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .gallery { grid-template-columns: repeat(2, 1fr); } .gallery > :first-child { grid-column: 1 / -1; } }
.gallery button { padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--card); cursor: zoom-in; aspect-ratio: 16 / 9; transition: border-color 0.3s var(--ease); }
.gallery button:hover { border-color: var(--bronze); }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease); }
.gallery button:hover img { transform: scale(1.03); }

.lightbox { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; width: 100vw; height: 100dvh; }
.lightbox::backdrop { background: rgba(10, 10, 14, 0.94); backdrop-filter: blur(6px); }
.lightbox[open] { display: grid; place-items: center; animation: fade 0.25s var(--ease); }
.lightbox img { max-width: calc(100vw - 32px); max-height: calc(100dvh - 120px); border-radius: var(--radius-sm); }
.lightbox__bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center; gap: 12px; padding: 20px; }
.lightbox__bar span { font: 500 12px var(--font-mono); color: var(--muted); min-width: 64px; text-align: center; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); display: grid; place-items: center; cursor: pointer; transition: border-color 0.2s; }
.icon-btn:hover { border-color: var(--bronze); }
.icon-btn svg { width: 16px; height: 16px; }
.lightbox__close { position: fixed; top: 16px; right: 16px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: clamp(48px, 6vw, 96px); }
@media (min-width: 960px) { .contact-grid { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); } }
.contact-aside { display: grid; gap: 20px; align-content: start; }
.contact-card { padding: 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); display: grid; gap: 14px; }
.contact-card h2 { font-size: 20px; }
.contact-card p { color: var(--text-2); margin: 0; font-size: 15.5px; }
.form { display: grid; gap: 22px; }
.form__row { display: grid; gap: 22px; }
@media (min-width: 640px) { .form__row { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 10px; }
.field label { font: 600 14px var(--font-head); display: flex; justify-content: space-between; gap: 8px; }
.field label small { font: 400 12px var(--font-mono); color: var(--muted); letter-spacing: 0.04em; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 52px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
  -webkit-appearance: none; appearance: none;
}
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%23A1A1AA' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }
.field textarea { min-height: 170px; resize: vertical; line-height: 1.6; }
.field ::placeholder { color: var(--muted); }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #464854; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--bronze); background: var(--card); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: #c2675e; }
.form-gate { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; border: 1px solid rgba(166,140,104,0.45); border-radius: var(--radius-sm); background: var(--bronze-soft); }
.form-gate p { margin: 0; flex: 1 1 260px; font-size: 15px; color: var(--text-2); }
.form-gate strong { color: var(--text); font-weight: 600; }
.form-gate__icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-2); color: var(--bronze); flex-shrink: 0; }
.form-gate__icon svg { width: 20px; height: 20px; }
.contact-card strong { color: var(--text); font-weight: 600; }
.field__control { position: relative; display: flex; align-items: center; }
.field__prefix { position: absolute; left: 16px; color: var(--muted); font: 500 15px var(--font-mono); pointer-events: none; }
.field--discord input { padding-left: 36px; padding-right: 52px; font-family: var(--font-mono); font-size: 15px; }
.field__avatar { position: absolute; right: 12px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); }
.field__hint { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.field__hint.is-checking::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
.field__hint.is-ok { color: #b7c9a8; }
.field__hint.is-ok::before { content: "✓"; color: var(--bronze); font-weight: 700; }
.field__hint.is-warn { color: #d9b38a; }
.field.is-verified input { border-color: rgba(166,140,104,0.7); }
.field__error { font-size: 13px; color: #d98a80; min-height: 0; }
.field__error:empty { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 8px; }
.form__foot p { margin: 0; font-size: 13.5px; color: var(--muted); max-width: 40ch; }
.form__foot a { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; }
.form-status { display: none; gap: 12px; align-items: flex-start; padding: 16px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 15px; }
.form-status.is-visible { display: flex; animation: fade 0.3s var(--ease); }
.form-status.is-success { border-color: rgba(166,140,104,0.5); background: var(--bronze-soft); color: var(--text); }
.form-status.is-error { border-color: rgba(194,103,94,0.5); background: rgba(194,103,94,0.08); color: #e8b3ac; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; display: none; }
.btn.is-loading .spinner { display: block; }
.btn.is-loading svg { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Legal ---------- */
.legal { max-width: 760px; }
.legal h2 { font-size: 22px; margin: 48px 0 16px; }
.legal p, .legal li { color: var(--text-2); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: clamp(64px, 8vw, 104px) 0 32px; background: var(--bg); }
.footer__top { display: grid; gap: 48px; padding-bottom: clamp(48px, 6vw, 80px); }
@media (min-width: 900px) { .footer__top { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer__brand { display: grid; gap: 20px; align-content: start; }
.footer__brand .brand__mark { width: 40px; height: 40px; }
.footer__tag { color: var(--text-2); margin: 0; max-width: 28ch; font-size: 16px; }
.footer h2 { font: 500 11px var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 18px; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer ul a { color: var(--text-2); font: 500 15px var(--font-head); transition: color 0.2s; }
.footer ul a:hover { color: var(--bronze); }
.footer__word { font: 800 clamp(56px, 15.5vw, 220px)/0.8 var(--font-head); letter-spacing: -0.04em; color: transparent; -webkit-text-stroke: 1px var(--border); text-align: center; user-select: none; margin: 0 0 clamp(32px, 4vw, 56px); white-space: nowrap; overflow: hidden; }
.footer__bottom { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; padding-top: 24px; border-top: 1px solid var(--border); font: 500 12px var(--font-mono); letter-spacing: 0.06em; color: var(--muted); }
.footer__bottom a:hover { color: var(--text); }

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


/* 404 */
.notfound { min-height: 100svh; display: grid; place-items: center; text-align: center; padding: 120px var(--gutter); }
.notfound .brand__mark { width: 72px; height: 72px; margin: 0 auto 32px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
