/* ============================================
   AP Lab — Creative Technology Studio
   Redesign V2
   ============================================ */

:root {
  --bg: #171D1D;
  --bg-surface: #1E2626;
  --accent: #D4F474;
  --accent-dim: rgba(212, 244, 116, 0.12);
  --accent-glow: rgba(212, 244, 116, 0.06);
  --text: #F8F9F4;
  --text-mid: rgba(248, 249, 244, 0.7);
  --muted: #AAB8AF;
  --muted-dim: rgba(170, 184, 175, 0.4);
  --border: rgba(170, 184, 175, 0.12);

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --max-w: 1120px;
  --gutter: 24px;
  --section-py: 120px;
  --header-h: 72px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 500ms;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-mid);
  background: var(--bg);
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { border: none; background: none; cursor: pointer; font: inherit; color: inherit; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Container ---- */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---- Typography ---- */
h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--text);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.section-title {
  font-size: clamp(28px, 4vw, 44px);
  max-width: 640px;
  margin-bottom: 20px;
}

.section-intro {
  font-size: 17px;
  line-height: 1.75;
  color: var(--muted);
  max-width: 560px;
  margin-bottom: 64px;
}

/* ---- Section ---- */
.section {
  padding: var(--section-py) 0;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  transition: all 200ms var(--ease);
  white-space: nowrap;
}

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

.btn--primary:hover {
  background: #e0fa8e;
  box-shadow: 0 4px 24px rgba(212, 244, 116, 0.2);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  border-color: var(--muted);
  background: rgba(170, 184, 175, 0.06);
}

.btn--lg {
  padding: 16px 36px;
  font-size: 16px;
  border-radius: 10px;
}

/* ---- Cursor Glow ---- */
.cursor-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 244, 116, 0.04) 0%, transparent 70%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 0;
  opacity: 0;
  transition: opacity 0.4s;
}

.cursor-glow.active {
  opacity: 1;
}

/* ============================================
   HEADER
   ============================================ */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  transition: background 0.3s, backdrop-filter 0.3s, box-shadow 0.3s;
}

.header.scrolled {
  background: rgba(23, 29, 29, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 0 var(--border);
}

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

.header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header__logo {
  width: 30px;
  height: auto;
  object-fit: contain;
}

.header__name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.header__dot { color: var(--accent); }

.header__nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.header__link {
  font-size: 14px;
  color: var(--muted);
  transition: color 200ms;
}

.header__link:hover { color: var(--text); }

.header__cta {
  padding: 8px 20px;
  font-size: 13px;
}

.header__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  z-index: 110;
}

.header__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s var(--ease);
}

.header__toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.header__toggle.active span:nth-child(2) { opacity: 0; }
.header__toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.mobile-menu {
  position: fixed;
  inset: 0;
  background: rgba(23, 29, 29, 0.97);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
  z-index: 99;
}

.mobile-menu.open { opacity: 1; pointer-events: auto; }

.mobile-menu__nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.mobile-menu__link {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
  transition: color 200ms;
}

.mobile-menu__link:hover { color: var(--accent); }
.mobile-menu__cta { margin-top: 16px; }

/* ============================================
   HERO
   ============================================ */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-top: var(--header-h);
}

.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, transparent 0%, var(--bg) 70%);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 2;
  max-width: 720px;
  padding: 80px 0;
}

.hero__title-wrap {
  overflow: hidden;
}

.hero__title {
  font-size: clamp(40px, 7vw, 72px);
  margin-bottom: 32px;
}

.hero__line {
  display: block;
  transform: translateY(110%);
  animation: revealLine var(--duration) var(--ease) forwards;
}

.hero__line:nth-child(2) {
  animation-delay: 150ms;
}

.hero__line--accent {
  color: var(--accent);
}

@keyframes revealLine {
  to { transform: translateY(0); }
}

.hero__text {
  font-size: 18px;
  line-height: 1.75;
  color: var(--muted);
  margin-bottom: 40px;
  max-width: 540px;
  opacity: 0;
  animation: fadeIn 600ms var(--ease) 400ms forwards;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  opacity: 0;
  animation: fadeIn 600ms var(--ease) 550ms forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.hero__scroll {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.hero__scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scrollLine 2s ease-in-out infinite;
}

@keyframes scrollLine {
  0%, 100% { opacity: 0; transform: scaleY(0); transform-origin: top; }
  50% { opacity: 1; transform: scaleY(1); }
}

/* ============================================
   SERVICES — Accordion bands
   ============================================ */

.services {
  margin-top: 64px;
  border-top: 1px solid var(--border);
}

.service {
  border-bottom: 1px solid var(--border);
  position: relative;
}

.service::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 300ms var(--ease);
}

.service:hover::before,
.service.open::before {
  transform: scaleY(1);
}

.service__head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 0 32px 24px;
  text-align: left;
  cursor: pointer;
  transition: padding-left 200ms var(--ease);
}

.service:hover .service__head {
  padding-left: 32px;
}

.service__name {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 500;
  letter-spacing: -0.02em;
  transition: color 200ms;
}

.service:hover .service__name {
  color: var(--accent);
}

.service__toggle {
  width: 32px;
  height: 32px;
  position: relative;
  flex-shrink: 0;
}

.service__toggle::before,
.service__toggle::after {
  content: '';
  position: absolute;
  background: var(--muted);
  transition: all 300ms var(--ease);
}

.service__toggle::before {
  width: 16px;
  height: 1.5px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.service__toggle::after {
  width: 1.5px;
  height: 16px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.service.open .service__toggle::after {
  transform: translate(-50%, -50%) rotate(90deg);
  opacity: 0;
}

.service__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration) var(--ease);
}

.service.open .service__body {
  max-height: 400px;
}

.service__content {
  padding: 0 0 36px 24px;
  max-width: 640px;
}

.service__content p {
  font-size: 16px;
  line-height: 1.75;
  color: var(--muted);
  margin-bottom: 20px;
}

.service__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.service__tags span {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 100px;
  background: var(--accent-dim);
  color: var(--accent);
}

/* ============================================
   FLOW — Integrated process
   ============================================ */

.flow {
  margin-top: 64px;
  position: relative;
  padding: 48px 0;
}

.flow__track {
  position: absolute;
  top: 72px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
}

.flow__fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 100ms linear;
  box-shadow: 0 0 12px rgba(212, 244, 116, 0.3);
}

.flow__nodes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
  position: relative;
}

.flow__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  margin-bottom: 28px;
  position: relative;
  z-index: 2;
  transition: border-color 400ms, background 400ms, box-shadow 400ms;
}

.flow__node.active .flow__dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 16px rgba(212, 244, 116, 0.4);
}

.flow__label {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 12px;
  transition: color 400ms;
}

.flow__node.active .flow__label {
  color: var(--text);
}

.flow__text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted-dim);
  transition: color 400ms;
  max-width: 300px;
}

.flow__node.active .flow__text {
  color: var(--muted);
}

/* ============================================
   PORTFOLIO — Case studies
   ============================================ */

.portfolio {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.case {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 300ms, box-shadow 300ms;
}

.case:hover {
  border-color: rgba(170, 184, 175, 0.2);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
}

.case--left .case__visual { order: 2; }
.case--left .case__info { order: 1; }

.case__visual {
  position: relative;
  min-height: 280px;
  overflow: hidden;
}

.case__visual::after {
  content: '';
  position: absolute;
  inset: 0;
  transition: opacity 400ms;
}

.case__visual--1 {
  background:
    radial-gradient(ellipse at 30% 40%, rgba(212, 244, 116, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(170, 184, 175, 0.06) 0%, transparent 50%),
    var(--bg-surface);
}

.case__visual--2 {
  background:
    radial-gradient(ellipse at 70% 30%, rgba(212, 244, 116, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 80%, rgba(170, 184, 175, 0.06) 0%, transparent 50%),
    var(--bg-surface);
}

.case__visual--3 {
  background:
    conic-gradient(from 200deg at 50% 50%, rgba(212, 244, 116, 0.06), transparent 120deg, rgba(170, 184, 175, 0.04), transparent),
    var(--bg-surface);
}

.case__visual--4 {
  background:
    repeating-linear-gradient(135deg, transparent, transparent 40px, rgba(212, 244, 116, 0.03) 40px, rgba(212, 244, 116, 0.03) 41px),
    var(--bg-surface);
}

.case__visual--5 {
  background:
    radial-gradient(circle at 50% 50%, rgba(212, 244, 116, 0.08) 0%, transparent 60%),
    var(--bg-surface);
}

.case__status {
  position: absolute;
  top: 20px;
  right: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 14px;
  border-radius: 100px;
  z-index: 2;
}

.case__status--live {
  background: rgba(212, 244, 116, 0.12);
  color: var(--accent);
  border: 1px solid rgba(212, 244, 116, 0.25);
}

.case__status--dev {
  background: rgba(170, 184, 175, 0.08);
  color: var(--muted);
  border: 1px solid rgba(170, 184, 175, 0.15);
}

.case__info {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.case__category {
  font-size: 13px;
  color: var(--muted-dim);
  margin-bottom: 12px;
}

.case__title {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 600;
  margin-bottom: 16px;
}

.case__desc {
  font-size: 15px;
  line-height: 1.75;
  color: var(--muted);
  margin-bottom: 24px;
}

.case__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  transition: gap 300ms var(--ease);
}

.case__link:hover { gap: 12px; }

/* ============================================
   ABOUT
   ============================================ */

.about {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 72px;
  align-items: center;
}

.about__photo {
  position: relative;
  max-width: 380px;
}

.about__photo::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, transparent 50%, rgba(23, 29, 29, 0.4) 100%);
  pointer-events: none;
}

.about__img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  object-fit: cover;
  filter: saturate(0.25) brightness(0.85) contrast(1.1) sepia(0.15) hue-rotate(50deg);
}

.about__lead {
  font-size: 17px;
  line-height: 1.75;
  color: var(--text-mid);
  margin-top: 24px;
}

.about__text {
  font-size: 16px;
  line-height: 1.75;
  color: var(--muted);
  margin-top: 20px;
}

/* ============================================
   CONTACT
   ============================================ */

.contact {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.contact__title {
  font-size: clamp(28px, 4vw, 42px);
  margin-bottom: 20px;
}

.contact__text {
  font-size: 17px;
  line-height: 1.75;
  color: var(--muted);
  margin-bottom: 40px;
}

.contact__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.contact__email {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  transition: color 200ms;
}

.contact__email:hover { color: var(--accent); }

/* ============================================
   FOOTER
   ============================================ */

.footer {
  border-top: 1px solid var(--border);
  padding: 64px 0 40px;
}

.footer__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 40px;
  align-items: start;
}

.footer__brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.footer__logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-top: 2px;
}

.footer__identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer__name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.footer__tagline { font-size: 13px; color: var(--muted); }
.footer__by { font-size: 12px; color: var(--muted-dim); }

.footer__nav {
  display: flex;
  gap: 24px;
  justify-self: center;
}

.footer__nav a {
  font-size: 14px;
  color: var(--muted);
  transition: color 200ms;
}

.footer__nav a:hover { color: var(--text); }

.footer__contact { justify-self: end; }

.footer__contact a {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  transition: color 200ms;
}

.footer__contact a:hover { color: var(--accent); }

.footer__bottom {
  grid-column: 1 / -1;
  text-align: center;
  padding-top: 40px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted-dim);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  :root { --section-py: 80px; }

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

  .case--left .case__visual { order: 0; }
  .case--left .case__info { order: 0; }

  .case__visual { min-height: 200px; }

  .about {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }

  .about__photo {
    margin: 0 auto;
    max-width: 300px;
  }

  .footer__inner {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }

  .footer__brand { justify-content: center; }
  .footer__nav { justify-self: center; flex-wrap: wrap; justify-content: center; }
  .footer__contact { justify-self: center; }
}

@media (max-width: 768px) {
  :root {
    --section-py: 64px;
    --header-h: 64px;
    --gutter: 20px;
  }

  .header__nav,
  .header__cta { display: none; }

  .header__toggle { display: flex; }

  .hero__content { padding: 40px 0 60px; }
  .hero__text { font-size: 16px; }

  .hero__actions {
    flex-direction: column;
  }

  .hero__actions .btn {
    width: 100%;
    justify-content: center;
  }

  .hero__scroll { display: none; }

  .service__head { padding: 24px 0 24px 16px; }
  .service:hover .service__head { padding-left: 20px; }
  .service__content { padding-left: 16px; }

  .flow__nodes {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .flow__track {
    top: 0;
    bottom: 0;
    left: 6px;
    right: auto;
    width: 2px;
    height: auto;
  }

  .flow__fill {
    width: 100% !important;
    height: 0;
    transition: height 100ms linear;
  }

  .flow__node {
    padding-left: 36px;
  }

  .flow__dot {
    position: absolute;
    left: 0;
  }

  .flow__text { max-width: none; }

  .case__info { padding: 24px; }

  .contact__actions .btn--lg {
    width: 100%;
  }

  .footer__nav { gap: 16px; }

  .cursor-glow { display: none; }
}

@media (max-width: 480px) {
  .hero__title { font-size: 36px; }
  .section-title { font-size: 26px; }
  .service__name { font-size: 20px; }
  .case__title { font-size: 20px; }
  .contact__title { font-size: 26px; }
}
