/*
 * RVNWD / Ravenwood: drafting-table site.
 * Instrument Sans for type, IBM Plex Mono for labels. Near-monochrome with
 * one orange accent. Panels are dark "screenshots" in both themes.
 * Color values are mirrored in tools/contrast.py; change both together.
 */

@font-face {
  font-family: "Instrument Sans";
  src: url("../assets/fonts/instrument-sans-var.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../assets/fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  /* Dark is the default for every visitor; the top-bar switch opts into light. */
  color-scheme: dark;
  --bg: #0c0e0d;
  --ink: #ecebe6;
  --muted: #9a9f9a;
  --grid: rgba(236, 235, 230, 0.055);
  --rule: rgba(236, 235, 230, 0.8);
  --accent: #e4611c;
  --accent-text: #e4611c;
  --panel: #151817;
  --panel-ink: #e9e7e1;
  --panel-muted: #8b908b;
  --panel-rule: #2c312f;
  --card: #1d2120;
  --done: #6fbf8f;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --index: 180px;
  --bar-height: 81px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f1efe9;
  --ink: #111312;
  --muted: #5b5f5b;
  --grid: rgba(17, 19, 18, 0.07);
  --rule: rgba(17, 19, 18, 0.85);
  --accent-text: #b24b15;
  --panel: #0e100f;
  --panel-rule: #262a28;
  --card: #171a19;
}

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

html {
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-height) + 16px);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s, color 0.3s;
}

h1, h2, h3, p, ol, dl, dd, figure {
  margin: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.panel :focus-visible {
  outline-color: var(--panel-ink);
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 10px 14px;
  color: var(--bg);
  background: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wrap {
  width: min(1360px, 100% - 2 * clamp(16px, 4vw, 48px));
  margin-inline: auto;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.idx {
  color: var(--muted);
}

.accent {
  color: var(--accent);
}

.accent-fill {
  fill: var(--accent);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

.icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}

/* Top bar */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  /* Extend the background to the window edges without widening the layout. */
  box-shadow: 0 0 0 100vmax var(--bg);
  clip-path: inset(0 -100vmax);
  transition: background-color 0.3s, box-shadow 0.3s;
}

.bar-book {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  color: var(--bg);
  background: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

/* Phone booking bar: pinned to the bottom, hidden while the contact section shows. */
.book-bar {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: var(--ink);
  line-height: 0;
}

.wordmark {
  display: block;
  width: 115px;
  height: auto;
}

.links {
  display: flex;
  gap: 24px;
}

.links a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--muted);
  text-decoration: none;
}

.links a:hover {
  color: var(--ink);
}

.toggle {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  color: inherit;
  background: none;
  border: 1px solid var(--rule);
  cursor: pointer;
}

.toggle-icon {
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

/* Opening screen */

.hero {
  display: grid;
  grid-template-columns: var(--index) 1fr;
  gap: 24px;
  padding: clamp(48px, 9vw, 120px) 0 clamp(28px, 4vw, 48px);
}

.hero .idx {
  padding-top: 1.2em;
}

h1 {
  font-weight: 600;
  font-stretch: 82%;
  letter-spacing: -0.035em;
  line-height: 0.9;
  font-size: clamp(52px, 10.5vw, 172px);
}

.sub {
  display: grid;
  grid-template-columns: minmax(0, 520px) auto;
  justify-content: space-between;
  align-items: end;
  gap: 32px;
  margin-top: clamp(28px, 4vw, 48px);
}

.sub p {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cta {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  color: var(--bg);
  background: var(--ink);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}

.cta .addr {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  opacity: 0.75;
}

/* Panels: dark "screenshots" in both themes */

.panel {
  color: var(--panel-ink);
  background: var(--panel);
  border: 1px solid var(--panel-rule);
}

.panel-top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--panel-rule);
  color: var(--panel-muted);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel-top .push {
  margin-left: auto;
}

.panel-top .live {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--panel-ink);
}

.panel-top .live .dot {
  width: 7px;
  height: 7px;
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

.board {
  margin-top: 8px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--panel-rule);
}

.kpi {
  padding: 16px 18px;
  border-right: 1px solid var(--panel-rule);
}

.kpi:last-child {
  border-right: 0;
}

.kpi .k {
  color: var(--panel-muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kpi .v {
  margin-top: 4px;
  font-size: clamp(26px, 3vw, 40px);
  font-weight: 600;
  font-stretch: 85%;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi .v small {
  margin-left: 4px;
  color: var(--panel-muted);
  font-size: 0.45em;
  font-weight: 500;
}

.spark {
  display: block;
  width: 100%;
  height: 34px;
  margin-top: 6px;
}

.spark polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.lanes {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  min-height: 330px;
}

.lane {
  padding: 12px 10px 16px;
  border-right: 1px solid var(--panel-rule);
}

.lane:last-child {
  border-right: 0;
}

.lane h3 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 12px;
  color: var(--panel-muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lane h3 b {
  color: var(--panel-ink);
  font-weight: 500;
}

.job {
  margin-bottom: 8px;
  padding: 9px 10px;
  background: var(--card);
  border: 1px solid var(--panel-rule);
  border-left: 3px solid #4f5653;
}

.job.hot {
  border-left-color: var(--accent);
}

.job.done {
  border-left-color: var(--done);
}

.job-no {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--panel-muted);
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
}

.job-name {
  margin-top: 3px;
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.25;
}

.job-bar {
  height: 3px;
  margin-top: 8px;
  background: var(--panel-rule);
}

.job-bar i {
  display: block;
  height: 100%;
  background: var(--panel-ink);
  opacity: 0.55;
  transition: width 0.6s;
}

.w-0 { width: 0; }
.w-10 { width: 10%; }
.w-20 { width: 20%; }
.w-30 { width: 30%; }
.w-40 { width: 40%; }
.w-50 { width: 50%; }
.w-60 { width: 60%; }
.w-70 { width: 70%; }
.w-80 { width: 80%; }
.w-90 { width: 90%; }
.w-100 { width: 100%; }

.caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  color: var(--muted);
}

/* Services */

.svc {
  margin-top: clamp(80px, 10vw, 140px);
  border-top: 1px solid var(--rule);
}

.svc-row {
  display: grid;
  grid-template-columns: var(--index) 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 22px 0 26px;
  border-bottom: 1px solid var(--grid);
}

.svc-row h2 {
  font-weight: 550;
  font-stretch: 85%;
  letter-spacing: -0.03em;
  line-height: 1;
  font-size: clamp(38px, 6vw, 92px);
}

.svc-row p {
  max-width: 56ch;
  margin-top: 10px;
  color: var(--muted);
  font-size: 17px;
}

.svc-row .arrow {
  color: var(--muted);
}

.svc-row:hover h2 {
  color: var(--accent-text);
}

/* Section heads */

.sec {
  margin-top: clamp(96px, 12vw, 168px);
}

.sec-head {
  display: grid;
  grid-template-columns: var(--index) 1fr;
  gap: 24px;
  align-items: end;
  margin-bottom: clamp(28px, 4vw, 48px);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.sec-head h2 {
  font-weight: 600;
  font-stretch: 82%;
  letter-spacing: -0.035em;
  line-height: 0.92;
  font-size: clamp(44px, 6.5vw, 104px);
}

.sec-head .idx {
  padding-bottom: 0.6em;
}

/* Work */

.case {
  display: grid;
  grid-template-columns: var(--index) minmax(0, 5fr) minmax(0, 7fr);
  gap: 24px 40px;
  padding: 8px 0 clamp(56px, 7vw, 96px);
}

.case h3 {
  font-weight: 600;
  font-stretch: 85%;
  letter-spacing: -0.03em;
  line-height: 1;
  font-size: clamp(32px, 3.6vw, 54px);
}

.case p {
  max-width: 46ch;
  margin: 16px 0 22px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.spec {
  border-top: 1px solid var(--rule);
}

.spec div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--grid);
  font-size: 14.5px;
}

.spec dt {
  color: var(--muted);
}

.visit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 10px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
}

.shot {
  align-self: start;
  min-width: 0;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
}

/* Gantt panel. Bars are drawn at their final fill; with JavaScript the
   .pre class empties them until the chart scrolls into view. */

.gantt {
  padding: 14px;
  font-family: var(--mono);
  font-size: 11px;
}

.g-scale {
  display: grid;
  grid-template-columns: 152px repeat(10, 1fr);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--panel-rule);
  color: var(--panel-muted);
}

.g-row {
  display: grid;
  grid-template-columns: 152px 1fr;
  align-items: center;
  height: 34px;
  border-bottom: 1px solid var(--panel-rule);
}

.g-label {
  overflow: hidden;
  padding-right: 8px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.g-track {
  position: relative;
  height: 100%;
  background-image: linear-gradient(90deg, var(--panel-rule) 1px, transparent 1px);
  background-size: 10% 100%;
}

.g-bar {
  position: absolute;
  top: 9px;
  height: 16px;
  background: #3a403d;
}

.g-bar i {
  display: block;
  height: 100%;
  background: var(--panel-ink);
  opacity: 0.8;
  transition: width 1.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.g-bar.late i {
  background: var(--accent);
  opacity: 1;
}

.g-now {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 43%;
  width: 1px;
  background: var(--accent);
  opacity: 0.35;
}

.g-row-1 .g-now {
  opacity: 1;
}

.g-row-1 .g-bar { left: 0%; width: 35%; }
.g-row-1 .g-bar i { width: 90%; }
.g-row-2 .g-bar { left: 10%; width: 30%; }
.g-row-2 .g-bar i { width: 70%; }
.g-row-3 .g-bar { left: 25%; width: 40%; }
.g-row-3 .g-bar i { width: 45%; }
.g-row-4 .g-bar { left: 30%; width: 25%; }
.g-row-4 .g-bar i { width: 30%; }
.g-row-5 .g-bar { left: 50%; width: 30%; }
.g-row-5 .g-bar i { width: 10%; }
.g-row-6 .g-bar { left: 65%; width: 30%; }
.g-row-6 .g-bar i { width: 0; }

.js .gantt.pre .g-bar i {
  width: 0;
}

/* BOM panel */

.bom {
  padding: 6px 14px 14px;
  font-size: 13px;
}

.bom table {
  width: 100%;
  border-collapse: collapse;
}

.bom th {
  padding: 9px 6px;
  border-bottom: 1px solid var(--panel-rule);
  color: var(--panel-muted);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.bom th.c,
.bom td.c {
  width: 64px;
  text-align: center;
}

.bom th button {
  min-height: 32px;
  padding: 4px 8px;
  color: inherit;
  background: none;
  border: 1px solid transparent;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.bom th button:hover,
.bom th button[aria-pressed="true"] {
  color: var(--panel-ink);
  border-color: var(--panel-rule);
}

.bom td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--panel-rule);
}

.bom td.pn {
  width: 92px;
  white-space: nowrap;
  color: var(--panel-muted);
  font-family: var(--mono);
  font-size: 11px;
}

.bom tr.l0 td.nm { font-weight: 600; }
.bom tr.l1 td.nm { padding-left: 22px; }
.bom tr.l2 td.nm { padding-left: 40px; color: #c9c7c0; }

.bom .y,
.bom .o {
  display: inline-block;
  width: 9px;
  height: 9px;
}

.bom .y {
  background: var(--panel-ink);
}

.bom .o {
  border: 1px solid var(--panel-muted);
}

.bom tbody tr.on td {
  background: rgba(228, 97, 28, 0.14);
}

/* Process */

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0;
  list-style: none;
}

.step {
  padding: 22px 24px 30px 0;
  border-right: 1px solid var(--grid);
}

.step + .step {
  padding-left: 24px;
}

.step:last-child {
  border-right: 0;
}

.step .n {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

.step:first-child .n {
  color: var(--accent-text);
}

.step h3 {
  margin: 40px 0 10px;
  font-weight: 600;
  font-stretch: 85%;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-size: clamp(24px, 2.4vw, 34px);
}

.step p {
  color: var(--muted);
  font-size: 15.5px;
}

/* About */

.about {
  display: grid;
  grid-template-columns: var(--index) minmax(0, 7fr) minmax(0, 4fr);
  gap: 24px 48px;
}

.about p {
  font-size: clamp(21px, 2vw, 28px);
  font-weight: 450;
  line-height: 1.38;
  letter-spacing: -0.01em;
}

.about .spec {
  align-self: start;
}

/* Contact */

.contact {
  margin-top: clamp(110px, 14vw, 200px);
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

.contact .lead {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
}

.contact .on {
  color: var(--accent-text);
}

.contact a.big {
  display: block;
  margin: clamp(28px, 4vw, 48px) 0 18px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 600;
  font-stretch: 78%;
  letter-spacing: -0.045em;
  line-height: 0.9;
  font-size: clamp(44px, 12.2vw, 196px);
  text-decoration: none;
}

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

.contact p {
  max-width: 54ch;
  color: var(--muted);
  font-size: 19px;
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: clamp(80px, 10vw, 140px);
  padding: 18px 0 40px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
}

/* Layout changes */

@media (max-width: 900px) {
  .hero,
  .svc-row,
  .sec-head,
  .case,
  .about {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero .idx {
    padding-top: 0;
  }

  .sub {
    grid-template-columns: minmax(0, 1fr);
  }

  .links {
    display: none;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi:nth-child(2) {
    border-right: 0;
  }

  .kpi:nth-child(-n + 2) {
    border-bottom: 1px solid var(--panel-rule);
  }

  .lanes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 260px;
  }

  .lane:nth-child(n + 3) {
    display: none;
  }

  .job-due,
  .panel-top .hide-sm,
  .svc-row .arrow {
    display: none;
  }

  .g-scale {
    grid-template-columns: 92px repeat(10, 1fr);
  }

  .g-scale span:nth-child(odd):not(:first-child) {
    visibility: hidden;
  }

  .g-row {
    grid-template-columns: 92px 1fr;
    height: 40px;
  }

  /* Stack the work-order number over the part name so the name is never cut. */
  .g-label {
    overflow: visible;
    font-size: 10px;
    line-height: 1.2;
    white-space: normal;
  }

  .g-no,
  .g-nm {
    display: block;
    white-space: nowrap;
  }

  .g-no {
    color: var(--panel-muted);
  }

  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .step {
    padding: 20px 16px 26px 0;
    border-bottom: 1px solid var(--grid);
  }

  .step + .step {
    padding-left: 0;
  }

  .step:nth-child(2n) {
    padding-left: 16px;
    border-right: 0;
  }

  .step h3 {
    margin-top: 22px;
  }

  .contact .lead,
  .caption,
  .foot {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .bar-book {
    display: none;
  }

  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .book-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: flex;
    min-height: 56px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    color: var(--bg);
    background: var(--ink);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: transform 0.25s ease, background-color 0.3s, color 0.3s;
  }

  .book-bar .addr {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 400;
    opacity: 0.75;
  }

  .contact-in-view .book-bar {
    transform: translateY(110%);
  }

  .book-bar:focus-visible {
    outline-offset: -6px;
    outline-color: var(--bg);
  }
}

@media (max-width: 480px) {
  .cta {
    flex-wrap: wrap;
    gap: 4px 14px;
    white-space: normal;
  }

  .bom {
    padding-inline: 8px;
    font-size: 12px;
  }

  .bom .col-pro {
    display: none;
  }

  .bom td.pn {
    width: 64px;
    font-size: 10px;
  }

  .bom th.c,
  .bom td.c {
    width: 52px;
  }

  .bom tr.l1 td.nm { padding-left: 10px; }
  .bom tr.l2 td.nm { padding-left: 18px; }

  .steps {
    grid-template-columns: minmax(0, 1fr);
  }

  .step:nth-child(2n) {
    padding-left: 0;
  }

  .step {
    border-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
