/* ==========================================================================
   DESIGN SYSTEM — Editorial Artsy-Technical Digital Business Card
   ========================================================================== */

:root {
  /* Warm Sand & Charcoal Palette */
  --bg-dark: #09090b;       /* Primary canvas backdrop */
  --bg-light: #131316;      /* Muted cards/container background */
  --bg-hover: #1c1c21;
  
  --text-primary: #f4f2ee;  /* Sand cream */
  --text-muted: #8e8d94;    /* Slate gray */
  --text-inv: #09090b;
  
  --accent: #df8a5f;        /* Copper terracotta */
  --accent-soft: rgba(223, 138, 95, 0.08);
  
  --border: #232225;        /* Thin blueprint grid lines */
  --border-light: #2d2b30;

  /* Typography */
  --font-display: 'Funnel Display', sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 6px;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Background canvas positioning */
#math-grid-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  background-color: var(--bg-dark);
}

h1, h2, h3, h4 {
  font-weight: 400;
}

em {
  font-style: italic;
  font-family: var(--font-serif);
  color: var(--accent);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ==========================================================================
   GRID LAYOUT
   ========================================================================== */
.app-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: clamp(340px, 28vw, 420px) 1fr;
  min-height: 100vh;
}

/* LEFT COLUMN — Identity Panel (Sticky) */
.panel-identity {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 3rem 2.5rem;
  border-right: 1px solid var(--border);
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

/* Identity Meta */
.identity-meta {
  margin: 1.5rem 0 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.identity-meta .name {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 600;
  line-height: 1.05;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.identity-meta .name em {
  font-family: inherit;
  font-weight: 300;
  font-style: normal;
}

.identity-meta .tagline {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.03em;
}

.identity-meta .location {
  font-family: var(--font-display);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* Terminal Console Box */
.terminal-container {
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  height: 170px;
  margin: 1.5rem 0;
  overflow: hidden;
}

.terminal-header {
  background: #0d0d0f;
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.terminal-header span {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.terminal-status-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: traceBlink 1.5s infinite;
}

@keyframes traceBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.terminal-body {
  padding: 10px;
  overflow-y: auto;
  font-size: 0.7rem;
  line-height: 1.5;
  color: #86efac; /* Emerald green trace text */
  flex: 1;
}

.dl-entry {
  margin-bottom: 4px;
  word-break: break-all;
}

.dl-time {
  color: #34d399;
}

.dl-event {
  color: var(--text-primary);
  font-weight: 500;
}

.identity-footer {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
}

.social-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

.social-link {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-light);
  transition: all 0.3s var(--ease-out);
}

.social-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.social-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-2px);
}

/* Compact mobile navigation */
.mobile-nav {
  display: none;
}

/* ==========================================================================
   RIGHT COLUMN — Content Sections
   ========================================================================== */
.panel-content {
  padding: 4.5rem clamp(2rem, 6vw, 6rem);
  display: flex;
  flex-direction: column;
  gap: 6rem;
  overflow-y: auto;
}

.content-section {
  border-top: 1px solid var(--border);
  padding-top: 3.5rem;
  position: relative;
}

.content-section:first-of-type {
  border-top: none;
  padding-top: 0;
}

/* Section Titles (Brutalist style) */
.section-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  display: inline-block;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 4px;
}

.editorial-intro .large-text {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  line-height: 1.28;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 3.5rem;
}

.accent-line {
  font-weight: 600;
  color: var(--accent);
  position: relative;
  display: inline-block;
}

.accent-line::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 0;
  height: 2px;
  background-color: var(--accent);
  animation: lineDraw 1.4s 0.6s var(--ease-out) forwards;
}

@keyframes lineDraw {
  to {
    width: 100%;
  }
}


/* Meta Blocks Grid */
.meta-blocks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 4rem;
}

.meta-block h3 {
  color: var(--text-muted);
  font-size: 0.65rem;
  margin-bottom: 0.75rem;
}

.block-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

/* Language Slot Machine Rotator */
.block-title.lang-rotator {
  height: 1.8rem;
  line-height: 1.8rem;
  overflow: hidden;
  position: relative;
  margin-bottom: 0.25rem;
}

.lang-rotator-track {
  display: flex;
  flex-direction: column;
  animation: slotMachineRotate 8s cubic-bezier(0.77, 0, 0.175, 1) infinite;
  will-change: transform;
}

.block-title.lang-rotator:hover .lang-rotator-track {
  animation-play-state: paused;
}

.lang-rotator-item {
  height: 1.8rem;
  line-height: 1.8rem;
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--text-primary);
  flex-shrink: 0;
  backface-visibility: hidden;
}

@keyframes slotMachineRotate {
  0%, 20% {
    transform: translateY(0%);
  }
  25%, 45% {
    transform: translateY(-20%);
  }
  50%, 70% {
    transform: translateY(-40%);
  }
  75%, 95% {
    transform: translateY(-60%);
  }
  100% {
    transform: translateY(-80%);
  }
}

.block-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.block-time {
  font-size: 0.7rem;
  color: var(--accent);
}

/* Tech Stack Variable View */
/* ==========================================================================
   STACK MARQUEE (Auto-scrolling tech logos)
   ========================================================================== */
.stack-marquee {
  overflow: hidden;
  padding: 1.5rem 0;
  -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}

.marquee-track {
  display: flex;
  gap: 2.5rem;
  width: max-content;
  animation: marquee-scroll 35s linear infinite;
  will-change: transform;
}

.stack-marquee:hover .marquee-track {
  animation-play-state: paused;
}

.marquee-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  cursor: default;
}

.marquee-item img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: grayscale(1) brightness(0.75) opacity(0.65);
  transition: filter 0.4s var(--ease-out);
}

.marquee-item:hover img {
  filter: grayscale(0) brightness(1) opacity(1);
}

/* Text-only items (e.g. GTM) – styled to match image items */
.marquee-icon-text {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.4s var(--ease-out);
}

.marquee-item--text:hover .marquee-icon-text {
  color: var(--accent);
  border-color: var(--accent);
}

.marquee-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.4s var(--ease-out);
  white-space: nowrap;
}

.marquee-item:hover .marquee-label {
  opacity: 1;
}

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

/* ==========================================================================
   CLIENT GRID & TILES (Experience)
   ========================================================================== */
.client-grid {
  display: grid;
  /* Keep the 2-column Toyota/Lexus tile aligned with the four single tiles
     above it. `auto-fill` can switch to five columns at different browser
     viewport widths, leaving a visibly empty cell in the first row. */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: row;
  gap: 1px;
  background-color: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.client-tile {
  background-color: var(--bg-light);
  height: 120px;
  min-width: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  transition: background-color 0.4s var(--ease-out);
}

.client-tile.tile-double {
  grid-column: span 2;
}

.tile-logo-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0.5rem;
}

.tile-logo-pair {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0.5rem;
}

.tile-logo {
  display: block;
  max-width: 100%;
  width: 115px;
  height: 34px;
  object-fit: contain;
  object-position: center;
  box-sizing: border-box;
  filter: grayscale(100%) brightness(0) invert(1);
  opacity: 0.62;
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.tile-logo-pair .tile-logo {
  width: 70px;
  height: 28px;
  flex: 0 1 70px;
  max-width: calc(50% - 0.625rem);
}

.client-tile.tile-double .tile-logo-pair {
  gap: 2.25rem;
}

.client-tile.tile-double .tile-logo-pair .tile-logo {
  width: 105px;
  height: 42px;
  flex: 0 1 105px;
  max-width: calc(50% - 1.125rem);
}

/* Preserve internal, light-on-dark details in multi-tone source artwork. */
.tile-logo--tonal {
  filter: grayscale(100%) invert(84%);
  opacity: 0.84;
}

/* Logos with a neutral two-tone SVG variant retain their internal cut-outs. */
.tile-logo--native-tonal {
  filter: none;
  opacity: 0.84;
}

/* The source artwork includes substantial transparent margins. */
.tile-logo--cropped {
  object-fit: cover;
}

/* Square or tall aspect ratio logos require larger dimensions for balanced visual weight. */
.tile-logo--large {
  width: 64px;
  height: 64px;
}

/* Logos with a ~2:1 aspect ratio that need additional height for visual balance. */
.tile-logo--medium-large {
  width: 135px;
  height: 48px;
}

.tile-text {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  opacity: 0.6;
  text-align: center;
  transition: opacity 0.4s var(--ease-out), color 0.4s var(--ease-out);
}

/* Hover overlay details panel */
.tile-details {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-hover);
  border-top: 1px solid var(--accent);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 3px;
  transform: translateY(101%);
  transition: transform 0.4s var(--ease-out);
  z-index: 2;
  box-sizing: border-box;
}

.client-tile:hover .tile-details {
  transform: translateY(0);
}

.client-tile:hover .tile-logo {
  opacity: 0.9;
  transform: scale(1.03);
}

.client-tile:hover .tile-text {
  opacity: 0.9;
  color: var(--text-primary);
}

.tile-client-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-primary);
  line-height: 1.1;
}

.tile-focus {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.tile-status {
  font-size: 0.6rem;
  color: var(--accent);
  margin-top: 2px;
}

.roster-disclaimer {
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.6rem;
  text-align: right;
  opacity: 0.5;
}

/* ==========================================================================
   CAPABILITIES GRID
   ========================================================================== */
.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.cap-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.2rem 2rem;
  background: var(--bg-light);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: all 0.4s var(--ease-out);
}

.cap-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.cap-num {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
}

.cap-title {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  line-height: 1.15;
  color: var(--text-primary);
}

.cap-desc {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ==========================================================================
   CALL TO ACTION (CTA)
   ========================================================================== */
.cta-section {
  position: relative;
  z-index: 10;
}

.cta-header-block {
  margin-bottom: 2rem;
}

.cta-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.cta-desc {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 580px;
}

.cta-nav-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 1.5rem;
  background: transparent;
}

.cta-nav-item {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 8rem;
  padding: 1.5rem;
  text-decoration: none;
  border-right: 1px solid var(--border);
  transition: opacity 0.3s var(--ease-out);
  position: relative;
  overflow: hidden;
}

.cta-nav-item:last-child {
  border-right: none;
}

.cta-nav-text {
  font-size: clamp(1rem, 1.8vw, 1.4rem);
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.cta-nav-item:hover .cta-nav-text {
  color: var(--accent);
}

/* Fade other items in list when one is hovered */
.cta-nav-list:has(.cta-nav-item:hover) .cta-nav-item:not(:hover) {
  opacity: 0.35;
}

.glitch-char {
  color: var(--accent);
  font-weight: bold;
}

/* Mobile styling for CTA links */
@media (max-width: 768px) {
  .cta-nav-list {
    grid-template-columns: 1fr;
    border-bottom: none;
  }
  
  .cta-nav-item {
    min-height: 5.5rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.content-footer {
  border-top: 1px solid var(--border);
  padding-top: 2rem;
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.65rem;
}

/* ==========================================================================
   RESPONSIVENESS (MOBILE LAYOUT)
   ========================================================================== */
@media screen and (max-width: 1024px) {
  .mobile-nav {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    left: 50%;
    z-index: 100;
    width: calc(100% - 24px);
    min-height: 52px;
    padding: 7px 8px 7px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    background: rgba(13, 13, 16, 0.56);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(14px) saturate(135%);
    -webkit-backdrop-filter: blur(14px) saturate(135%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -12px);
    transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out), visibility 0.35s;
  }

  .mobile-nav.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
  }

  .mobile-nav-name {
    flex-shrink: 0;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.01em;
    white-space: nowrap;
  }

  .mobile-nav-name em {
    font-family: inherit;
    font-style: normal;
    font-weight: 300;
  }

  .mobile-nav-actions {
    position: relative;
    width: 106px;
    height: 32px;
    flex: 0 0 106px;
    overflow: hidden;
  }

  .mobile-nav-socials {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s ease, transform 0.42s var(--ease-out);
  }

  .mobile-nav-social {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.035);
    transition: color 0.25s var(--ease-out), border-color 0.25s var(--ease-out), background 0.25s var(--ease-out);
  }

  .mobile-nav-social svg {
    width: 14px;
    height: 14px;
  }

  .mobile-nav-social:active {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
  }

  .mobile-nav.is-over-contact .mobile-nav-socials {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-120%);
  }

  .mobile-nav-contact-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    opacity: 0;
    white-space: nowrap;
    transform: translateY(120%);
    transition: opacity 0.25s ease, transform 0.42s var(--ease-out);
  }

  .mobile-nav.is-over-contact .mobile-nav-contact-state {
    opacity: 1;
    transform: translateY(0);
  }

  .mobile-nav-contact-text {
    color: var(--text-primary);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.1em;
  }

  .mobile-nav-contact-arrow {
    color: var(--accent);
    font-size: 0.85rem;
    line-height: 1;
    transform: translateY(-1px);
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .panel-identity {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 3rem 2rem 2rem;
  }

  .identity-meta {
    margin: 0 0 2rem;
  }

  .identity-meta .name {
    font-size: 2.6rem;
  }

  .terminal-container {
    display: none;
  }

  .panel-content {
    padding: 3.5rem 2rem;
    gap: 4.5rem;
  }

  .editorial-intro .large-text {
    font-size: 1.8rem;
    margin-bottom: 2.5rem;
  }

  /* Mobile horizontal scroll list for client tiles */
  .client-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 12px;
    background-color: transparent;
    border: none;
    border-radius: 0;
    padding: 0.5rem 0 1.25rem;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
    -webkit-overflow-scrolling: touch;
  }

  .client-grid::-webkit-scrollbar {
    height: 4px;
  }

  .client-grid::-webkit-scrollbar-thumb {
    background-color: var(--accent);
    border-radius: 2px;
  }

  .client-grid .client-tile {
    flex: 0 0 180px;
    height: 120px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  .client-grid .client-tile.tile-double {
    flex: 0 0 280px;
  }
}

@media screen and (max-width: 640px) {
  .mobile-nav {
    width: calc(100% - 20px);
  }

  .meta-blocks {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
  }
}
