/* ---------- Tokens ---------- */
html.light {
  --background: #f9f8f6;
  --foreground: #0e0d0b;
  --card: #ffffff;
  --muted: #efeeeb;
  --muted-foreground: #646360;
  --border: #dfdedb;
  --accent: #f17070;
  --accent-foreground: #fcfcfc;
  --primary: #121210;
  --primary-foreground: #f9f8f6;
}

html.dark {
  --background: #080706;
  --foreground: #f6f5f3;
  --card: #100f0d;
  --muted: #1b1a18;
  --muted-foreground: #908f8c;
  --border: #ffffff1a;
  --accent: #f97676;
  --accent-foreground: #080706;
  --primary: #f6f5f3;
  --primary-foreground: #0e0d0b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--background);
  color: var(--foreground);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  transition: background-color .3s ease, color .3s ease;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img { max-width: 100%; display: block; }
svg { width: 1em; height: 1em; }
ul { list-style: none; margin: 0; padding: 0; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 640px) { .wrap { padding: 0 32px; } }

.muted { color: var(--muted-foreground); }
.accent-dot { color: var(--accent); }

.eyebrow-label {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--accent);
}

.section { padding: 80px 0; border-top: 1px solid var(--border); scroll-margin-top: 64px; }
@media (min-width: 768px) { .section { padding: 112px 0; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  transition: transform .3s ease, background-color .2s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; transition: transform .3s ease; }
.btn:hover svg { transform: translate(2px, -2px); }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { transform: scale(1.03); }
.btn-outline { border: 1px solid var(--border); }
.btn-outline:hover { background: var(--muted); }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  transition: background-color .4s ease, border-color .4s ease, backdrop-filter .4s ease;
}
.site-header.scrolled {
  background: color-mix(in srgb, var(--background) 92%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav {
  max-width: 1200px;
  margin: 0 auto;
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
@media (min-width: 640px) { .nav { padding: 0 32px; } }

.logo {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.nav-links { display: none; align-items: center; gap: 36px; }
.nav-links a {
  position: relative;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted-foreground);
  transition: color .2s ease;
}
.nav-links a:hover { color: var(--foreground); }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width .3s ease;
}
.nav-links a:hover::after { width: 100%; }

@media (min-width: 900px) { .nav-links { display: flex; } }

.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-cta { display: none; }
@media (min-width: 640px) { .nav-cta { display: inline-flex; } }

.menu-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.menu-toggle svg { width: 20px; height: 20px; }
@media (min-width: 900px) { .menu-toggle { display: none; } }

.mobile-menu {
  max-height: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--background) 95%, transparent);
  backdrop-filter: blur(20px);
  transition: max-height .3s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mobile-menu.open { max-height: 320px; border-top: 1px solid var(--border); }
.mobile-menu a {
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 500;
  border-radius: 10px;
}
.mobile-menu a:hover { background: var(--muted); }
@media (min-width: 900px) { .mobile-menu { display: none; } }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 128px 0 88px; overflow: hidden; }
@media (min-width: 768px) { .hero { padding: 176px 0 120px; } }

.hero::before {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background-image: radial-gradient(circle, color-mix(in srgb, var(--foreground) 16%, transparent) 1px, transparent 1.5px);
  background-size: 24px 24px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 80%);
          mask-image: linear-gradient(to bottom, black, transparent 80%);
  z-index: 0;
  pointer-events: none;
}
@media (min-width: 640px) {
  .hero::before { background-size: 28px 28px; }
}
.hero::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: radial-gradient(340px circle at 82% -6%, color-mix(in srgb, var(--accent) 32%, transparent) 0%, transparent 72%);
  z-index: 0;
  pointer-events: none;
}
@media (min-width: 640px) {
  .hero::after { background: radial-gradient(480px circle at 85% -8%, color-mix(in srgb, var(--accent) 30%, transparent) 0%, transparent 72%); }
}
@media (min-width: 1024px) {
  .hero::after { background: radial-gradient(650px circle at 88% -8%, color-mix(in srgb, var(--accent) 28%, transparent) 0%, transparent 72%); }
}
.hero > .wrap { position: relative; z-index: 1; }

.hero-title {
  display: block;
  font-size: clamp(2.5rem, 9vw, 8.5rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.03em;
}
.hero-title span { display: block; }

.hero-row {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
@media (min-width: 768px) { .hero-row { flex-direction: row; align-items: flex-end; justify-content: space-between; } }
.hero-lead { max-width: 460px; font-size: 16px; }
@media (min-width: 768px) { .hero-lead { font-size: 18px; } }
.hero-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.scroll-hint {
  margin: 56px auto 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--muted-foreground);
  transition: color .2s ease;
}
.scroll-hint:hover { color: var(--foreground); }
.scroll-hint svg { animation: float 2.4s ease-in-out infinite; }

/* ---------- Reveal / fade animations ---------- */
.fade-up { opacity: 0; }
.fade-up.play { animation: fadeUp .9s cubic-bezier(.22,1,.36,1) forwards; }
.fade-up.d1.play { animation-delay: .05s; }
.fade-up.d2.play { animation-delay: .18s; }
.fade-up.d3.play { animation-delay: .32s; }

.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s cubic-bezier(.22,1,.36,1); }
.reveal.visible { opacity: 1; transform: translateY(0); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

@media (prefers-reduced-motion: reduce) {
  .fade-up, .reveal { opacity: 1 !important; transform: none !important; animation: none !important; transition: none !important; }
  .scroll-hint svg { animation: none !important; }
}

/* ---------- Section head ---------- */
.section-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (min-width: 768px) { .section-head { flex-direction: row; align-items: flex-end; justify-content: space-between; } }
.section-head h2 { margin-top: 12px; font-size: 36px; font-weight: 600; letter-spacing: -0.02em; }
@media (min-width: 640px) { .section-head h2 { font-size: 48px; } }
.section-intro { max-width: 340px; }

/* ---------- Services ---------- */
.grid-cards {
  margin-top: 48px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--border);
}
@media (min-width: 640px) { .grid-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-cards { grid-template-columns: repeat(3, 1fr); } }

.card {
  position: relative;
  background: var(--card);
  padding: 28px;
  transition: background-color .3s ease;
}
@media (min-width: 640px) { .card { padding: 36px; } }
.card:hover { background: var(--muted); }
.card h3 { margin-top: 24px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.card p { margin-top: 8px; line-height: 1.6; }
.card-number {
  position: absolute;
  top: 28px; right: 28px;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 12px;
  color: color-mix(in srgb, var(--muted-foreground) 60%, transparent);
}

.icon-badge {
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--background);
  transition: border-color .3s ease, color .3s ease;
}
.icon-badge svg { width: 20px; height: 20px; }
.card:hover .icon-badge { border-color: var(--accent); color: var(--accent); }

/* ---------- Portfolio ---------- */
.grid-portfolio {
  margin-top: 48px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 768px) { .grid-portfolio { grid-template-columns: repeat(2, 1fr); gap: 32px; } }

.project-link { display: block; }
.project-image {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--muted);
}
.project-image img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .7s cubic-bezier(.22,1,.36,1);
}
.project-link:hover .project-image img { transform: scale(1.04); }
.project-view {
  position: absolute;
  right: 16px; bottom: 16px;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--background);
  font-size: 14px; font-weight: 500;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .4s ease, transform .4s ease;
}
.project-link:hover .project-view { opacity: 1; transform: translateY(0); }
.project-view svg { width: 15px; height: 15px; }

.project-meta { margin-top: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.project-meta h3 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.project-meta p { margin-top: 4px; font-size: 14px; }
.project-year { font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace; font-size: 14px; color: var(--muted-foreground); }

.chips { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--muted-foreground);
}

/* ---------- Studio ---------- */
.studio-statement {
  margin-top: 24px;
  max-width: 780px;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.studio-statement span { display: inline; }
@media (min-width: 640px) { .studio-statement { font-size: 36px; } }

.capability-list {
  margin-top: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 32px;
}
.capability-list li {
  position: relative;
  padding-left: 18px;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted-foreground);
}
.capability-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 5px; height: 5px;
  border-radius: 999px;
  background: var(--accent);
}

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: 48px; }
@media (min-width: 1024px) { .contact-grid { grid-template-columns: 1fr 1fr; gap: 64px; } }
.contact-grid h2 { margin-top: 12px; font-size: 36px; font-weight: 600; letter-spacing: -0.02em; }
@media (min-width: 640px) { .contact-grid h2 { font-size: 48px; } }
@media (min-width: 768px) { .contact-grid h2 { font-size: 56px; } }
.contact-grid .section-intro { margin-top: 24px; max-width: 400px; font-size: 18px; }
.contact-email { margin-top: 40px; font-size: 14px; }
.contact-email a { font-weight: 500; color: var(--foreground); text-decoration: underline; text-underline-offset: 4px; }

.contact-form { display: flex; flex-direction: column; gap: 20px; }
.form-row { display: grid; gap: 20px; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } }
.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  color: inherit;
  outline: none;
  transition: border-color .2s ease;
}
.contact-form textarea { resize: none; }
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--muted-foreground); }
.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--accent); }
.contact-form .btn { justify-content: center; padding: 16px 24px; }
.form-status { font-size: 14px; min-height: 20px; color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 64px 0; }
.footer-grid { display: grid; gap: 40px 32px; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1160px) { .footer-grid { grid-template-columns: 1.2fr 1fr 1fr 1.3fr; gap: 48px; } }
.footer-tagline { margin-top: 16px; max-width: 260px; font-size: 14px; line-height: 1.6; }
.footer-email { margin-top: 14px; display: inline-block; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; transition: color .2s ease; }
.footer-email:hover { color: var(--foreground); }

.footer-nav { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.footer-nav a { font-size: 14px; color: color-mix(in srgb, var(--foreground) 80%, transparent); }
.footer-nav a:hover { color: var(--foreground); }

.settings-row { margin-top: 20px; display: flex; flex-direction: column; flex-wrap: wrap; gap: 24px; }
@media (min-width: 480px) { .settings-row { flex-direction: row; gap: 32px 40px; } }
.setting-label { margin-bottom: 10px; font-size: 14px; }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.segmented button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 999px; font-size: 14px;
  color: var(--muted-foreground);
  transition: background-color .2s ease, color .2s ease;
}
.segmented button svg { width: 16px; height: 16px; }
.segmented button:hover { color: var(--foreground); }
.segmented button[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); }

.select-wrap { position: relative; display: inline-block; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: inherit;
  font: inherit;
  font-size: 16px;
  border-radius: 999px;
  padding: 11px 38px 11px 16px;
  cursor: pointer;
  outline: none;
  transition: border-color .2s ease;
}
.select-wrap select:hover { border-color: color-mix(in srgb, var(--foreground) 30%, var(--border)); }
.select-wrap select:focus { border-color: var(--accent); }
.select-caret { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; pointer-events: none; color: var(--muted-foreground); }

.footer-bottom {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted-foreground);
}

/* ---------- Legal pages ---------- */
.legal-header { border-bottom: 1px solid var(--border); }
.legal-header-inner { height: 64px; display: flex; align-items: center; justify-content: space-between; }
.back-link { font-size: 14px; color: var(--muted-foreground); transition: color .2s ease; }
.back-link:hover { color: var(--foreground); }

.legal-page { max-width: 720px; padding-top: 64px; padding-bottom: 96px; }
.legal-page h1 { margin-top: 12px; font-size: 36px; font-weight: 600; letter-spacing: -0.02em; }
.legal-updated { margin-top: 10px; font-size: 14px; }

.legal-notice {
  margin-top: 32px;
  padding: 20px 24px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.legal-page section { margin-top: 40px; }
.legal-page h2 { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.legal-page section p,
.legal-page section li { margin-top: 12px; line-height: 1.75; font-size: 15px; }
.legal-page section ul { margin-top: 12px; padding-left: 20px; list-style: disc; }
.legal-page section ul li { margin-top: 6px; }
.legal-page a { text-decoration: underline; text-underline-offset: 3px; }

.legal-footer { border-top: 1px solid var(--border); padding: 32px 0; font-size: 14px; }

/* ---------- 404 page ---------- */
.error-page {
  min-height: calc(100dvh - 65px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}
.error-code {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: clamp(4.5rem, 16vw, 9rem);
  font-weight: 600;
  line-height: 1;
  color: var(--accent);
}
.error-title { margin-top: 20px; font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
@media (min-width: 640px) { .error-title { font-size: 34px; } }
.error-text { margin-top: 12px; max-width: 420px; line-height: 1.6; }
.error-actions { margin-top: 36px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
