/* ============================================================
   portfolio.css — UX pass applying Impeccable + Taste + UI-UX-Pro-Max rules

   Key rules enforced:
   - No numbered section markers (Impeccable ban)
   - No eyebrow above every section (Taste: max 1 per 3 sections)
   - No identical card grid repeated endlessly (Impeccable ban)
   - No window.scroll listener — parallax is CSS-only (Taste ban)
   - No em-dashes in visible text (Taste: zero tolerance)
   - text-wrap: balance on headings (Impeccable)
   - Body descriptions use readable sans, not mono (UX Pro Max)
   - 65ch max-width on prose (Impeccable)
   - Per-project cover identity (not one generic gradient)
   - focus-visible keyboard styles (UX Pro Max: CRITICAL priority)
   - 44px min touch targets (UX Pro Max: CRITICAL priority)
   - prefers-reduced-motion mandatory (all three skills)
   ============================================================ */

:root {
  --accent: #2563eb;
  --ink: #0d0d0d;
  --body: #444;
  --muted: #666;
  --muted-light: #999;
  --line: #e2e2e2;
  --card-bg: #ffffff;
  --card-radius: 5px;
  /* letter-spacing scale */
  --ls-tight:   0.5px;
  --ls-default: 1px;
  --ls-wide:    2px;
}

/* ---- Site border frame — always on top -------------------- */
#site-border-left,
#site-border-right,
#site-border-top,
#site-border-bottom {
  z-index: 9999 !important;
}

/* ---- CSS-only hero parallax (no scroll listener) ----------- */
.hero-parallax {
  background-attachment: fixed;
  background-size: cover;
  background-position: center top;
}
@media (max-width: 768px) {
  /* background-attachment:fixed is unreliable on iOS — degrade gracefully */
  .hero-parallax { background-attachment: scroll; }
}

/* ---- Category header --------------------------------------- */
.category-header {
  max-width: 1140px;
  margin: 0 auto 40px;
  padding: 0 24px;
}
.category-header .cat-title {
  font-family: "Roboto Mono", monospace;
  font-weight: 700;
  font-size: clamp(22px, 3.5vw, 30px);
  margin: 0 0 12px;
  color: var(--ink);
  text-wrap: balance;
  line-height: 1.15;
}
.category-header .cat-sub {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--muted);
  margin: 0;
  max-width: 62ch;
  line-height: 1.7;
}
.category-header .cat-rule {
  height: 2px;
  width: 40px;
  background: var(--accent);
  margin-top: 18px;
}

/* ---- Card grids ------------------------------------------- */
.card-grid {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px 12px;
  display: grid;
  gap: 22px;
}

/* Projects grid: asymmetric — first card spans 2 cols (featured) */
.card-grid--projects {
  grid-template-columns: repeat(3, 1fr);
}
.card-grid--projects .proj-card:first-child {
  grid-column: span 2;
}
.card-grid--projects .proj-card:first-child .card-media {
  aspect-ratio: 21 / 9;
}
.card-grid--projects .proj-card:first-child .cover-mark {
  font-size: 56px;
  letter-spacing: 6px;
}

/* Tools grid: uniform 3-col — tools are peer utilities */
.card-grid--tools {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
  .card-grid--projects,
  .card-grid--tools { grid-template-columns: repeat(2, 1fr); }
  .card-grid--projects .proj-card:first-child { grid-column: span 2; }
}
@media (max-width: 600px) {
  .card-grid--projects,
  .card-grid--tools { grid-template-columns: 1fr; }
  .card-grid--projects .proj-card:first-child {
    grid-column: span 1;
  }
  .card-grid--projects .proj-card:first-child .card-media {
    aspect-ratio: 16 / 9;
  }
}

/* ---- Base card -------------------------------------------- */
.proj-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  transform-style: preserve-3d;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  min-height: 100%;
}
.proj-card:hover,
.proj-card:focus-visible {
  box-shadow: 0 12px 32px rgba(37, 99, 235, .12);
  border-color: var(--accent);
  text-decoration: none;
  color: var(--ink);
}
.proj-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  transform: translateY(-4px);
}

/* ---- Card media area -------------------------------------- */
.proj-card .card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #111;
  flex-shrink: 0;
}
.proj-card .card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s cubic-bezier(.2, .7, .2, 1);
}
.proj-card:hover .card-media img { transform: scale(1.04); }

/* ---- Cover cards (no screenshot) — per-project identity --- */
.card-media.cover {
  display: flex;
  align-items: center;
  justify-content: center;
  /* default dark neutral — overridden per project below */
  background: #111;
}

/* Per-project cover colors — each has its own identity */
[data-proj-id="noitero"]    .card-media.cover { background: linear-gradient(140deg, #04110e 0%, #0a3320 100%); }
[data-proj-id="roguefps"]   .card-media.cover { background: linear-gradient(140deg, #130000 0%, #4a0800 100%); }
[data-proj-id="flowsys"]    .card-media.cover { background: linear-gradient(140deg, #000d1a 0%, #003459 100%); }
[data-proj-id="invoice"]    .card-media.cover { background: linear-gradient(140deg, #0a0a0a 0%, #1c1c1c 100%); }
[data-proj-id="cardbuilder"].card-media.cover { background: linear-gradient(140deg, #0c0a00 0%, #2a2000 100%); }

/* Tag chip */
.proj-card .card-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: var(--ls-tight);
  text-transform: uppercase;
  background: rgba(0, 0, 0, .65);
  color: #fff;
  padding: 4px 9px;
  border-radius: 3px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Cover mark */
.card-media.cover .cover-mark {
  font-family: "Roboto Mono", monospace;
  font-weight: 700;
  font-size: 40px;
  letter-spacing: 4px;
  color: #fff;
  opacity: .9;
  user-select: none;
  transition: transform .35s cubic-bezier(.2, .7, .2, 1), letter-spacing .35s ease;
}
.proj-card:hover .card-media.cover .cover-mark {
  transform: translateY(-3px) scale(1.03);
  letter-spacing: 6px;
}

/* Cursor-following glow on cover */
.proj-card .card-media.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    220px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, .18) 0%,
    transparent 65%
  );
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.proj-card:hover .card-media.cover::after { opacity: 1; }

/* ---- Card body -------------------------------------------- */
.proj-card .card-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.proj-card .card-title {
  font-family: "Roboto Mono", monospace;
  font-weight: 700;
  font-size: 17px;
  margin: 0 0 10px;
  color: var(--ink);
  text-wrap: balance;
  line-height: 1.25;
  position: relative;
}
/* Accent underbar that grows on hover */
.proj-card .card-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  height: 2px;
  width: 0;
  background: var(--accent);
  transition: width .28s ease;
}
.proj-card:hover .card-title::after { width: 32px; }

/* Descriptions: readable sans, not mono */
.proj-card .card-desc {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin: 10px 0 16px;
  flex: 1;
  max-width: 65ch;
}

.proj-card .card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 16px;
}
.proj-card .stack-chip {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: var(--ls-tight);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 3px 8px;
  transition: background .18s ease, color .18s ease;
}
.proj-card:hover .stack-chip {
  background: var(--accent);
  color: #fff;
}

/* CTA link — min 44px touch area */
.proj-card .card-cta {
  font-family: "Roboto Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: var(--ls-tight);
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding-top: 8px;
}
.proj-card .card-cta .arrow { transition: transform .18s ease; }
.proj-card:hover .card-cta .arrow { transform: translateX(5px); }

/* ---- Section spacing -------------------------------------- */
.projects-section { padding: 70px 0 24px; }
.tools-section    { padding: 50px 0 80px; }

/* ============================================================
   NNEngine Showcase Section
   Dark cinematic treatment — distinct from the card grid below
   ============================================================ */
.nne-showcase {
  background: #0c0c0e;
  position: relative;
  overflow: hidden;
  padding: 80px 0 90px;
}

/* Subtle tech-grid overlay */
.nne-showcase::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 72px 72px;
  pointer-events: none;
}

/* Accent glow top-left */
.nne-showcase::after {
  content: '';
  position: absolute;
  top: -120px;
  left: -80px;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(37,99,235,.18) 0%, transparent 70%);
  pointer-events: none;
}

.nne-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* Header: logo + meta side by side */
.nne-header {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 48px;
  align-items: flex-start;
  margin-bottom: 56px;
  padding-bottom: 56px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.nne-logo {
  width: 100px;
  height: auto;
  display: block;
  filter: brightness(1.05);
  margin-top: 8px;
}

.nne-eyebrow {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

.nne-title {
  font-family: "Roboto Mono", monospace;
  font-weight: 700;
  font-size: clamp(38px, 5.5vw, 68px);
  color: #fff;
  margin: 0 0 20px;
  line-height: 1.0;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.nne-desc {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255,255,255,.55);
  max-width: 54ch;
  margin: 0 0 26px;
}

/* Tech stack pills */
.nne-specs {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.nne-specs li {
  font-family: "Roboto Mono", monospace;
  font-size: 11px;
  letter-spacing: var(--ls-tight);
  color: rgba(255,255,255,.75);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 3px;
  padding: 5px 13px;
  transition: border-color .2s ease, color .2s ease;
}
.nne-specs li:hover {
  border-color: var(--accent);
  color: #fff;
}

/* CTA buttons */
.nne-ctas {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.nne-btn {
  font-family: "Roboto Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: var(--ls-tight);
  text-transform: uppercase;
  padding: 13px 26px;
  border-radius: 3px;
  text-decoration: none;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, color .15s ease;
}
.nne-btn:hover { transform: translateY(-2px); text-decoration: none; }
.nne-btn--solid {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 20px rgba(37,99,235,.4);
}
.nne-btn--solid:hover { color: #fff; box-shadow: 0 8px 30px rgba(37,99,235,.55); }
.nne-btn--ghost {
  border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.75);
}
.nne-btn--ghost:hover { border-color: rgba(255,255,255,.7); color: #fff; }
.nne-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* Videos grid */
.nne-videos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.nne-video-item {
  margin: 0;
  background: #111;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
  transition: border-color .25s ease;
}
.nne-video-item:hover { border-color: rgba(37,99,235,.45); }

.nne-video-item video {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.nne-video-item figcaption {
  font-family: "Roboto Mono", monospace;
  font-size: 10px;
  letter-spacing: var(--ls-default);
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,.05);
}

/* Responsive */
@media (max-width: 900px) {
  .nne-header {
    grid-template-columns: 80px 1fr;
    gap: 28px;
  }
}
@media (max-width: 640px) {
  .nne-header {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .nne-logo { width: 70px; }
  .nne-videos { grid-template-columns: 1fr; }
}

/* ---- MOTION : scroll reveal (staggered) ------------------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity .55s ease,
    transform .55s cubic-bezier(.2, .7, .2, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
/* stagger via --i set by JS */
.proj-card.reveal { transition-delay: calc(var(--i, 0) * 75ms); }

/* Keep entrance easing slow; tilt fast */
.proj-card.reveal:not(:hover) {
  transition:
    opacity .55s ease,
    transform .45s cubic-bezier(.2, .7, .2, 1),
    box-shadow .2s ease,
    border-color .2s ease;
}
.proj-card:hover {
  transition: transform .1s ease, box-shadow .18s ease, border-color .18s ease;
}

/* ---- ACCESSIBILITY : focus & reduced motion --------------- */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .hero-parallax { background-attachment: scroll !important; }
  .proj-card,
  .proj-card * { transition: none !important; }
  .proj-card:hover { transform: translateY(-3px) !important; }
}
