/* =========================================================
   NIGHTFALL TOOLS
   Nightfall Automotive — Nord Dark Theme
   ========================================================= */

/* ---------- Tokens & base ---------- */

:root {
  color-scheme: dark;
  --bg: #242933;
  --bg-deep: #20242d;
  --panel: #2e3440;
  --panel-light: #353d4c;
  --border: #434c5e;
  --text: #eceff4;
  --muted: #aab4c5;
  --dim: #7d899d;
  --cyan: #88c0d0;
  --blue: #81a1c1;
  --purple: #b48ead;
  --green: #a3be8c;
  --radius: 12px;
  --font: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-deep);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(136, 192, 208, 0.10), transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(163, 190, 140, 0.05), transparent 45%),
    var(--bg-deep);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

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

/* Hex-digit rain behind everything; kept faint so the page stays readable */
.matrix-rain {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.22;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
}

.page {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(1100px, calc(100% - 32px));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px 0 18px;
}

main {
  flex: 1;
}

/* ---------- Page header ---------- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 0 24px;
  margin-bottom: 28px;
  border-bottom: 1px solid rgba(136, 192, 208, 0.16);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.brand:hover {
  color: var(--text);
}

.brand-logo {
  display: block;
  width: auto;
  height: 36px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  letter-spacing: 0.15em;
}

.brand-copy strong {
  font-size: 15px;
  font-weight: 900;
}

.brand-copy > span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.3em;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.page-tag {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.18em;
}

.page-tag strong {
  margin-left: 8px;
  color: var(--purple);
  font-size: 20px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  transition: border-color 120ms ease, color 120ms ease;
}

.back-link:hover {
  border-color: var(--cyan);
  color: var(--text);
}

.back-link span {
  transition: transform 120ms ease;
}

.back-link:hover span {
  transform: translateX(-3px);
}

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

.hero {
  padding: 28px 0 36px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

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

.intro {
  max-width: 560px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 15px;
}

/* ---------- Tool cards ---------- */

.tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tool {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(53, 61, 76, 0.9), rgba(46, 52, 64, 0.88) 120px);
  box-shadow: var(--shadow);
  color: var(--text);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

/* A line in the tool's colour along the top */
.tool::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--accent);
  opacity: 0.85;
}

.tool:hover,
.tool:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 28px -8px var(--accent);
  color: var(--text);
}

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

.tool-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.tool-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--purple);
  color: var(--bg-deep);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.25em;
}

.tool-name {
  margin-top: 6px;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.tool-text {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
}

.tool-link {
  margin-top: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.tool-link span {
  display: inline-block;
  transition: transform 160ms ease;
}

.tool:hover .tool-link span {
  transform: translateX(4px);
}

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

.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 36px 2px 0;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.12em;
}

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

@media (max-width: 640px) {
  .page-tag,
  .back-link .back-text {
    display: none;
  }

  .back-link {
    padding: 7px 11px;
  }

  .back-link span[aria-hidden] {
    font-size: 16px;
    line-height: 1;
  }

  .tools {
    grid-template-columns: 1fr;
  }

  .page-footer {
    flex-direction: column;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tool,
  .tool-link span,
  .back-link span {
    transition: none;
  }
}
