/* ==========================================================
   DESIGN TOKENS
   ========================================================== */
:root {
  --bg: #0a0a0d;
  --bg-elevated: #131318;
  --bg-elevated-2: #191920;
  --border: #232329;
  --text: #e8e8ea;
  --text-muted: #8a8a94;

  --accent: #e6394a;
  --accent-dim: #7a1f2a;
  --accent-soft: rgba(230, 57, 74, 0.12);

  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --font-body: 'Manrope', system-ui, -apple-system, sans-serif;

  --radius: 8px;
  --max-width: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ==========================================================
   SCROLLBARS — styled to match the site everywhere
   (page scrollbar, textareas, any overflow area)
   ========================================================== */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) var(--bg-elevated);
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-elevated);
}
::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: 999px;
  border: 2px solid var(--bg-elevated);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ==========================================================
   CURSOR TRAIL CANVAS — thin red trail following the cursor
   ========================================================== */
#trail-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  pointer-events: none;
}

/* ==========================================================
   BACKGROUND CANVAS
   ========================================================== */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

header, main, footer { position: relative; z-index: 1; }

/* ==========================================================
   TOPBAR
   ========================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 0 24px;
  min-height: 48px;
  background: rgba(19, 19, 24, 0.75);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.topbar__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  align-self: center;
}
.topbar__logo img {
  height: 28px;
  width: auto;
  display: block;
}

.topbar__dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-self: center;
}.topbar__dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}
.topbar__dots span:nth-child(1) { background: var(--accent); }
.topbar__dots span:nth-child(2) { background: #55555f; }
.topbar__dots span:nth-child(3) { background: #33333b; }

/* CTA buttons — centered, fill height, hang below topbar bottom */
.topbar__cta {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 10px;
}

.topbar__cta .btn {
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: none;
  padding: 10px 20px 12px;
  font-size: 0.82rem;
}

/* Lang switch — pushed to the right */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin-left: auto;
  align-self: center;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}
.lang-switch button {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button.is-active { color: #0a0a0d; background: var(--accent); }

/* Legacy tab styles (kept for contact page fallback) */
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tab {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius) var(--radius) 0 0;
  white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; background: var(--bg-elevated-2); }
.tab--active {
  color: var(--accent);
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: 1px solid var(--bg);
}
.menu-toggle { display: none; }

@media (max-width: 480px) {
  .topbar__cta { gap: 6px; }
  .topbar__cta .btn { padding: 8px 12px 10px; font-size: 0.76rem; }
}

.topbar__cta .btn--active-page {
  border-color: var(--accent);
  color: var(--accent);
}
.topbar__cta .btn--primary.btn--active-page {
  background: var(--accent);
  color: #0a0a0d;
}

/* ==========================================================
   HERO
   ========================================================== */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 24px 52px;
  position: relative;
}

.hero__socials {
  position: absolute;
  top: 56px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
}
.hero__socials a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text-muted);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.hero__socials a:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}
.hero__socials svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 900px) {
  .hero__socials {
    position: static;
    flex-direction: row;
    margin-bottom: 24px;
  }
}

.hero__content { max-width: 680px; }

.hero__tagline {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 14px;
}

.hero__title {
  font-family: var(--font-body);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 18px;
  color: var(--text);
}

.hero__lead {
  margin: 0 0 40px;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 58ch;
  line-height: 1.7;
}

.hero__services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.hero__service {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.2s ease;
}
.hero__service:hover { border-color: var(--accent); }

.hero__service-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.hero__service strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
  margin-bottom: 4px;
}

.hero__service p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.hero__bottom {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.hero__cta-text {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.hero__cta { display: flex; gap: 14px; margin-top: 32px; flex-wrap: wrap; }

@media (max-width: 480px) {
  .hero__services { grid-template-columns: 1fr; }
  .hero__bottom { flex-direction: column; align-items: flex-start; }
}

/* ==========================================================
   BUTTONS
   ========================================================== */
.btn {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--accent); color: #0a0a0d; font-weight: 700; }
.btn--primary:hover { background: #ff5566; }
.btn--ghost { border-color: var(--border); color: var(--text); background: transparent; }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--small { padding: 8px 14px; font-size: 0.8rem; }

/* ==========================================================
   SECTIONS (shared)
   ========================================================== */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 24px 80px;
  border-top: 1px solid var(--border);
}

.section__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.section__title {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  margin: 0 0 28px;
}

/* FILTERS */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }

.filter-btn {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.filter-btn:hover { color: var(--text); border-color: var(--text-muted); }
.filter-btn.is-active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* PROJECTS */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 28px;
}

.project-grid__empty {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  margin-top: 12px;
}

.project-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.card-wrapper {
  display: flex;
  flex-direction: column;
  padding-top: 36px;
  position: relative;
}

.media-tabs {
  position: absolute;
  top: 0;
  left: 12px;
  display: flex;
  gap: 0;
}

.media-tab {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  padding: 7px 16px;
  cursor: pointer;
  margin-right: 4px;
  transition: color 0.15s, background 0.15s;
  height: 36px;
  box-sizing: border-box;
}
.media-tab:hover { color: var(--text); background: var(--bg-elevated); }
.media-tab--active {
  color: var(--accent);
  background: var(--bg-elevated);
  border-color: var(--border);
  border-bottom-color: var(--bg-elevated);
}

.card-wrapper .project-card { border-top-left-radius: 0; }

.media-panel { display: none; }
.media-panel--active { display: block; }

.carousel--infinite { scroll-snap-type: x mandatory; }

.project-card__media {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-elevated-2);
  position: relative;
  overflow: hidden;
}

.project-card__media--portrait { aspect-ratio: 582 / 1280; }

.project-card__media--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-transform: lowercase;
  color: var(--text-muted);
  background: linear-gradient(135deg, var(--bg-elevated-2), var(--accent-dim) 180%);
}

.carousel-wrap { overflow: hidden; }

.carousel {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) transparent;
}
.carousel::-webkit-scrollbar { height: 5px; }
.carousel::-webkit-scrollbar-track { background: transparent; }
.carousel::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: 999px;
  border: none;
}
.carousel::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.carousel__slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
}
.carousel__slide img,
.carousel__slide iframe,
.project-card__media iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  object-fit: cover;
}

.project-card__media--portrait .carousel__slide img {
  object-fit: contain;
  background: var(--bg-elevated-2);
}

.carousel__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(10, 10, 13, 0.65);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.carousel-wrap:hover .carousel__arrow,
.carousel__arrow:focus-visible { opacity: 1; }
.carousel__arrow:hover { background: var(--accent); color: #0a0a0d; }
.carousel__arrow--prev { left: 10px; }
.carousel__arrow--next { right: 10px; }

.carousel__dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}
.carousel__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: rgba(232, 232, 234, 0.4);
  cursor: pointer;
}
.carousel__dot.is-active { background: var(--accent); }

@media (hover: none) { .carousel__arrow { opacity: 1; } }

.project-card__body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
}

.project-card__category {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent);
  text-transform: lowercase;
}

.project-card h3 { margin: 0; font-size: 1.25rem; }

.project-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  flex-grow: 1;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 4px;
}

.project-card__links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}
.project-card__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.downloads-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  padding: 6px 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

.project-card__badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  white-space: nowrap;
  flex-shrink: 0;
}
.rating-badge__star {
  color: #f5b942;
  line-height: 1;
}

@media (max-width: 480px) {
  .project-grid { grid-template-columns: 1fr; gap: 20px; }
  .project-card__body { padding: 18px; }
}

/* ============================================================
   PORTRAIT CARD
   ============================================================ */
.card-wrapper--portrait {
  grid-column: 1 / -1;
  padding-top: 0;
}

.card-wrapper--portrait .project-card {
  flex-direction: row;
  border-top-left-radius: var(--radius);
  max-height: 730px;
}

.card-wrapper--portrait .media-body {
  flex: 0 0 auto;
  width: 40%;
  min-width: 200px;
  max-width: 340px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.card-wrapper--portrait .media-tabs {
  position: relative;
  top: auto;
  left: auto;
  padding: 8px 10px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  width: 100%;
}

.card-wrapper--portrait .media-panel[data-panel="video"],
.card-wrapper--portrait .media-panel[data-panel="video"] .project-card__media {
  height: 100%;
  aspect-ratio: unset;
}

.card-wrapper:not(.card-wrapper--portrait) .media-panel[data-panel="video"] .project-card__media {
  aspect-ratio: 16 / 9;
}

.card-wrapper--portrait .media-panel--active {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card-wrapper--portrait .media-panel--active .carousel-wrap,
.card-wrapper--portrait .media-panel--active .project-card__media { flex: 1; }

.card-wrapper--portrait .project-card__media {
  height: 100%;
  aspect-ratio: unset !important;
}

.card-wrapper--portrait .project-card__body {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

@media (max-width: 600px) {
  .card-wrapper--portrait { grid-column: auto; }
  .card-wrapper--portrait .project-card { flex-direction: column; max-height: none; }
  .card-wrapper--portrait .media-body { width: 100%; max-width: none; }
  .card-wrapper--portrait .project-card__media { aspect-ratio: 582 / 1280 !important; height: auto; max-height: 480px; }
}

/* ==========================================================
   CONTACT FORM
   ========================================================== */
.section--contact { max-width: 640px; }

.contact-form { display: flex; flex-direction: column; gap: 18px; margin-top: 32px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.field input,
.field textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 12px 14px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus { outline: none; border-color: var(--accent); }

.field-hint { margin: 0; font-size: 0.8rem; color: var(--text-muted); min-height: 1.1em; }
.field-hint.is-error { color: var(--accent); }

.form-status { font-family: var(--font-mono); font-size: 0.85rem; min-height: 1.2em; margin: 0; }
.form-status.is-success { color: #7fd88f; }
.form-status.is-error { color: var(--accent); }

/* ==========================================================
   BUY PAGE
   ========================================================== */
.section--buy { max-width: 680px; }

.app-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 36px;
}

.app-pick-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
  width: 100%;
}
.app-pick-card:hover { border-color: var(--text-muted); }
.app-pick-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.app-pick-card--locked { cursor: default; }

.app-pick-card__name {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 600;
}

.app-pick-card__price {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}

.buy-form { margin-top: 0; }

.buy-form__note {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.field-optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.buy-notice {
  max-width: 680px;
  margin: 24px auto 0;
  padding: 14px 18px;
  background: rgba(230, 57, 74, 0.08);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.buy-notice__icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 2px; }
.buy-notice p { margin: 0; }
.buy-notice p + p { margin-top: 6px; }

/* ==========================================================
   FOOTER
   ========================================================== */
.footer {
  text-align: center;
  padding: 32px 24px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

/* ==========================================================
   FEATURE LIST (Easy Estimate description)
   ========================================================== */
.feature-list { padding-left: 32px; }
.feature-list li { margin-bottom: 1px; }
.feature-list strong {
  color: #e6394a;
  display: block;
  margin-top: 12px;
  margin-bottom: -30px;
}