/* ==========================================================================
   Red Box Software — shared design system
   --------------------------------------------------------------------------
   The look introduced on the projects and home pages, in one place so every
   page stays consistent and a change here reaches the whole site.

   Load order matters. Always:

       <link rel="stylesheet" href="./css/style.css" />   <- site-wide legacy
       <link rel="stylesheet" href="./css/modern.css" />  <- this file
       <style> ...page-specific rules... </style>         <- page overrides

   style.css still owns the navigation and footer. Several rules below exist
   purely to undo its older, full-height-flex-centred page layout.
   ========================================================================== */

:root {
  --accent: #ff2c3c;
  --accent-soft: rgba(255, 44, 60, 0.12);
  --accent-line: rgba(255, 44, 60, 0.35);
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f4f4f6;
  --muted: #9a9aa4;
  --faint: #6f6f79;
}

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

body {
  background: #08080a;
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

/* Soft ambient glow behind the page content */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(
      60vw 60vw at 15% -10%,
      rgba(255, 44, 60, 0.16),
      transparent 60%
    ),
    radial-gradient(
      50vw 50vw at 100% 20%,
      rgba(255, 44, 60, 0.07),
      transparent 60%
    );
}

/* style.css makes <main> a full-height centred flex column; undo that so
   sections simply flow down the page. */
main {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0 24px 120px;
  box-sizing: border-box;
  overflow: visible;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
}

.wrap--wide {
  max-width: 1320px;
}

.wrap--narrow {
  max-width: 820px;
}

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

/* ---------- Type ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  padding: 6px 14px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* <em> marks the accent-coloured words in a headline. */
.hero h1 em,
.page-head h1 em,
.section-head h2 em,
.cta h2 em {
  font-style: normal;
  color: var(--accent);
}

.lead {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.65;
}

/* ---------- Hero / page header ----------
   .hero is the big landing treatment; .page-head is the smaller header
   interior pages open with. */

.hero {
  max-width: 720px;
  padding: 88px 0 56px;
}

.hero h1 {
  margin: 0 0 20px;
  padding: 0;
  color: var(--text);
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 700;
  text-align: left;
}

/* Deliberately no `.hero p` rule: it would out-rank .eyebrow and .lead and
   resize them. Give the hero's intro paragraph class="lead". */

.page-head {
  max-width: 760px;
  padding: 80px 0 44px;
}

.page-head h1 {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-size: clamp(2.2rem, 4.6vw, 3.4rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  font-weight: 700;
  text-align: left;
}

.page-head p:not(.kicker):not(.eyebrow) {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.075rem;
  line-height: 1.65;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

/* ---------- Buttons & links ---------- */

/* .cta-btn is the same button, kept as its own class for projects.html markup. */
.btn,
.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 650;
  cursor: pointer;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    background-color 0.25s ease,
    border-color 0.25s ease;
}

.btn svg,
.cta-btn svg {
  transition: transform 0.25s ease;
}

.btn:hover svg,
.cta-btn:hover svg {
  transform: translateX(3px);
}

.btn-primary,
.cta-btn {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover,
.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 44, 60, 0.28);
}

.btn-ghost {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: var(--surface-2);
}

.btn:focus-visible,
.link-arrow:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  transition:
    color 0.25s ease,
    border-color 0.25s ease;
}

.link-arrow svg {
  transition: transform 0.25s ease;
}

.link-arrow:hover {
  color: var(--accent);
  border-color: var(--accent-line);
}

.link-arrow:hover svg {
  transform: translate(2px, -2px);
}

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

.section {
  padding-top: 112px;
  scroll-margin-top: 24px;
}

.section--tight {
  padding-top: 72px;
}

.section-head {
  max-width: 640px;
  margin-bottom: 40px;
}

.section-head h2 {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-size: clamp(1.9rem, 3.6vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 700;
}

/* :not(.kicker) matters — a bare `.section-head p` would out-rank .kicker
   and grey out the small accent label above the heading. */
.section-head p:not(.kicker) {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

/* ---------- Cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.cards--tight {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  transition:
    border-color 0.35s ease,
    background-color 0.35s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
}

/* style.css colours every h2-h6 red and pads it; cards want neither. */
.card h3 {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.65;
}

.card ul,
.card ol {
  margin: 0;
  padding-left: 1.15em;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 24px 24px 22px;
}

.card-foot {
  margin-top: auto;
  padding-top: 6px;
}

.chip {
  flex: none;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip--accent {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Keep the chip pill-sized inside a flex-column card body. */
.card-body .chip {
  align-self: flex-start;
}

/* A plain surface panel for content that isn't a card grid. */
.panel {
  padding: 28px 30px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

/* ---------- Art panel ----------
   Dark tile with a red glow and a faint grid, used behind logos and artwork. */

.art {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(
      80% 90% at 50% 0%,
      rgba(255, 44, 60, 0.14),
      transparent 70%
    ),
    #0d0d10;
}

/* ::after, not ::before, so a page that already draws its own .art::after
   overlay (projects.html) overrides this one instead of stacking a second
   grid on top of it. */
.art::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(70% 70% at 50% 45%, #000, transparent);
  mask-image: radial-gradient(70% 70% at 50% 45%, #000, transparent);
  pointer-events: none;
}

.art img {
  position: relative;
  z-index: 1;
  width: auto;
  height: auto;
  max-width: 46%;
  max-height: 54%;
  object-fit: contain;
  transition: transform 0.5s ease;
}

.card:hover .art img {
  transform: scale(1.05);
}

/* ---------- Forms ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.field > label,
.form-label {
  margin: 0;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
}

.field-hint {
  color: var(--faint);
  font-size: 0.8rem;
}

.input,
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"],
.field input[type="url"],
.field input[type="number"],
.field input[type="search"],
.field input[type="date"],
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0d0d10;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
  transition:
    border-color 0.25s ease,
    background-color 0.25s ease;
}

.input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: #5d5d66;
}

.input:hover,
.field input:hover,
.field textarea:hover,
.field select:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.input:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent-line);
  background: #111116;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field textarea {
  min-height: 140px;
  resize: vertical;
}

/* ---------- Closing CTA ---------- */

.cta {
  margin-top: 112px;
  padding: 56px 40px;
  border: 1px solid var(--border);
  border-radius: 18px;
  text-align: center;
  background:
    radial-gradient(
      70% 160% at 50% 0%,
      rgba(255, 44, 60, 0.13),
      transparent 70%
    ),
    var(--surface);
}

.cta h2 {
  margin: 0 0 12px;
  padding: 0;
  color: var(--text);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  letter-spacing: -0.025em;
}

.cta p {
  max-width: 540px;
  margin: 0 auto 30px;
  color: var(--muted);
  line-height: 1.65;
}

/* ---------- Reveal on scroll ----------
   Gated on html.js so content is never hidden when scripting or
   IntersectionObserver is unavailable. Add the class with:
     <script>document.documentElement.classList.add("js");</script> */

html.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

html.js .reveal.shown {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  main {
    padding: 0 16px 90px;
  }

  .hero {
    padding: 56px 0 40px;
  }

  .page-head {
    padding: 52px 0 32px;
  }

  .section {
    padding-top: 80px;
  }

  .panel {
    padding: 22px 20px;
  }

  .cta {
    margin-top: 80px;
    padding: 44px 22px;
  }
}

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

  html.js .reveal {
    opacity: 1;
    transform: none;
  }
}
