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

/* ─── Design tokens ──────────────────────────────────────── */
:root {
  --bg:           #030e22;
  --surface:      #0a1932;
  --surface-low:  #061329;
  --surface-high: #101f3a;
  --text:         #dce5ff;
  --muted:        #a0abc6;
  --accent:       #1a6b8a;
  --accent-warm:  #ff7346;
  --border:       rgba(255, 255, 255, 0.06);
  --radius:       12px;
  --font-head: 'Space Grotesk', 'Arial', system-ui, sans-serif;
  --font-body: 'Inter', 'Space Grotesk', 'Arial', system-ui, sans-serif;
}

/* ─── Base ───────────────────────────────────────────────── */
html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Layout ─────────────────────────────────────────────── */
main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 80px 32px 64px;
}

/* ─── Hero ───────────────────────────────────────────────── */
.hero {
  padding-bottom: 48px;
  position: relative;
}

/* Ambient glow behind the name */
.hero::before {
  content: '';
  position: absolute;
  top: -60px;
  left: -80px;
  width: 500px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(26, 107, 138, 0.12) 0%, transparent 68%);
  pointer-events: none;
  z-index: 0;
}

.hero > * { position: relative; z-index: 1; }

/* hero-top: avatar side-by-side with the label + name block */
.hero-top {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
}

.hero-name-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Wrapper handles the circle — border-radius on <img> alone is unreliable.
   overflow:hidden + border-radius on the container is the bulletproof pattern. */
.hero-avatar-wrap {
  /* Large enough to sit beside the h1, small enough not to dominate.
     clamp: 64px floor on mobile, 8vw preferred, 88px cap on wide screens. */
  width: clamp(64px, 8vw, 88px);
  height: clamp(64px, 8vw, 88px);
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--accent-warm);
  flex-shrink: 0;
}

.hero-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Orange line + uppercase label above the name */
.hero-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.hero-label-line {
  width: 32px;
  height: 2px;
  background: var(--accent-warm);
  flex-shrink: 0;
}

.hero-label span {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-warm);
}

h1 {
  font-family: var(--font-head);
  font-size: clamp(2.8rem, 6vw, 4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.0;
  color: var(--text);
  margin-bottom: 0;
}

/* ─── Contact links ──────────────────────────────────────── */
.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
}

.contact a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 4px 0;
  transition: color 0.15s;
}

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

.sep {
  color: rgba(255, 255, 255, 0.2);
  padding: 0 10px;
  font-weight: 300;
  font-size: 1rem;
}

/* ─── Bio ────────────────────────────────────────────────── */
.bio {
  font-size: clamp(0.9rem, 1.6vw, 1.05rem);
  font-weight: 300;
  color: var(--muted);
  max-width: 540px;
  line-height: 1.65;
  margin-top: 20px;
}

/* ─── Divider ────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin-bottom: 36px;
}

/* ─── Bento grid ─────────────────────────────────────────── */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.card-alkisurf      { grid-column: span 8; }
.card-homebase      { grid-column: span 4; }
.card-improbability { grid-column: span 12; }

/* ─── Card ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background 0.2s;
}

.card:hover { background: var(--surface-high); }

/* ─── Card image ─────────────────────────────────────────── */
.card-image-link {
  display: block;
  text-decoration: none;
}

.card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── Live Alkisurf widget ───────────────────────────────── */
.card-live-widget {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #0d3a5e 0%, #1a6b8a 50%, #2d9cbc 100%);
}

.alkisurf-frame {
  border: none;
  display: block;
  width: 680px;
  height: 450px; /* overridden by JS */
  transform-origin: top left;
  pointer-events: none;
}

.card-live-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
}

.alkisurf-placeholder      { background: linear-gradient(135deg, #0d3a5e 0%, #1a6b8a 50%, #2d9cbc 100%); }
.homebase-placeholder      { background: linear-gradient(135deg, #1a2d1f 0%, #2d4a32 50%, #3d5e43 100%); }
.improbability-placeholder { background: linear-gradient(135deg, #1a1030 0%, #2d1a4a 50%, #3d2560 100%); }

/* Improbability: horizontal split layout at full width */
.card-improbability {
  flex-direction: row;
}

.card-imp-image-link {
  width: 40%;
  flex-shrink: 0;
}

.card-improbability .card-image {
  height: 100%;
  aspect-ratio: auto;
}

/* ─── Card body ──────────────────────────────────────────── */
.card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-header h2 {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card-body p {
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--muted);
}

/* The one-per-card description paragraph that should grow to push the link/label to the bottom */
.card-description {
  flex: 1;
}

.card-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  margin-top: auto;
  transition: color 0.15s;
}

.card-link:hover { color: var(--accent-warm); }

.card-press {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(160, 171, 198, 0.5);
  text-decoration: none;
  transition: color 0.15s;
  letter-spacing: 0.01em;
}

.card-press:hover { color: var(--accent-warm); }

.card-private {
  font-size: 0.8rem;
  font-weight: 400;
  color: rgba(160, 171, 198, 0.65); /* bumped from 0.4 — 0.4 fails WCAG AA contrast on dark bg */
  font-style: italic;
  margin-top: auto;
}

/* ─── Card case study drawer ─────────────────────────────── */
.card-case-study {
  margin-top: 4px;
}

/* Remove default browser disclosure triangle */
.card-case-study-toggle {
  list-style: none;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s;
}

.card-case-study-toggle::-webkit-details-marker { display: none; }

/* Chevron that flips when open */
.card-case-study-toggle::after {
  content: '›';
  display: inline-block;
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 0.2s;
}

details[open] > .card-case-study-toggle::after {
  transform: rotate(90deg);
}

.card-case-study-toggle:hover { color: var(--accent-warm); }

.card-case-study-body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  /* height is set/animated by JS — see initDrawerAnimations() */
}

.card-case-study-body p {
  font-size: 0.82rem;
  line-height: 1.6;
  color: rgba(160, 171, 198, 0.75);
  /* no flex override needed: .card-body p no longer sets flex:1 */
}

/* ─── Status pills ───────────────────────────────────────── */
.pill {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}

.pill-live      { background: rgba(40,  200, 80,  0.12); color: #4cde7e; }
.pill-prototype { background: rgba(255, 200, 50,  0.12); color: #ffd166; }
.pill-fun       { background: rgba(255, 115, 70,  0.15); color: #ff7346; }


/* ─── Footer metadata ────────────────────────────────────── */
.site-footer {
  margin-top: 32px;
  display: flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(160, 171, 198, 0.30);
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 860px) {
  .card-alkisurf      { grid-column: span 12; }
  .card-homebase      { grid-column: span 12; }
  .card-improbability { grid-column: span 12; flex-direction: column; }
  .card-imp-image-link { width: 100%; }
  .card-improbability .card-image { height: auto; aspect-ratio: 16 / 9; }
}

@media (max-width: 720px) {
  main { padding: 56px 20px 48px; }
}

@media (max-width: 480px) {
  main { padding: 44px 16px 40px; }
  .hero::before { display: none; }
  h1 { font-size: 2.4rem; }
  .sep { padding: 0 8px; }
}
