/* =============================================================
   favur.dev — Stylesheet
   Design system: Brutal, minimalist, dark.
   All values from Favur.Dev Vision document Section 10.
   ============================================================= */

/* ----- Font Faces (self-hosted JetBrains Mono, Section 10.2) ----- */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/fonts/JetBrainsMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/fonts/JetBrainsMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/fonts/JetBrainsMono-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ----- CSS Custom Properties (Section 10.1) ----- */
:root {
  /* Colors */
  --bg: #0a0a0a;
  --text: #e0e0e0;
  --text-muted: #808080;
  --accent: #4a8a9a;
  --white: #ffffff;
  --border: #1a1a1a;
  --border-active: #404040;

  /* Spacing (8px base unit, Section 10.3) */
  --space-1: 8px;
  --space-1-5: 12px;
  --space-2: 16px;
  --space-3: 24px;
  --space-6: 48px;
  --space-8: 64px;

  /* Typography (Section 10.2) */
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Source Code Pro', 'Consolas', monospace;

  /* Layout */
  --content-max-width: 800px;
  --sidebar-width: 72px;
  --tabbar-height: 68px;

  /* Transitions (Section 10.5) */
  --transition-slide: 200ms linear;
  --transition-tab: 200ms linear;
  --transition-hover: 150ms linear;
  --transition-contact-reveal: 600ms linear;
}

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

html, body {
  height: 100%;
  overflow: hidden; /* No scrolling on desktop (Section 6.7) */
}

body {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--text-muted);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ----- Screen reader only utility ----- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =============================================================
   LAYOUT ENGINE (Section 2.1)
   CSS Grid: 2 rows (main + tab bar), main splits into 2 cols.
   Three zones: central stage, right sidebar, bottom tab bar.
   Full viewport. No scrolling. Mirrors Favur TUI structure.
   ============================================================= */
.site-layout {
  display: grid;
  grid-template-rows: 1fr var(--tabbar-height);
  grid-template-columns: 1fr var(--sidebar-width);
  grid-template-areas:
    "stage sidebar"
    "tabbar tabbar";
  width: 100vw;
  height: 100vh;
  min-height: 768px; /* Viewport-fit constraint (Section 2.1) */
  overflow: hidden;
}

/* ----- Central Stage ----- */
.stage {
  grid-area: stage;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

/* ----- Right Sidebar ----- */
.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1-5);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

/* ----- Bottom Tab Bar ----- */
.tab-bar {
  grid-area: tabbar;
  padding: var(--space-1-5);
  border-top: 1px solid var(--border);
}

/* Inner container carries tablist role (Section 10.7)
   Separated from <nav> so both landmark and tablist semantics are preserved. */
.tab-bar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  height: 100%;
}

/* =============================================================
   SLIDE SYSTEM (Section 2.3)
   Each slide is absolutely positioned for transition animations.
   Only the .active slide is visible.
   Transition: current exits left, new enters from right.
   Duration: 200ms linear (Section 10.5).
   ============================================================= */
.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateX(100%);
  transition: transform var(--transition-slide), opacity var(--transition-slide);
}

.slide.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  z-index: 1;
}

.slide.exiting {
  opacity: 0;
  transform: translateX(-100%);
  z-index: 0;
}

/* Tab switch: vertical wipe upward from tab bar (Section 10.5)
   The tab-enter class positions the slide at the bottom (translateY(100%)).
   When tab-enter is removed, the slide transitions to translateY(0) via .active.
   This class must come AFTER .slide.active in the source so it wins
   at equal specificity — ensuring the starting position is correct. */
.slide.tab-enter {
  transform: translateY(100%);
  opacity: 0;
}

/* ----- Slide Content ----- */
.slide-content {
  max-width: var(--content-max-width);
  width: 100%;
  padding: var(--space-8);
  text-align: left;
}

/* =============================================================
   TYPOGRAPHY (Section 10.2)
   All text: JetBrains Mono. No exceptions.
   Headings: -0.5px letter-spacing, line-height 1.2.
   Body: line-height 1.7 for monospace readability.
   ============================================================= */
.hero-title {
  font-size: 40px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: var(--space-3);
}

.hero-subtitle {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-3);
}

.slide-heading {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: var(--space-3);
}

.slide-body {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-3);
}

.slide-body-secondary {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-3);
  opacity: 0.7;
}

/* =============================================================
   MEDIA PLACEHOLDERS (Section 10.4, 10.6)
   Structured so real GIFs/images swap in without layout changes.
   GIF containers: max-width 560px, ~280px height, #0e0e0e bg.
   ============================================================= */
.media-placeholder {
  margin-top: var(--space-3);
}

.placeholder-box {
  max-width: 560px;
  height: 280px;
  border: 1px solid var(--border);
  background: #0e0e0e; /* Slightly lighter than page bg — subtle containment */
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-box--tall {
  height: 320px;
}

.placeholder-label {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.4;
}

/* GIF/video containers — used when real assets replace placeholders (Section 9.3, 10.6)
   Drop-in replacement: swap .placeholder-box for .media-container.
   Supports <img>, <video>, and <picture> elements.
   Fallback: styled dark rectangle with muted label (not browser error icon). */
.media-container {
  max-width: 560px;
  border: 1px solid var(--border);
  background: #0e0e0e;
  overflow: hidden;
}

.media-container img,
.media-container video {
  display: block;
  width: 100%;
  height: auto;
}

/* Video-specific: behave like GIF (Section 10.6) */
.media-container video {
  object-fit: cover;
}

/* Fallback when GIF/video fails to load (Section 9.3)
   "a styled placeholder that matches the brutal aesthetic
   (a dark rectangle with a thin border and a muted label)" */
.media-fallback {
  max-width: 560px;
  height: 280px;
  border: 1px solid var(--border);
  background: #0e0e0e;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-fallback-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.3;
}

/* =============================================================
   FEATURE LIST (showcase slides, Section 2.5)
   ============================================================= */
.feature-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.feature-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feature-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.feature-desc {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}

/* =============================================================
   SOURCE CODE LINKS (Section 10.4)
   Inline-flex with GitHub icon. Accent color border/text.
   Hover: barely perceptible accent tint.
   ============================================================= */
.source-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-1);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 400;
  text-decoration: none;
  transition: background var(--transition-hover);
}

.source-link:hover {
  background: rgba(74, 138, 154, 0.1);
}

.source-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Disabled source link — repo not yet published */
.source-link--disabled {
  opacity: 0.35;
  cursor: default;
  position: relative;
}

.source-link--disabled:hover {
  background: transparent;
}

.source-link-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: var(--border-active);
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}

.source-link--disabled:hover .source-link-tooltip {
  display: block;
}

.icon-github {
  flex-shrink: 0;
}

/* =============================================================
   CONTACT SECTION (Section 2.4)
   ============================================================= */
.contact-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.contact-email {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

/* =============================================================
   PAGE COUNTER (Section 10.4)
   Extremely faint. Informational only. Not a navigation element.
   ============================================================= */
.page-counter {
  position: absolute;
  bottom: var(--space-2);
  left: var(--space-2);
  font-size: 11px;
  font-weight: 400;
  color: #2a2a2a;
  z-index: 2;
  pointer-events: none;
}

/* =============================================================
   TAB BUTTONS (Section 10.4)
   Large, flat, white rectangular buttons.
   Most visually prominent elements on the page (intentional).
   ============================================================= */
.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1-5) var(--space-1-5);
  min-height: 44px;
  background: var(--white);
  color: var(--bg);
  border: none;
  border-radius: 0; /* No rounding — ever (Section 10.8) */
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--transition-hover);
  outline: none;
}

.tab:hover {
  opacity: 0.85;
}

.tab.active {
  opacity: 1;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tab-icon {
  flex-shrink: 0;
}

.tab-label {
  white-space: nowrap;
}

/* ----- Contact Tab (special variant, Section 10.4) ----- */
/* Accent color border on transparent background. Visually distinct. */
.tab--contact {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-contact-reveal);
}

.tab--contact.revealed {
  opacity: 1;
  pointer-events: auto;
}

.tab--contact.revealed:hover {
  opacity: 0.85;
}

.tab--contact.revealed.active {
  opacity: 1;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* =============================================================
   THUMBNAIL BUTTONS (Section 10.4)
   Right sidebar navigation — one per slide.
   48x36px. Label: page number "01", "02", etc.
   ============================================================= */
.thumbnail {
  position: relative;
  width: 48px;
  height: 36px;
  border: 1px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--transition-hover);
  outline: none;
  font-family: var(--font-mono);
  border-radius: 0;
  padding: 0;
}

.thumbnail:hover {
  border-color: var(--border-active);
}

.thumbnail.active {
  border-color: var(--text);
}

.thumbnail:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.thumbnail-label {
  font-size: 8px;
  font-weight: 400;
  color: var(--text-muted);
}

.thumbnail.active .thumbnail-label {
  color: var(--text);
}

/* ----- Progress Bar (Section 10.4) ----- */
/* 2px accent line, fills left-to-right over auto-advance interval. */
.thumbnail-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent);
  /* Animation timing set by JS based on auto-advance interval */
}

.thumbnail-progress.filling {
  transition: width linear;
  width: 100%;
}

/* =============================================================
   PREFERS-REDUCED-MOTION (Section 10.7)
   Disable auto-advance animations. Instant transitions.
   All state changes become instantaneous.
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .slide {
    transition: none;
  }

  .thumbnail-progress {
    transition: none;
  }

  .tab--contact {
    transition: none;
  }

  .tab {
    transition: none;
  }

  .thumbnail {
    transition: none;
  }

  .source-link {
    transition: none;
  }
}

/* =============================================================
   MOBILE FALLBACK (Section 9.5)
   Below 1024px: show only Favur hero slide.
   No tab bar, no sidebar, no presentation engine.
   Full screen dark with hero content.
   ============================================================= */
@media (max-width: 1023px) {
  html, body {
    overflow: auto; /* Allow scrolling on mobile */
  }

  .site-layout {
    display: block;
    min-height: 100vh;
    height: auto;
    overflow: visible;
  }

  .stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    border-right: none;
  }

  /* Hide all slides except the Favur hero */
  .slide {
    display: none;
    position: relative;
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  .slide[data-tab="favur"][data-slide-index="0"] {
    display: flex;
  }

  .slide-content {
    padding: var(--space-6);
  }

  /* Hide sidebar and tab bar on mobile */
  .sidebar {
    display: none;
  }

  .tab-bar {
    display: none;
  }

  .tab-bar-inner {
    display: none;
  }

  .page-counter {
    display: none;
  }
}

/* =============================================================
   NO-JS FALLBACK (Section 9.4, Progressive Enhancement)
   Without JavaScript, all slides are shown stacked vertically.
   Styles are injected via <noscript><style> in the HTML <head>,
   not via a class on <html>. This prevents the flash of all
   content that occurred with the old class="no-js" approach.
   ============================================================= */

/* =============================================================
   IMAGE LIGHTBOX
   Click-to-expand overlay for media images.
   Dark overlay with centered expanded image.
   No rounded corners, no shadows — brutal aesthetic.
   ============================================================= */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 10, 0.92);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 200ms linear;
}

.lightbox-overlay[hidden] {
  display: none;
}

.lightbox-overlay.visible {
  opacity: 1;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 85vh;
  border: 1px solid var(--border);
  background: #0e0e0e;
  display: block;
}

/* Reduced motion: instant lightbox transitions */
@media (prefers-reduced-motion: reduce) {
  .lightbox-overlay {
    transition: none;
  }
}

/* Mobile: hide lightbox functionality (no presentation engine on mobile) */
@media (max-width: 1023px) {
  .lightbox-overlay {
    display: none;
  }
}

/* =============================================================
   EXPLICIT PROHIBITIONS (Section 10.8)
   These rules exist to prevent accidental introduction:
   - No rounded corners (border-radius: 0 everywhere)
   - No box-shadow on any element
   - No gradients
   - No background images/textures
   - No transform animations (scale, rotate) on hover
   ============================================================= */
