/* ==========================================================================
   Keyboard hero · PORTFOLIO keys on the dark site
   Keyboard design curated by ui.debbie, adapted to Asma’s dark theme.
   Uses the site tokens from style.css (--bg, --surface, --accent, --accent2,
   --gold, --text, --muted, --border).
   ========================================================================== */

.kb-hero {
  --kb-gutter: 60px;
  --kb-ease: cubic-bezier(0.22, 0.8, 0.3, 1);

  position: relative;
  z-index: 1;
  overflow: hidden;
  background:
    radial-gradient(60% 55% at 50% 72%, rgba(167, 139, 250, 0.13) 0%, transparent 70%),
    radial-gradient(40% 40% at 18% 20%, rgba(244, 114, 182, 0.06) 0%, transparent 70%);
}

@media (max-width: 900px) { .kb-hero { --kb-gutter: 24px; } }
@media (max-width: 600px) { .kb-hero { --kb-gutter: 20px; } }

.kb-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(24px, 2.4vw, 36px);
  /* top padding clears the fixed nav */
  padding-block: clamp(112px, 9vw, 136px) clamp(24px, 2.4vw, 36px);
  padding-left: max(var(--kb-gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--kb-gutter), env(safe-area-inset-right, 0px));
}

/* ---------- Status line with portrait ---------- */
.kb-status {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 6px 16px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(14, 14, 26, 0.7);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.kb-status__photo {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 1px solid rgba(167, 139, 250, 0.5);
}

/* ---------- Headline ---------- */
.kb-title {
  width: 100%;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  font-size: clamp(2.25rem, 1.2rem + 4vw, 5.5rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--text);
  text-align: center;
  text-wrap: balance;
}

.kb-title__line { display: block; }

.kb-title em {
  font-style: italic;
  font-weight: 400;
  padding-right: 0.06em;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- Keyboard ----------
   948 × 312 composition (H P O R T over F O L I O, Enter on the right).
   --u is one composition pixel: min(948px, container width) / 948, so the keyboard never scales above 1
   or past its container, and the stage height equals the scaled height. */
.kb-keyboard {
  container-type: inline-size;
  width: min(948px, 100%);
  padding-block: 8px 6px;
}

.kb-stage {
  --u: calc(100cqw / 948);
  position: relative;
  height: calc(312 * var(--u));
}

/* Keys: dark glass, in the site palette. Each key sets --tone
   (violet --accent, pink --accent2 or gold --gold); Enter is the gradient CTA. */
.kb-key {
  --tone: var(--accent);
  --face-shift: 0px;
  --body-shift: 0px;
  --shadow: max(2px, calc(5 * var(--u)));
  --glow: 0.14;

  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(146 * var(--u));
  height: calc(161 * var(--u));
  z-index: 1;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: calc(38 * var(--u));
  background: none;
  color: var(--text);
  text-decoration: none;
  cursor: none;  /* the site draws its own cursor */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.kb-key--lower { z-index: 2; }

.kb-key--enter {
  width: calc(218 * var(--u));
  height: calc(300 * var(--u));
}

.kb-key * { pointer-events: none; }

.kb-key__body {
  position: absolute;
  inset: 0;
  transform: translateY(var(--body-shift));
  transition: transform 0.2s var(--kb-ease);
}

/* Base: near-black with darker side walls, a thin tinted edge and a soft glow */
.kb-key__base {
  position: absolute;
  inset: 0;
  border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent);
  border-radius: calc(38 * var(--u));
  background:
    linear-gradient(90deg, #05050b 0, transparent calc(16 * var(--u)), transparent calc(100% - 16 * var(--u)), #05050b 100%),
    linear-gradient(180deg, #161628 0%, #0b0b15 100%);
  box-shadow:
    0 var(--shadow) 0 #020205,
    0 0 calc(40 * var(--u)) color-mix(in srgb, var(--tone) calc(var(--glow) * 100%), transparent);
  transition: box-shadow 0.25s var(--kb-ease), border-color 0.25s var(--kb-ease);
}

/* Thin angled seams from the face's lower corners to the base corners */
.kb-key__body::before,
.kb-key__body::after {
  content: "";
  position: absolute;
  z-index: 1;
  bottom: calc(9 * var(--u));
  width: 1px;
  height: calc(30 * var(--u));
  background: color-mix(in srgb, var(--tone) 35%, transparent);
  transform-origin: bottom center;
}
.kb-key__body::before { left: calc(14 * var(--u)); transform: rotate(32deg); }
.kb-key__body::after  { right: calc(14 * var(--u)); transform: rotate(-32deg); }

/* Raised face: glass card tinted by the key's tone */
.kb-key__face {
  position: absolute;
  z-index: 2;
  top: calc(5 * var(--u));
  left: calc(10 * var(--u));
  right: calc(10 * var(--u));
  bottom: calc(33 * var(--u));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(12 * var(--u)) calc(12 * var(--u)) calc(14 * var(--u));
  border: 1px solid color-mix(in srgb, var(--tone) 40%, transparent);
  border-radius: calc(29 * var(--u));
  text-align: center;
  background:
    radial-gradient(110% 70% at 50% 0%, color-mix(in srgb, var(--tone) 16%, transparent) 0%, transparent 70%),
    linear-gradient(180deg, #1c1b30 0%, #12121f 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateY(var(--face-shift));
  transition: transform 0.18s var(--kb-ease), border-color 0.25s var(--kb-ease), box-shadow 0.25s var(--kb-ease);
}

.kb-key__letter {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 400;
  font-size: calc(80 * var(--u));
  line-height: 0.85;
  color: var(--text);
  text-shadow: 0 0 calc(24 * var(--u)) color-mix(in srgb, var(--tone) 45%, transparent);
}

.kb-key__caption {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 500;
  font-size: calc(9.5 * var(--u));
  line-height: 1.3;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--tone) 75%, var(--text));
  overflow-wrap: anywhere;
}

/* Enter: the call to action, in the same gradient as the site's primary button */
.kb-key--enter .kb-key__face {
  justify-content: flex-start;
  align-items: center;
  padding: calc(26 * var(--u)) calc(14 * var(--u));
  border-color: rgba(255, 255, 255, 0.22);
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(255, 255, 255, 0.18) 0%, transparent 70%),
    linear-gradient(150deg, var(--accent) 0%, #7c3aed 60%, var(--accent2) 130%);
  color: #fff;
}

.kb-key--enter { --tone: var(--accent); --glow: 0.3; }

.kb-key__return {
  width: calc(96 * var(--u));
  height: auto;
  margin-left: calc(10 * var(--u));
  overflow: visible;
}

.kb-key__caption--vertical {
  position: absolute;
  right: calc(16 * var(--u));
  bottom: calc(20 * var(--u));
  writing-mode: vertical-rl;
  font-size: calc(11 * var(--u));
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.9);
}

/* ---- Key states ---- */
@media (hover: hover) {
  .kb-key:hover { --face-shift: calc(8 * var(--u)); --glow: 0.35; }
  .kb-key:hover .kb-key__face { border-color: color-mix(in srgb, var(--tone) 75%, transparent); }
}

.kb-key:focus-visible {
  --face-shift: calc(8 * var(--u));
  --glow: 0.35;
  z-index: 4;
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Automatic press: the key lights up as it goes down */
.kb-key.is-pressed {
  --body-shift: calc(4 * var(--u));
  --face-shift: calc(9 * var(--u));
  --shadow: max(1px, calc(1 * var(--u)));
  --glow: 0.45;
}
.kb-key.is-pressed .kb-key__face {
  border-color: var(--tone);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 calc(22 * var(--u)) color-mix(in srgb, var(--tone) 45%, transparent);
}
.kb-key.is-pressed .kb-key__body,
.kb-key.is-pressed .kb-key__face,
.kb-key.is-pressed .kb-key__base { transition-duration: 0.11s; }

.kb-key:active {
  --body-shift: calc(5 * var(--u));
  --face-shift: calc(9 * var(--u));
  --shadow: 0px;
  --glow: 0.5;
}

/* ---------- Marquee ---------- */
.kb-marquee {
  --marquee-duration: 60s;
  position: relative;
  overflow: hidden;
  padding-block: clamp(14px, 1.4vw, 22px);
  border-block: 1px solid rgba(226, 201, 126, 0.25);
  background: var(--surface);
  color: var(--gold);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.5rem, 1rem + 1.4vw, 2.5rem);
  line-height: 1.25;
}

.kb-marquee__static {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.kb-marquee__track {
  display: flex;
  width: max-content;
  animation: kb-marquee var(--marquee-duration) linear infinite;
  will-change: transform;
}

.kb-marquee__group {
  display: flex;
  flex-shrink: 0;
}

.kb-marquee__item {
  flex-shrink: 0;
  padding-right: 0.5em;
  white-space: nowrap;
}

@keyframes kb-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .kb-key__body,
  .kb-key__face,
  .kb-key__base { transition: none; }

  .kb-marquee__track { display: none; }

  .kb-marquee__static {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
    padding-inline: max(var(--kb-gutter), env(safe-area-inset-left, 0px));
    text-align: center;
  }
}

/* Touch screens have no custom cursor: give keys a normal pointer there */
@media (hover: none) {
  .kb-key { cursor: pointer; }
}

/* ---------- Popups opened by the keys ----------
   They reuse the site's About popup (.about-overlay / .about-modal)
   and only switch it to one column. */
.kb-popup__modal {
  display: block;
  width: min(760px, 100%);
  padding: 64px 56px 52px;
}

.kb-popup__title { margin-bottom: 32px; }

.kb-popup__title em { font-style: italic; color: var(--accent); }

/* Community popup: one journey act shown as plain text */
.kb-popup__text.journey-content { opacity: 1; transform: none; }
.kb-popup__text .journey-eyebrow,
.kb-popup__text .journey-title,
.kb-popup__text .journey-desc { margin: 0; max-width: none; }
.kb-popup__text .journey-eyebrow {
  margin-bottom: 10px;
  font-size: 0.68rem;
  letter-spacing: 0.25em;
  color: var(--gold);
}
.kb-popup__text .journey-title { margin-bottom: 16px; }

.kb-popup__text,
.kb-popup__text p {
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--muted);
}
.kb-popup__text p + p { margin-top: 16px; }

.kb-pop-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-decoration: none;
  cursor: inherit;
  transition: color 0.3s;
}
.kb-pop-link:hover { color: var(--text); }

.kb-popup__text .journey-link { margin-top: 20px; display: inline-block; }

.kb-popup__cta { display: inline-block; margin-top: 32px; }

.kb-contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  margin-top: 28px;
}
.kb-contact-list li {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  padding-block: 16px;
  border-top: 1px solid var(--border);
}
.kb-contact-list li:last-child { border-bottom: 1px solid var(--border); }
.kb-contact-list__label {
  font-size: 0.68rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
}
.kb-contact-list a {
  color: var(--text);
  font-size: 1rem;
  text-decoration: none;
  justify-self: start;
  overflow-wrap: anywhere;
  border-bottom: 1px solid rgba(167, 139, 250, 0.4);
  transition: border-color 0.3s, color 0.3s;
}
.kb-contact-list a:hover { color: var(--accent); border-color: var(--accent); }

.kb-popup__ctas { margin-top: 32px; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 12px; }

@media (max-width: 600px) {
  .kb-popup__modal { padding: 60px 24px 36px; }
  .kb-contact-list li { grid-template-columns: 1fr; gap: 4px; }
}
.kb-popup__text .journey-tags { margin-top: 20px; }

/* Bot first in the contact popup: give an answer before asking for a message */
.kb-popup__ask {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 28px;
  padding: 18px 22px;
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 18px;
  background: rgba(167, 139, 250, 0.07);
}
.kb-popup__ask p { color: var(--text); font-size: 0.98rem; }

/* ---------- Exploration progress under the keyboard ---------- */
.kb-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 16px;
}

.kb-progress__bar {
  width: 120px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.kb-progress__fill {
  display: block;
  height: 100%;
  width: var(--kb-progress, 10%);
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.5s var(--kb-ease);
}

.kb-progress__text {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Keys already opened keep a small lit dot and a brighter edge */
.kb-key.is-visited .kb-key__face { border-color: color-mix(in srgb, var(--tone) 65%, transparent); }
.kb-key__face::after {
  content: "";
  position: absolute;
  top: calc(12 * var(--u));
  right: calc(14 * var(--u));
  width: calc(7 * var(--u));
  height: calc(7 * var(--u));
  border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 0 calc(10 * var(--u)) var(--tone);
  opacity: 0;
  transition: opacity 0.4s var(--kb-ease);
}
.kb-key.is-visited .kb-key__face::after { opacity: 1; }
.kb-key--enter .kb-key__face::after { background: #fff; box-shadow: 0 0 calc(10 * var(--u)) #fff; }

/* ---------- Wide popups: My Projects (cards + carousel) and My Story (orbit timeline) ----------
   The original section markup and classes moved inside .about-modal unchanged;
   these rules only adapt the section spacing to the popup. */
.kb-popup--wide .kb-popup__modal {
  width: min(1180px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 56px 0 48px;
}

/* the close button stays reachable while the popup scrolls */
.kb-popup--wide .about-modal-close {
  position: sticky;
  top: 20px;
  float: right;
  margin: -32px 24px -40px 0;
  z-index: 5;  /* above the journey header and track, which sit at z-index 2 */
}

.kb-popup .projects-section { padding: 56px 0 48px; }
.kb-popup .projects-header { padding: 0 56px; margin-bottom: 36px; }
.kb-popup .carousel { padding: 20px 56px 56px; }

.kb-projects-cta {
  margin-top: 8px;
  padding: 0 56px;
  text-align: center;
}
.kb-projects-cta p {
  margin-bottom: 20px;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* buttons that use the site's .btn-primary look */
.kb-btn {
  display: inline-block;
  border: 0;
  font-family: inherit;
  cursor: inherit;
}

.kb-popup .journey-section {
  padding: 64px 48px 32px;
  background:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 80% 10%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1.5px 1.5px at 60% 70%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 30% 85%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1.5px 1.5px at 90% 60%, rgba(255,255,255,0.35), transparent),
    linear-gradient(165deg, rgba(167,139,250,0.10), rgba(14,14,26,0.96) 45%);
}
.kb-popup .journey-header { margin-bottom: 40px; }
/* acts appear in full here; the comet still lights each node as you scroll */
.kb-popup .journey-act .journey-content { opacity: 0.55; }
.kb-popup .journey-act.active .journey-content { opacity: 1; }

@media (max-width: 900px) {
  .kb-popup .projects-header,
  .kb-projects-cta { padding: 0 24px; }
  .kb-popup .carousel { padding: 20px 24px 48px; }
  .kb-popup .journey-section { padding: 56px 20px 24px; }
  .kb-popup--wide .about-modal-close { margin-right: 16px; }
}
