/* ---------------------------------------------------------------
   Film Cutting Bench
   Development setup as a perforated rail with punched frames,
   grease cross completion marks, and an orange folded flag
   marking your current position on the bench.
   --------------------------------------------------------------- */

:root {
  /* Editing room palette */
  --editing-black: #000000;
  --flag-orange: #FF6B00;
  --window-white: #FFFFFF;
  --ink: #E8E8E8;
  --ink-muted: #999999;
  --perforation-gray: #333333;
  --pin-metal: #555555;

  /* Film grain texture in orange */
  --grain-texture: radial-gradient(circle at 20% 50%, transparent 0%, rgba(255, 107, 0, 0.015) 100%),
                   radial-gradient(circle at 80% 80%, transparent 0%, rgba(255, 107, 0, 0.015) 100%),
                   repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255, 107, 0, 0.03) 2px, rgba(255, 107, 0, 0.03) 4px);

  /* Condensed grotesk stack */
  --sans: "SF Pro Text Condensed", "Helvetica Neue Condensed", "Arial Narrow", "Roboto Condensed", sans-serif-condensed, sans-serif;
  --mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;

  scrollbar-color: var(--perforation-gray) transparent;
  caret-color: var(--flag-orange);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.65;
  color: var(--ink);
  background: var(--editing-black);
  min-height: 100vh;
}

/* ---------------------------------------------------------------
   BENCH STRUCTURE
   --------------------------------------------------------------- */

.bench {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.masthead {
  padding: 3rem 2rem 1.5rem;
  border-bottom: 1px solid var(--perforation-gray);
}

.title {
  margin: 0 0 2rem;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--window-white);
  text-align: center;
}

/* ---------------------------------------------------------------
   PERFORATED RAIL
   --------------------------------------------------------------- */

.rail {
  display: flex;
  gap: 0;
  justify-content: center;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  flex-wrap: wrap;
}

.frame-cell {
  position: relative;
  width: 90px;
  height: 100px;
  border: 1px solid var(--perforation-gray);
  border-right: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s cubic-bezier(0.2, 0, 0, 1);
}

.frame-cell:last-child {
  border-right: 1px solid var(--perforation-gray);
}

.frame-cell:hover {
  border-color: var(--flag-orange);
}

/* Pin marks at top of each frame */
.pin {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--pin-metal);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Perforations */
.perforation {
  position: absolute;
  top: 0;
  left: -3px;
  width: 6px;
  height: 6px;
  background: var(--editing-black);
  border: 1px solid var(--perforation-gray);
  border-radius: 50%;
}

.frame-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}

/* Grease cross completion mark */
.cross-mark {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cross {
  position: relative;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: block;
}

.cross::before,
.cross::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--flag-orange);
  transform-origin: center;
  transition: width 0.2s cubic-bezier(0.2, 0, 0, 1);
  opacity: 0;
}

.cross::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.cross::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.cross-mark:checked + .cross::before,
.cross-mark:checked + .cross::after {
  width: 20px;
  opacity: 1;
}

.cross-mark:focus-visible + .cross {
  outline: 2px solid var(--flag-orange);
  outline-offset: 3px;
}

/* Folded orange flag for current step */
.flag {
  position: absolute;
  top: 0;
  right: -8px;
  width: 16px;
  height: 24px;
  background: var(--flag-orange);
  opacity: 0;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 50%, 0 70%);
  box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.4);
  transition: opacity 0.15s cubic-bezier(0.2, 0, 0, 1);
  pointer-events: none;
}

.frame-cell.current .flag {
  opacity: 1;
}

.frame-cell.current {
  border-color: var(--flag-orange);
  background: rgba(255, 107, 0, 0.05);
}

/* ---------------------------------------------------------------
   REEL (MAIN CONTENT)
   --------------------------------------------------------------- */

.reel {
  flex: 1;
  padding: 3rem 1.5rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* Punched white windows for each step */
.window {
  background: var(--window-white);
  border: 2px solid var(--perforation-gray);
  margin-bottom: 3rem;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  scroll-margin-top: 2rem;
}

.window-header {
  background: var(--editing-black);
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--perforation-gray);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.step-num {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 300;
  color: var(--flag-orange);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.step-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--window-white);
}

.window-body {
  padding: 2rem;
  color: #1a1a1a;
}

.explanation {
  margin: 0 0 2rem;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: #333333;
}

/* Command blocks */
.command-block {
  margin-bottom: 2rem;
}

.command-block:last-of-type {
  margin-bottom: 1rem;
}

.block-label {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #666666;
}

pre {
  margin: 0 0 0.75rem;
  padding: 1rem 1.25rem;
  background: #f5f5f5;
  border: 1px solid #dddddd;
  border-left: 1px solid var(--flag-orange);
  overflow-x: auto;
  font-size: 0.9375rem;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: #1a1a1a;
}

p code {
  background: #f5f5f5;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  border: 1px solid #dddddd;
}

kbd {
  font-family: var(--mono);
  font-size: 0.85em;
  background: #2a2a2a;
  color: #ffffff;
  padding: 0.2em 0.5em;
  border-radius: 3px;
  box-shadow: 0 2px 0 #000000,
              0 0 0 1px #444444;
  display: inline-block;
}

.note {
  margin: 0.75rem 0 0;
  font-size: 0.9375rem;
  color: #666666;
  line-height: 1.6;
}

.expect {
  margin: 0.75rem 0 0;
  font-size: 0.9375rem;
  color: #333333;
  font-weight: 500;
}

/* Annotation arrows (borrowed from hand-drawn zine) */
.annotation {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(255, 107, 0, 0.05);
  border-left: 1px solid var(--flag-orange);
  font-size: 0.9375rem;
  color: #333333;
}

.arrow {
  flex-shrink: 0;
  color: var(--flag-orange);
}

.next-steps {
  margin-top: 1.5rem;
}

.next-steps ul {
  margin: 1rem 0 0;
  padding-left: 1.5rem;
  line-height: 1.8;
}

.next-steps li {
  margin-bottom: 0.5rem;
  color: #333333;
}

/* ---------------------------------------------------------------
   PROGRESS BAND
   --------------------------------------------------------------- */

.progress-band {
  background: var(--flag-orange);
  background-image: var(--grain-texture);
  padding: 1.5rem 2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.2);
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.step-counter {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--editing-black);
}

#current-step {
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------
   BROWSER SURFACES
   --------------------------------------------------------------- */

::selection {
  background: var(--flag-orange);
  color: var(--window-white);
}

:focus-visible {
  outline: 2px solid var(--flag-orange);
  outline-offset: 3px;
}

a {
  color: var(--flag-orange);
  text-underline-offset: 0.18em;
}

/* ---------------------------------------------------------------
   RESPONSIVE
   --------------------------------------------------------------- */

@media (max-width: 768px) {
  .masthead {
    padding: 2rem 1rem 1rem;
  }

  .title {
    font-size: 1.5rem;
  }

  .rail {
    gap: 0;
    padding: 0;
  }

  .frame-cell {
    width: 48px;
    height: 64px;
  }

  .frame-label {
    font-size: 0.5rem;
  }

  .cross {
    width: 16px;
    height: 16px;
  }

  .cross-mark:checked + .cross::before,
  .cross-mark:checked + .cross::after {
    width: 12px;
  }

  .pin {
    width: 3px;
    height: 3px;
  }

  .flag {
    width: 12px;
    height: 18px;
    right: -6px;
  }

  .reel {
    padding: 2rem 1rem;
  }

  .window-header {
    padding: 1rem 1.25rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .step-num {
    font-size: 1.75rem;
  }

  .step-title {
    font-size: 1.125rem;
  }

  .window-body {
    padding: 1.5rem 1.25rem;
  }

  pre {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
  }

  .progress-band {
    padding: 1rem 1.5rem;
  }

  .step-counter {
    font-size: 0.875rem;
  }
}

/* ---------------------------------------------------------------
   MOTION
   --------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------
   PRINT
   --------------------------------------------------------------- */

@media print {
  body {
    background: #ffffff;
    color: #000000;
  }

  .progress-band {
    display: none;
  }

  .flag {
    display: none;
  }

  .window {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #cccccc;
  }

  .window-header {
    background: #f5f5f5;
    border-bottom: 1px solid #cccccc;
  }

  .step-num,
  .step-title {
    color: #000000;
  }

  pre {
    border: 1px solid #cccccc;
    background: #f9f9f9;
  }

  .annotation {
    background: none;
    border-left: 1px solid #cccccc;
  }
}
