/* =========================================================
   Chariedale Joy Valdez — index.html styles
   ========================================================= */

:root {
  /* Your brand purples */
  --purple: #6d0eb2;
  --purple-2: #9c27b0;
  --grad: linear-gradient(135deg, var(--purple) 0%, var(--purple-2) 100%);
  --accent: #c490ff;            /* lighter purple for text on dark */

  /* Dark UI */
  --bg: #0c0a18;
  --bg-2: #110d22;
  --surface: #171130;
  --surface-2: #1f1740;
  --line: #2a2247;
  --line-2: #3d3266;
  --text: #efeaf8;
  --muted: #a79fbd;

  --font: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --container: 1160px;
  --gutter: clamp(20px, 5vw, 32px);
  --section-y: clamp(64px, 9vw, 104px);
  --header-h: 72px;
  --radius: 14px;

  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  font-family: var(--font);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); }
.section--band { background: var(--bg-2); border-block: 1px solid var(--line); }
.section-title { font-size: clamp(1.875rem, 4vw, 2.5rem); font-weight: 700; text-align: center; margin-bottom: clamp(32px, 5vw, 48px); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: 600 .9375rem/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: filter .2s ease, background-color .2s ease, border-color .2s ease;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn--primary { background: var(--grad); color: #fff; box-shadow: 0 12px 30px -14px rgba(156, 39, 176, .8); }
.btn--primary:hover { filter: brightness(1.12); }
.btn--outline { border-color: var(--line-2); color: var(--text); }
.btn--outline:hover { border-color: var(--accent); background: rgba(196, 144, 255, .08); }
.btn--sm { min-height: 40px; padding: 8px 16px; font-size: .875rem; }
.btn--block { width: 100%; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(12, 10, 24, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand__mark { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; color: #fff; }
.brand__mark svg { width: 20px; height: 20px; }
.brand h1 { font-size: 1.0625rem; font-weight: 700; white-space: nowrap; }
.brand__role { font-size: .75rem; color: var(--muted); white-space: nowrap; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a { position: relative; text-decoration: none; font-size: .9375rem; color: var(--muted); padding: 10px 14px; }
.nav a:hover { color: var(--text); }
.nav a::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px; border-radius: 2px; background: var(--grad); transform: scaleX(0); transition: transform .2s ease; }
.nav a:hover::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-toggle svg { width: 22px; height: 22px; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 800px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 8px var(--gutter) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 40px -20px rgba(0, 0, 0, .7);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 16px 4px; font-size: 1.0625rem; color: var(--text); border-bottom: 1px solid var(--line); }
  .nav a::after { display: none; }
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding-block: clamp(64px, 10vw, 120px); }
.hero .container {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 72px);
  align-items: center;
}
.hero h2 { font-size: clamp(2.5rem, 6vw, 4.25rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.04; }
.hero h2 span { background: linear-gradient(120deg, #d7a8ff 0%, #b066f0 50%, #e27cff 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin-top: 22px; max-width: 52ch; font-size: 1.0625rem; color: var(--muted); }
.hero .btn { margin-top: 32px; }

.hero__visual { position: relative; display: grid; place-items: center; min-height: 360px; }
.hero__orb {
  position: absolute;
  width: min(380px, 88%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b061ea 0%, var(--purple) 48%, #2a0a4a 85%);
  box-shadow: 0 0 120px 10px rgba(156, 39, 176, .35);
}
.hero__dots {
  position: absolute;
  top: 4%;
  right: 2%;
  width: 110px;
  height: 84px;
  background-image: radial-gradient(rgba(196, 144, 255, .55) 1.5px, transparent 1.5px);
  background-size: 14px 14px;
}
.code-card {
  position: relative;
  width: min(420px, 100%);
  background: rgba(17, 12, 34, .94);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8);
  overflow: hidden;
  transform: rotate(-2deg);
}
.code-card__bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); font: 500 .75rem/1 var(--font-code); color: var(--muted); }
.code-card__bar i { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; }
.code-card pre { margin: 0; padding: 18px 18px 22px; font: 400 .8rem/1.85 var(--font-code); white-space: pre-wrap; color: #d8d2ea; }
.code-card .k { color: #c490ff; }
.code-card .p { color: #8fb8ff; }
.code-card .s { color: #ffb86b; }

@media (max-width: 900px) {
  .hero .container { grid-template-columns: 1fr; }
  .hero__visual { min-height: 300px; }
}

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 72px); align-items: start; }
.about h3 { font-size: clamp(1.875rem, 4vw, 2.5rem); font-weight: 700; }
.about p { margin-top: 16px; color: var(--muted); max-width: 62ch; }
.about p strong { color: var(--text); }

.contact-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 24px; position: relative; overflow: hidden; }
.contact-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--grad); }
.contact-card h4 { font-size: 1.125rem; font-weight: 700; color: var(--accent); margin-bottom: 16px; }
.contact-card p { font-size: .9375rem; color: var(--muted); }
.contact-card p + p { margin-top: 8px; }
.contact-card p span { color: var(--text); font-weight: 600; }
.contact-card .btn { margin-top: 20px; }

@media (max-width: 800px) { .about { grid-template-columns: 1fr; } }

/* ---------- Figma works ---------- */
.work-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.work-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .2s ease; }
.work-card:hover { border-color: var(--line-2); }
.work-card__media { position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.work-card__media img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.work-card__no { position: absolute; top: 12px; left: 12px; font-size: .75rem; font-weight: 600; padding: 4px 8px; border-radius: 6px; background: rgba(12, 10, 24, .82); }
.work-card__body { display: flex; flex-direction: column; flex: 1; padding: 20px; }
.work-card h4 { font-size: 1.0625rem; font-weight: 600; line-height: 1.3; }
.work-card p { margin-top: 8px; font-size: .875rem; color: var(--muted); }
.work-card__actions { margin-top: auto; padding-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 960px) { .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .work-grid { grid-template-columns: 1fr; } }

/* =========================================================
   A/B Testing — stacked folders
   ========================================================= */
.ab {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 10%, rgba(255, 255, 255, .12), transparent 40%),
    var(--grad);
}
.ab .section-title { color: #fff; }

.folders {
  --step-x: 44px;          /* how far each back folder shifts right */
  --step-y: 64px;          /* how far each back folder shifts up */
  --count: 4;
  --tab-h: 52px;

  position: relative;
  display: grid;
  max-width: 980px;
  margin-inline: auto;
  padding-top: calc((var(--count) - 1) * var(--step-y) + var(--tab-h));
  padding-right: calc((var(--count) - 1) * var(--step-x));
}

.folder {
  --pos: 0;                /* 0 = front, set by JS */
  --paper: #ffffff;
  grid-area: 1 / 1;
  position: relative;
  z-index: calc(10 - var(--pos));
  background: var(--paper);
  color: #1b1326;
  border-radius: 18px;
  /* drop-shadow follows the tab shape too, so the tab and body read as one piece */
  filter: drop-shadow(0 -3px 8px rgba(40, 5, 70, .18)) drop-shadow(0 18px 24px rgba(40, 5, 70, .28));
  transform: translate(calc(var(--pos) * var(--step-x)), calc(var(--pos) * var(--step-y) * -1));
  transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}
/* Only the front folder's tab sits at the far left, so only it loses that corner */
.folder[data-pos="0"] { border-top-left-radius: 0; }

/* Front and every other folder are white, the rest lavender */
.folder[data-pos="1"], .folder[data-pos="3"] { --paper: #e6d3fa; }

/* Tab */
.folder__tab {
  position: absolute;
  bottom: 100%;
  left: calc(var(--pos) * 18%);
  max-width: min(36%, 320px);
  height: var(--tab-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  border: 0;
  border-radius: 16px 16px 0 0;
  background: var(--paper);
  color: #1b1326;
  font: 500 1rem/1.2 var(--font);
  text-align: left;
  cursor: pointer;
  transition: left .45s cubic-bezier(.2, .8, .2, 1);
}
.folder__tab::after {
  /* slanted right edge, like a real file tab */
  content: "";
  position: absolute;
  top: 0;
  right: -30px;
  width: 44px;
  height: 100%;
  background: var(--paper);
  border-radius: 0 14px 0 0;
  transform: skewX(28deg);
  transform-origin: bottom left;
  z-index: -1;
}
.folder__tab .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder__tab .no { font-weight: 700; color: var(--purple); flex: none; }
.folder:not(.is-front) .folder__tab:hover .label { text-decoration: underline; text-underline-offset: 3px; }
.folder.is-front .folder__tab { cursor: default; max-width: min(60%, 520px); }

/* Body */
.folder__body { padding: clamp(24px, 5vw, 48px); }
.folder:not(.is-front) .folder__body { display: none; }   /* front folder sets the height; back folders stretch to match */

.folder__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: var(--purple);
  max-width: 18ch;
}

.folder__content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 44px; margin-top: clamp(24px, 4vw, 36px); }
.folder__content > div { min-width: 0; }
.folder__content .wide { grid-column: 1 / -1; }
.folder__content h5 { font-size: .9375rem; font-weight: 700; color: #1b1326; }
.folder__content p { margin-top: 4px; font-size: .9375rem; color: #4a4158; }
.folder__content .wide p { font-size: 1.0625rem; color: #2a2236; }
.folder__content .results p { font-weight: 500; color: #2a2236; }
.folder__content .results { padding: 16px 18px; border-radius: 12px; background: rgba(109, 14, 178, .08); border-left: 4px solid var(--purple); }

.folder-hint { margin-top: 24px; text-align: center; font-size: .875rem; color: rgba(255, 255, 255, .8); }

@media (max-width: 720px) {
  .folders { --step-x: 10px; --step-y: 50px; --tab-h: 46px; }
  .folder__tab { left: calc(var(--pos) * 22%); max-width: none; padding: 0 14px; font-size: .9375rem; }
  .folder:not(.is-front) .folder__tab .label { display: none; }   /* back tabs show just the number */
  .folder.is-front .folder__tab { max-width: calc(100% - 30px); }
  .folder__tab::after { right: -22px; width: 34px; }
  .folder__content { grid-template-columns: 1fr; }
}

/* ---------- Graphic design CTA ---------- */
.gd-cta { position: relative; overflow: hidden; text-align: center; }
.gd-cta::before {
  content: "DESIGN";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(6rem, 20vw, 14rem);
  font-weight: 800;
  letter-spacing: .08em;
  color: rgba(196, 144, 255, .05);
  white-space: nowrap;
  pointer-events: none;
}
.gd-cta .container { position: relative; }
.gd-tags { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.gd-tags li { font-size: .75rem; font-weight: 600; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--accent); }
.gd-cta h3 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -0.03em; }
.gd-cta p { margin: 16px auto 0; max-width: 46ch; color: var(--muted); }
.gd-cta .btn { margin-top: 32px; }
.gd-cta .btn svg { transition: transform .2s ease; }
.gd-cta .btn:hover svg { transform: translateX(4px); }

/* ---------- Projects ---------- */
.player {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "screen list" "info list";
  gap: 24px;
  align-items: start;
}
.player__screen { grid-area: screen; aspect-ratio: 16 / 9; background: #000; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.player__screen iframe { width: 100%; height: 100%; border: 0; display: block; }
.player__screen video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.player__screen [hidden] { display: none; }

.playlist { grid-area: list; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.playlist h5 { font-size: .875rem; font-weight: 600; color: var(--muted); padding: 4px 6px 10px; }
.playlist ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.playlist button {
  width: 100%;
  min-height: 44px;
  text-align: left;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.playlist button:hover { background: var(--surface-2); }
.playlist button[aria-pressed="true"] { background: var(--surface-2); border-color: var(--line-2); }
.play-icon { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--accent); }
.playlist button[aria-pressed="true"] .play-icon { background: var(--grad); border-color: transparent; color: #fff; }
.play-icon svg { width: 13px; height: 13px; margin-left: 2px; }
.playlist .t { display: block; font-size: .9375rem; font-weight: 600; line-height: 1.3; }
.playlist .s { display: block; margin-top: 2px; font-size: .8125rem; color: var(--muted); }

.project-info { grid-area: info; max-width: 72ch; }
.project-info h4 { font-size: clamp(1.375rem, 3vw, 1.75rem); font-weight: 700; }
.project-info .desc { margin-top: 12px; font-size: .9375rem; color: var(--muted); white-space: pre-line; }
.project-info__repo { margin-top: 20px; }
.project-info__repo[hidden] { display: none; }

@media (max-width: 860px) {
  .player { grid-template-columns: minmax(0, 1fr); grid-template-areas: "screen" "list" "info"; gap: 16px; }
  .playlist { padding: 0; background: none; border: 0; }
  .playlist h5 { display: none; }
  .playlist ul { grid-auto-flow: column; grid-auto-columns: minmax(230px, 78%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
  .playlist li { scroll-snap-align: start; }
  .playlist button { height: 100%; background: var(--surface); border-color: var(--line); }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-2); border-top: 1px solid var(--line); padding-block: clamp(56px, 8vw, 80px) 28px; }
.site-footer .contact-card { max-width: 400px; margin-inline: auto; }
.footer-bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); text-align: center; font-size: .8125rem; color: var(--muted); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}