/* ==========================================================================
   Nilbyte Studio — studio site
   --------------------------------------------------------------------------
   The marketing page at "/". Loaded after base.css, which supplies the colour
   system, spacing and shape scales, the reset and the layout primitives.

   Only what is specific to this page lives here: its fluid type scale, its
   typographic reset (no list bullets, measured paragraphs) and its components.

   Conventions
     - BEM-ish naming: .block, .block__element, .block--modifier
     - Mobile-first: base rules are the small-screen layout; media queries add
     - Colours are never hard-coded outside a token block, so the dark theme
       is a single override rather than a parallel stylesheet
   ========================================================================== */


/* ==========================================================================
   1. Tokens specific to this page
   --------------------------------------------------------------------------
   Palette, spacing, radius and motion come from base.css. What differs here
   is the type scale — fluid clamp() values sized for a marketing page — plus
   the two layout constants only this page has.
   ========================================================================== */

:root {
  /* Fluid type: clamp() removes the need for per-breakpoint font sizes. */
  --step--1: clamp(0.82rem, 0.80rem + 0.10vw, 0.88rem);
  --step-0:  clamp(1.00rem, 0.97rem + 0.14vw, 1.08rem);
  --step-1:  clamp(1.15rem, 1.08rem + 0.34vw, 1.35rem);
  --step-2:  clamp(1.45rem, 1.30rem + 0.75vw, 1.95rem);
  --step-3:  clamp(1.85rem, 1.55rem + 1.50vw, 2.75rem);
  --step-4:  clamp(2.35rem, 1.70rem + 3.20vw, 4.25rem);

  --leading-tight: 1.12;
  --tracking-tight: -0.022em;
  --tracking-wide:  0.18em;

  /* Section rhythm scales with the viewport so mobile is not over-padded. */
  --section-y: clamp(3.5rem, 2rem + 7vw, 7rem);

  --header-h: 68px;
}


/* ==========================================================================
   2. Typography for this page
   --------------------------------------------------------------------------
   base.css already zeroes heading margins, sets their colour and balances
   their wrapping. Weight, leading and tracking are decided here because the
   support pages want a different feel.
   ========================================================================== */

html {
  /* Anchors would otherwise land under the sticky header. */
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

p { margin: 0 0 var(--space-4); max-width: 62ch; }
p:last-child { margin-bottom: 0; }

/* This page has no prose lists — every list is a layout container. */
ul, ol, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--text-strong); }

.sprite { position: absolute; }


/* ==========================================================================
   3. Section scaffolding
   --------------------------------------------------------------------------
   .wrap and .skip-link come from base.css.
   ========================================================================== */

.section { padding-block: var(--section-y); }

.section--tint {
  background: var(--bg-tint);
  border-block: 1px solid var(--border);
}

.section__head { margin-bottom: var(--space-7); }
.section__title { font-size: var(--step-3); margin-bottom: var(--space-3); }
.section__lede { color: var(--text-muted); font-size: var(--step-1); max-width: 52ch; }

/* Small uppercase mono label used above every section title. */
.eyebrow {
  margin: 0 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}


/* ==========================================================================
   4. Components
   ========================================================================== */

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  /* Progressive enhancement: browsers without backdrop-filter just get the
     translucent background above, which is still readable. */
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}

/* .is-stuck is added by main.js once the page scrolls. */
.site-header.is-stuck {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--header-h);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

/* --- Logo ----------------------------------------------------------------- */

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-strong);
  text-decoration: none;
}

.logo__mark { width: 30px; height: 30px; flex: none; }

.logo__text { display: flex; align-items: baseline; gap: 0.45rem; }

.logo__name {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

/* Letterspaced caps descriptor, per the brand sheet lockup. */
.logo__descriptor {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* --- Navigation ------------------------------------------------------------
   Mobile: the nav is a fixed panel that slides in and is hidden from the
   accessibility tree via `visibility` when closed (display:none would break
   the transition). Desktop: a plain inline row. */

.nav {
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  padding: var(--space-4) var(--wrap-pad) var(--space-6);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateY(-12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              visibility var(--dur-fast) var(--ease);
}

.nav.is-open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.nav__list { display: flex; flex-direction: column; gap: var(--space-1); }

.nav__link {
  display: block;
  padding: var(--space-3) var(--space-2);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.nav__link:hover { color: var(--text-strong); background: var(--accent-soft); }

/* .is-active is maintained by the scroll-spy in main.js. */
.nav__link.is-active { color: var(--accent-strong); }

/* --- Icon buttons (theme toggle + hamburger) ------------------------------ */

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.icon-button:hover { background: var(--accent-soft); border-color: var(--border-strong); }

.icon {
  grid-area: 1 / 1;      /* stack sun + moon so the swap needs no reflow */
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

/* Show the icon for the theme you would switch *to*. */
.icon--moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .icon--sun  { display: none; }
  :root:not([data-theme='light']) .icon--moon { display: block; }
}
:root[data-theme='dark']  .icon--sun  { display: none; }
:root[data-theme='dark']  .icon--moon { display: block; }
:root[data-theme='light'] .icon--sun  { display: block; }
:root[data-theme='light'] .icon--moon { display: none; }

/* Hamburger drawn from one element plus two pseudo-elements. */
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform var(--dur-fast) var(--ease),
              opacity var(--dur-fast) var(--ease);
}
.nav-toggle__bars::before,
.nav-toggle__bars::after { content: ''; position: absolute; }
.nav-toggle__bars::before { transform: translateY(-6px); }
.nav-toggle__bars::after  { transform: translateY(6px); }

.nav-toggle[aria-expanded='true'] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded='true'] .nav-toggle__bars::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded='true'] .nav-toggle__bars::after  { transform: rotate(-45deg); }

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.8rem 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-weight: 550;
  font-size: var(--step-0);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.button:active { transform: translateY(1px); }

.button--primary {
  background: var(--brand-ink);
  color: #FFFFFF;
}
.button--primary:hover { background: var(--accent-strong); color: #FFFFFF; }

:root[data-theme='dark'] .button--primary { background: var(--brand-aqua); color: var(--brand-ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .button--primary { background: var(--brand-aqua); color: var(--brand-ink); }
  :root:not([data-theme='light']) .button--primary:hover { background: #8CEAE4; color: var(--brand-ink); }
}
:root[data-theme='dark'] .button--primary:hover { background: #8CEAE4; color: var(--brand-ink); }

.button--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-strong);
}
.button--ghost:hover { border-color: var(--accent); color: var(--accent-strong); }

.button--block { width: 100%; }

/* Text link with a nudging arrow. The arrow is generated, not typed, so it
   never ends up in copied text or a screen reader announcement. */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 550;
  font-size: var(--step--1);
  text-decoration: none;
  color: var(--accent-strong);
}
.link-arrow::after {
  content: '\2192';
  transition: transform var(--dur-fast) var(--ease);
}
.link-arrow:hover::after { transform: translateX(3px); }
.link-arrow--lg { font-size: var(--step-0); margin-top: var(--space-2); }

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

.hero {
  position: relative;
  padding-block: clamp(3rem, 1.5rem + 8vw, 7rem) var(--section-y);
  overflow: hidden;
}

/* Soft accent wash behind the hero — one gradient, no images. */
.hero::before {
  content: '';
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 70%;
  background: radial-gradient(60% 60% at 30% 40%, var(--accent-soft), transparent 70%);
  pointer-events: none;
}

.hero__inner { position: relative; display: grid; gap: var(--space-8); }

.hero__title {
  font-size: var(--step-4);
  font-weight: 650;
  margin-bottom: var(--space-5);
}

/* Brand gradient on a single word. Falls back to the accent colour where
   background-clip:text is unsupported. */
.text-gradient {
  color: var(--accent-strong);
  background: linear-gradient(100deg, var(--brand-signal), var(--brand-aqua));
  -webkit-background-clip: text;
  background-clip: text;
}
@supports (-webkit-background-clip: text) or (background-clip: text) {
  .text-gradient { color: transparent; }
}

.hero__lede {
  font-size: var(--step-1);
  color: var(--text-muted);
  max-width: 50ch;
  margin-bottom: var(--space-6);
}

.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}
.stats__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stats__value {
  margin: var(--space-1) 0 0;
  font-size: var(--step-2);
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: var(--tracking-tight);
}

/* Dark brand panel holding the mark. Always ink-on-dark in both themes —
   the reversed lockup is the brand-approved treatment here. */
.hero__panel {
  display: grid;
  place-items: center;
  gap: var(--space-5);
  padding: clamp(2rem, 1rem + 5vw, 3.5rem);
  background: linear-gradient(150deg, #16283A, #0B1622);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.hero__mark { width: clamp(110px, 26vw, 170px); height: auto; }

.hero__panel-caption {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--text-on-inverse-muted);
  text-align: center;
}

/* The eight bits fade in one after another on load — a small nod to the
   logo's story. Disabled entirely under prefers-reduced-motion (see §5). */
.hero__bits { animation: bits-in 900ms var(--ease) both; }

@keyframes bits-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

.card-grid {
  display: grid;
  gap: var(--space-5);
  /* auto-fit + minmax gives 1/2/3 columns with no breakpoints. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

/* For a small number of content-rich cards. The larger minimum stops a third
   column forming, so two detailed cards sit side by side and read as
   deliberate rather than as a half-empty three-column grid. */
.card-grid--wide {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.card__body { flex: 1; padding: var(--space-5); }

.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.card__platform {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.card__title { font-size: var(--step-1); margin-bottom: var(--space-3); }
.card__link { color: inherit; text-decoration: none; }
.card__link:hover { color: var(--accent-strong); }

.card__text { color: var(--text-muted); font-size: var(--step--1); margin-bottom: var(--space-4); }

/* Feature bullets inside a project card. The marker is a small brand-coloured
   square rather than a disc — it echoes the eight bits in the logo. */
.feature-list {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.feature-list__item {
  position: relative;
  padding-left: var(--space-4);
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--text-muted);
}
.feature-list__item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 1.2px;
  background: var(--accent);
}

/* Plain status text in a card footer, for an app with no links yet. */
.card__status {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--bg-tint);
}

/* --- Badges & tags -------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}
.badge--live { color: var(--accent-strong); background: var(--accent-soft); }
.badge--beta { color: var(--text-muted); }
.badge--wip  { color: var(--text-muted); border-style: dashed; }

.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.tag {
  padding: 0.22rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}

.tags--lg .tag {
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  background: var(--bg-raised);
}

/* --- About ---------------------------------------------------------------- */

.about { display: grid; gap: var(--space-8); }
.about__copy p { color: var(--text-muted); }

.principles { display: grid; gap: var(--space-4); }

.principle {
  padding: var(--space-5);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
/* Small accent rule instead of an icon — cheaper and stays on-brand. */
.principle__title {
  position: relative;
  padding-left: var(--space-4);
  font-size: var(--step-0);
  margin-bottom: var(--space-2);
}
.principle__title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.35em;
  width: 4px;
  height: 0.9em;
  border-radius: 2px;
  background: var(--accent);
}
.principle__text { margin: 0; font-size: var(--step--1); color: var(--text-muted); }

/* --- Stack ---------------------------------------------------------------- */

.stack {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

.stack__title {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
  font-size: var(--step-0);
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* --- Contact & form ------------------------------------------------------- */

.contact { display: grid; gap: var(--space-8); }
.contact__intro p { color: var(--text-muted); }

.contact__links { margin-top: var(--space-5); display: grid; gap: var(--space-4); }

.contact__email {
  font-size: var(--step-2);
  font-weight: 600;
  color: var(--text-strong);
  text-decoration: none;
  letter-spacing: var(--tracking-tight);
  /* Underline only on hover keeps the big address feeling like a headline. */
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size var(--dur-slow) var(--ease);
}
.contact__email:hover { background-size: 100% 2px; }

.contact__socials { display: flex; flex-wrap: wrap; gap: var(--space-5); }

.form {
  padding: var(--space-6);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.form__row { margin-bottom: var(--space-4); }

.form__label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--step--1);
  font-weight: 550;
  color: var(--text-strong);
}

.form__input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.form__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
.form__input--textarea { resize: vertical; min-height: 7rem; }

/* Error state is driven by aria-invalid, so the visual and the accessible
   state can never drift apart. */
.form__input[aria-invalid='true'] { border-color: #C0392B; }
.form__error {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--step--1);
  color: #C0392B;
}
:root[data-theme='dark'] .form__error { color: #FF8A7A; }

.form__honeypot {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.form__status { margin: var(--space-4) 0 0; font-size: var(--step--1); min-height: 1.4em; }
.form__status.is-success { color: var(--accent-strong); }
.form__status.is-error   { color: #C0392B; }

.form__note { margin: var(--space-3) 0 0; font-size: 0.75rem; color: var(--text-muted); }

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

.site-footer {
  padding-block: var(--space-7);
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.site-footer__inner { display: grid; gap: var(--space-5); }

.site-footer__brand { display: flex; align-items: center; gap: var(--space-3); }
.site-footer__mark { width: 26px; height: 26px; color: var(--text-strong); flex: none; }
.site-footer__tagline { margin: 0; font-size: var(--step--1); color: var(--text-muted); }

.site-footer__list { display: flex; flex-wrap: wrap; gap: var(--space-5); }
.site-footer__list a {
  color: var(--text-muted);
  font-size: var(--step--1);
  text-decoration: none;
}
.site-footer__list a:hover { color: var(--text-strong); }

.site-footer__legal { margin: 0; font-size: 0.78rem; color: var(--text-muted); }


/* ==========================================================================
   5. Responsive escalation & motion
   ========================================================================== */

/* --- md: ~720px — two-column content blocks ------------------------------- */
@media (min-width: 45em) {
  .about        { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .principles   { grid-template-columns: 1fr 1fr; }
  .contact      { grid-template-columns: 1fr 1fr; align-items: start; }
  .site-footer__inner {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--space-6);
  }
  .site-footer__nav { justify-self: center; }
}

/* --- lg: ~62em — desktop nav, side-by-side hero --------------------------- */
@media (min-width: 62em) {
  .hero__inner {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    gap: var(--space-9);
  }

  /* The nav becomes a plain inline row; all of the mobile panel styling is
     unwound here rather than being scoped to a `.is-open` class. */
  .nav {
    position: static;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    transform: none;
    opacity: 1;
    visibility: visible;
    margin-left: var(--space-6);
  }
  .nav__list { flex-direction: row; gap: var(--space-2); }
  .nav__link { padding: var(--space-2) var(--space-3); font-size: var(--step--1); }

  /* The hamburger is irrelevant here; `!important` beats the JS `hidden`
     attribute being removed on load. */
  .nav-toggle { display: none !important; }
}

/* --- Reduced motion -------------------------------------------------------
   The global rule lives in base.css; this is the one page-specific addition. */
@media (prefers-reduced-motion: reduce) {
  .card:hover { transform: none; }
}

/* --- Print ---------------------------------------------------------------- */
@media print {
  .site-header,
  .hero__visual,
  .form,
  .skip-link { display: none; }

  body { background: #FFFFFF; color: #000000; }
  .section { padding-block: 1.5rem; }
}
