/* LogicLinks website
   Colours follow the Companion app (ll_companion/frontend/styles.css): warm monochrome with
   one strong orange (--hi, "this signal is 1"). Gold is the silkscreen on the blocks,
   green is their LEDs. Dark is the default; [data-theme="light"] switches. */

:root {
  --bg: #131211;
  --bg-alt: #1b1a18;
  --raised: #24221f;
  --border: #2c2a26;
  --border-strong: #3d3a35;
  --text: #ebe9e4;
  --text-2: #a7a39a;
  --text-3: #736f67;

  --hi: #ff8133;
  --hi-hover: #ff965a;
  --on-hi: #1a0f08;
  --hi-text: #ff9a57;
  --silk: #e0b23a;         /* gold block labels */
  --led: #6cc28a;
  --chain: #7a7874;        /* background chain (chain.js); lighter grey than the logo so */
  --chain-link: #a8460f;   /* the blocks don't vanish on dark */
  --chain-opacity: 0.5;

  --shadow: 0 2px 6px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.45);

  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", ui-monospace, Menlo, Consolas, monospace;

  --r: 6px;
  --r-lg: 9px;
  --wrap: 1120px;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #efede8;
  --bg-alt: #f8f7f4;
  --raised: #ffffff;
  --border: #dedad1;
  --border-strong: #c6c1b5;
  --text: #1f1e1b;
  --text-2: #5a5750;
  --text-3: #8a867c;

  --hi: #e8590c;
  --hi-hover: #cf4f0a;
  --on-hi: #ffffff;
  --hi-text: #b8440a;
  --silk: #a87a00;
  --led: #2d7a4a;
  --chain: #474746;
  --chain-link: #c54d10;
  --chain-opacity: 0.18;

  --shadow: 0 2px 6px rgba(40, 35, 25, 0.08), 0 12px 32px rgba(40, 35, 25, 0.12);

  color-scheme: light;
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

img, video { display: block; max-width: 100%; height: auto; }

a { color: var(--hi-text); }
a:hover { color: var(--hi); }

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.4rem, 6vw, 3.8rem); font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.3rem); font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 12px 22px;
  border: 2px solid var(--hi);
  border-radius: var(--r);
  background: var(--hi);
  color: var(--on-hi);
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--hi-hover); border-color: var(--hi-hover); color: var(--on-hi); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: transparent; border-color: var(--text); color: var(--text); }
.btn-small { padding: 7px 14px; font-size: 0.9rem; white-space: nowrap; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-row { display: flex; align-items: center; gap: 24px; height: 64px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: auto; height: 30px; }
.brand-name { font-family: var(--font-mono); font-weight: 800; font-size: 1.2rem; letter-spacing: 0.02em; }

.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.nav a:hover { color: var(--text); }

.header-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-3); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }

/* ---------- Hero ---------- */

.hero { padding: 56px 0 72px; }
.hero-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 48px; align-items: center; }
.eyebrow {
  display: inline-block;
  margin-bottom: 18px;
  padding: 4px 10px;
  border: 1px solid var(--hi);
  border-radius: 999px;
  color: var(--hi-text);
  font: 700 0.8rem var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lede { font-size: 1.15rem; color: var(--text-2); max-width: 34em; }
.hero-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-photo { margin: 0; }
.hero-photo img { border-radius: var(--r-lg); box-shadow: var(--shadow); border: 1px solid var(--border); }

/* ---------- Sections ---------- */

.section { padding: 80px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 46em; margin-bottom: 40px; }
.section-head p { color: var(--text-2); font-size: 1.08rem; }

.photo { margin: 0; overflow: hidden; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--raised); }
.photo img { width: 100%; }

.fine { font-size: 0.88rem; color: var(--text-3); }

/* Block cards: gold corner chevrons like the real enclosures */
.blocks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.block-card {
  position: relative;
  padding: 22px 22px 8px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.block-card::before,
.block-card::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--silk);
}
.block-card::before { top: -1px; left: -1px; border-top-left-radius: var(--r-lg); clip-path: polygon(0 0, 100% 0, 0 100%); }
.block-card::after { bottom: -1px; right: -1px; border-bottom-right-radius: var(--r-lg); clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.block-card p { color: var(--text-2); font-size: 0.97rem; }
.silk {
  font-family: var(--font-mono);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--silk);
}

/* How it works */
.steps { list-style: none; padding: 0; margin: 0 0 56px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.step { position: relative; }
.step .photo { margin-bottom: 18px; aspect-ratio: 3 / 2; }
.step .photo img, .step .photo video { width: 100%; height: 100%; object-fit: cover; }
.step-num {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--hi);
  color: var(--on-hi);
  font: 800 1rem var(--font-mono);
}
.step p { color: var(--text-2); }

.video { margin: 0; }
.video video { width: 100%; border-radius: var(--r-lg); border: 1px solid var(--border); background: #000; }
.video figcaption { margin-top: 10px; color: var(--text-3); font-size: 0.92rem; text-align: center; }

/* Companion */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.split p { color: var(--text-2); }

/* Who it's for */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.card {
  padding: 22px 22px 8px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-top: 3px solid var(--led);
  border-radius: var(--r-lg);
}
.card p { color: var(--text-2); font-size: 0.97rem; }

/* Galleries */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.gallery .photo { display: block; aspect-ratio: 4 / 3; }
.gallery .photo img { height: 100%; object-fit: cover; transition: transform 0.25s; }
.gallery .photo:hover img { transform: scale(1.03); }
.gallery-tall { grid-template-columns: repeat(5, 1fr); }
.gallery-tall .photo { aspect-ratio: 3 / 4; }

/* Call to action */
.cta {
  max-width: 760px;
  margin: 0 auto;
  padding: 44px 40px 28px;
  text-align: center;
  background: var(--raised);
  border: 2px solid var(--hi);
  border-radius: var(--r-lg);
}
.cta p { color: var(--text-2); font-size: 1.08rem; }
/* Shown as text too, for visitors without a mail app set up */
.cta .contact-address { font-family: var(--font-mono); font-size: 0.95rem; }

/* ---------- Background chain (chain.js) ----------
   The chain layer is positioned at z-index 0: above the (unpositioned) section background
   colours, below every .wrap, which is lifted to z-index 1. */

body { position: relative; }
.wrap { position: relative; z-index: 1; }
.chain-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: var(--chain-opacity);
}
.chain-layer svg { display: block; }
.ch-f { fill: var(--chain); }
.ch-h { fill: none; stroke: var(--chain); }
.ch-b { fill: var(--chain-link); }

/* ---------- Footer ---------- */

.site-footer { padding: 28px 0 40px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 0.92rem; }
.footer-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--text-2); }

/* ---------- Lightbox ---------- */

.lightbox {
  max-width: 94vw;
  max-height: 94vh;
  padding: 0;
  border: none;
  border-radius: var(--r-lg);
  background: transparent;
  overflow: visible;
}
.lightbox::backdrop { background: rgba(0, 0, 0, 0.85); }
.lightbox img { max-width: 94vw; max-height: 90vh; width: auto; border-radius: var(--r-lg); }
.lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--hi);
  color: var(--on-hi);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 960px) {
  .nav { display: none; }
  .header-actions { margin-left: auto; }
  .hero-grid, .split { grid-template-columns: 1fr; gap: 32px; }
  .hero { padding-top: 32px; }
  .blocks { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; max-width: 560px; }
  .gallery-tall { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .header-row { gap: 10px; }
  .brand { gap: 8px; }
  .brand-mark { height: 24px; }
  .brand-name { font-size: 1rem; }
  .btn-small { padding: 7px 10px; font-size: 0.85rem; }
  .wide-only { display: none; }
  .section { padding: 56px 0; }
  .blocks, .cards { grid-template-columns: 1fr; }
  .gallery, .gallery-tall { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cta { padding: 32px 20px 16px; }
}
