/* Ophethe — site styles
   Brand palette comes from brand/tokens.css (the --ophethe-* variables).
   Page CSS never hardcodes brand hex; it maps semantic theme variables to
   the palette, defined twice so the manual data-theme toggle controls
   everything (independent of prefers-color-scheme). */

@import url("../../brand/tokens.css");

/* tokens.css switches four --ophethe-* vars by prefers-color-scheme.
   We pin all four per data-theme so the manual toggle is authoritative.
   These are the brand's documented supporting shades (the only non-palette
   colours), kept here as the single source of truth. */
:root[data-theme="light"] {
  /* Documented brand supporting shades, darkened where AA on the light
     background required it (muted text, accent used as small text). */
  --ophethe-text: #2A2550;
  --ophethe-text-muted: #67628C; /* AA on cloud/white (5.2:1) */
  --ophethe-border: #E6E2F2;
  --ophethe-gradient: linear-gradient(135deg, var(--ophethe-grad-light-a) 0%, var(--ophethe-grad-light-b) 100%);

  /* Semantic theme variables -> palette */
  --bg: var(--ophethe-cloud);
  --surface: var(--ophethe-white);
  --surface-raised: #FFFFFF;
  --text: var(--ophethe-indigo-2);
  --text-muted: var(--ophethe-text-muted);
  --heading: var(--ophethe-indigo-2);
  --border: var(--ophethe-border);
  --accent: var(--ophethe-grad-light-a); /* decorative: underlines, focus, borders */
  --accent-text: #6A5AC9; /* deeper lavender, AA for small accent text (4.8:1) */
  --accent-soft: var(--ophethe-lavender);
  --gradient: var(--ophethe-gradient);
  --on-accent: var(--ophethe-indigo);
  --focus: var(--ophethe-grad-light-a);
  --shadow: 0 1px 2px rgba(21, 26, 46, 0.06), 0 8px 24px rgba(21, 26, 46, 0.08);
  --shadow-hover: 0 2px 4px rgba(21, 26, 46, 0.08), 0 16px 40px rgba(21, 26, 46, 0.14);

  /* Pastel card tints (light) */
  --tint-lavender: rgba(199, 190, 247, 0.30);
  --tint-mint: rgba(159, 230, 207, 0.32);
  --tint-sky: rgba(170, 215, 245, 0.32);
  --tint-peach: rgba(246, 201, 169, 0.32);
}

:root[data-theme="dark"] {
  --ophethe-text: #F4F2FC;
  --ophethe-text-muted: #9C97C8;
  --ophethe-border: #2A3052;
  --ophethe-gradient: linear-gradient(135deg, var(--ophethe-grad-dark-a) 0%, var(--ophethe-grad-dark-b) 100%);

  --bg: var(--ophethe-indigo);
  --surface: var(--ophethe-indigo-2);
  --surface-raised: #312B5C;
  --text: var(--ophethe-white);
  --text-muted: var(--ophethe-text-muted);
  --heading: var(--ophethe-white);
  --border: var(--ophethe-border);
  --accent: var(--ophethe-lavender);
  --accent-text: var(--ophethe-lavender); /* lavender already AA on indigo */
  --accent-soft: var(--ophethe-lavender);
  --gradient: var(--ophethe-gradient);
  --on-accent: var(--ophethe-indigo);
  --focus: var(--ophethe-lavender);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.30), 0 10px 30px rgba(0, 0, 0, 0.36);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.36), 0 18px 46px rgba(0, 0, 0, 0.5);

  /* Pastel card tints (dark) — lower alpha so text stays readable */
  --tint-lavender: rgba(199, 190, 247, 0.14);
  --tint-mint: rgba(159, 230, 207, 0.14);
  --tint-sky: rgba(170, 215, 245, 0.14);
  --tint-peach: rgba(246, 201, 169, 0.14);
}

/* Fallback if JS/inline script never ran: assume light. */
:root:not([data-theme]) {
  color-scheme: light;
}

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

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

html {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", sans-serif;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4 {
  color: var(--heading);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  font-weight: 600;
}

h1 {
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  letter-spacing: -0.03em;
}
h2 {
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
}
h3 {
  font-size: 1.18rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--text);
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-color: var(--text);
}

img,
svg {
  max-width: 100%;
}

ul {
  margin: 0;
  padding: 0;
}

/* Visible focus everywhere */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Layout helpers ---------- */

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2.5rem);
}

.section {
  padding-block: clamp(3rem, 8vw, 6rem);
}

.section--tight {
  padding-block: clamp(2.5rem, 6vw, 4rem);
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent-text);
  margin: 0 0 0.75rem;
}

.lede {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--text-muted);
  max-width: 60ch;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--surface-raised);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 600;
  line-height: 1;
  padding: 0.8rem 1.3rem;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease, color 0.2s ease;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background: var(--gradient);
  color: var(--on-accent);
  box-shadow: var(--shadow);
}
.btn--primary:hover {
  box-shadow: var(--shadow-hover);
  text-decoration: none;
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover {
  border-color: var(--accent);
  text-decoration: none;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: clamp(76px, 9vw, 100px);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border-radius: 8px;
}
.brand-link__logo {
  height: clamp(56px, 7vw, 80px);
  width: auto;
  display: block;
}
/* Logo swaps with theme, not media query */
:root[data-theme="light"] .logo--dark,
:root[data-theme="dark"] .logo--light {
  display: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}
.nav__link {
  display: inline-block;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
}
.nav__link:hover {
  background: var(--surface);
}
.nav__link[aria-current="page"] {
  color: var(--accent-text);
}

/* Icon buttons (theme toggle + hamburger) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.icon-btn:hover {
  border-color: var(--accent);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Sun/moon visibility by theme */
:root[data-theme="light"] .icon-moon,
:root[data-theme="dark"] .icon-sun {
  display: none;
}

.nav-toggle {
  display: none;
}

/* Mobile nav */
@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
  }
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 1rem clamp(1.1rem, 4vw, 2.5rem) 1.4rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  }
  .nav[data-open="true"] {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
  }
  .nav__link {
    padding: 0.7rem 0.8rem;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.hero {
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
      60% 60% at 15% 0%,
      var(--tint-lavender),
      transparent 70%
    ),
    radial-gradient(50% 50% at 95% 20%, var(--tint-mint), transparent 70%);
  pointer-events: none;
}
.hero__inner {
  position: relative;
  padding-block: clamp(3.5rem, 11vw, 7.5rem);
  max-width: 46rem;
}
.hero__mark {
  width: clamp(88px, 15vw, 124px);
  height: auto;
  display: block;
  margin: 0 auto 1.6rem;
}
.hero h1 {
  margin-bottom: 0.6rem;
}
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__tagline {
  font-size: clamp(1.3rem, 3.5vw, 2rem);
  font-weight: 600;
  margin: 0 0 1.1rem;
}
.hero__statement {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  color: var(--text-muted);
  max-width: 52ch;
  margin-bottom: 2rem;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

/* ---------- Section heading block ---------- */
.section-head {
  max-width: 44rem;
  margin-bottom: clamp(1.6rem, 4vw, 2.6rem);
}

/* ---------- Grids ---------- */
.grid {
  display: grid;
  gap: 1.1rem;
}
.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}
.grid--cards {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
}
/* Fixed 2-up grid (e.g. home featured work -> 2x2), single column on small screens */
.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 560px) {
  .grid--2 {
    grid-template-columns: 1fr;
  }
}

/* ---------- What we do cards ---------- */
.feature {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.6rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.feature__icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  margin-bottom: 1rem;
  color: var(--ophethe-indigo);
}
.feature--apps .feature__icon {
  background: var(--ophethe-lavender);
}
.feature--games .feature__icon {
  background: var(--ophethe-peach);
}
.feature--tools .feature__icon {
  background: var(--ophethe-sky);
}
.feature__icon svg {
  width: 24px;
  height: 24px;
}
.feature h3 {
  margin-bottom: 0.4rem;
}
.feature p {
  margin: 0;
  color: var(--text-muted);
}

/* ---------- Support: per-app help cards (built on .feature) ---------- */
.app-help__logo {
  width: 56px;
  height: 56px;
  display: block;
  margin-bottom: 1rem;
}
.app-help__logo--tile {
  border-radius: 22%;
  box-shadow: 0 4px 12px rgba(21, 26, 46, 0.22),
    0 0 0 1px rgba(244, 242, 252, 0.09);
}
.link-list {
  list-style: none;
  display: grid;
  gap: 0.4rem;
  margin-top: 1rem;
}
.link-list a {
  font-weight: 600;
}
.link-list a[target="_blank"]::after {
  content: " ↗";
  color: var(--accent);
}

/* ---------- Product cards ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.card__thumb {
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  position: relative;
  border-bottom: 1px solid var(--border);
}
/* Real screenshots: add class card__thumb-img to fill the thumb. */
.card__thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Playful thumbs for games */
.card--game-1 .card__thumb {
  background: linear-gradient(135deg, var(--tint-peach), var(--tint-lavender));
}
.card--game-2 .card__thumb {
  background: linear-gradient(135deg, var(--tint-sky), var(--tint-mint));
}
/* Restrained thumbs for dev tools: indigo base with a single lavender accent
   (a centred glow that lifts each product's dark app icon) */
.card--tool .card__thumb {
  background: var(--ophethe-indigo);
  background-image: radial-gradient(
    62% 70% at 50% 46%,
    rgba(199, 190, 247, 0.2),
    transparent 70%
  );
}

.card__body {
  padding: 1.3rem 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card__name {
  margin: 0 0 0.3rem;
  font-size: 1.25rem;
}
.card__desc {
  color: var(--text-muted);
  margin: 0 0 1rem;
  flex: 1;
}
.card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.endorse {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.card--tool .endorse {
  color: var(--accent-text);
}

.card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}
.card__link::after {
  content: "↗";
  font-size: 0.9em;
  color: var(--accent);
}
.card__link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Pill tag — align-self keeps it hugging its text inside the flex column body */
.tag {
  align-self: flex-start;
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.25rem 0.7rem;
  margin-bottom: 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg);
}

/* Product logo (app icon) centred in the thumb */
.card__thumb-logo {
  width: clamp(88px, 34%, 116px);
  height: auto;
  aspect-ratio: 1;
  display: block;
}
.card__thumb-logo--tile {
  border-radius: 22%;
  /* soft drop shadow + faint light ring so dark app icons read on dark thumbs */
  box-shadow: 0 10px 26px rgba(21, 26, 46, 0.3),
    0 0 0 1px rgba(244, 242, 252, 0.09);
}

/* ---------- Featured work strip ---------- */
.strip-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}

/* ---------- CTA band ---------- */
.cta {
  position: relative;
  border-radius: 22px;
  padding: clamp(2rem, 6vw, 3.5rem);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text);
  overflow: hidden;
}
.cta h2 {
  color: var(--heading);
  margin-bottom: 0.5rem;
}
.cta p {
  color: var(--text-muted);
  max-width: 48ch;
  margin-bottom: 1.5rem;
}

/* ---------- Prose (about, privacy, support) ---------- */
.prose {
  max-width: 65ch;
}
.prose h2 {
  margin-top: 2.4rem;
}
.prose h3 {
  margin-top: 1.8rem;
}
.prose > :first-child {
  margin-top: 0;
}
.prose p {
  color: var(--text);
}

/* Plain bulleted list for policy and support copy */
.bullets {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}
.bullets li {
  margin-bottom: 0.45rem;
  padding-left: 0.2rem;
}
.bullets li::marker {
  color: var(--accent);
}

/* Linked sections (e.g. privacy.html#nubrixy) clear the sticky header */
[id] {
  scroll-margin-top: 7.5rem;
}

.value-list {
  list-style: none;
  display: grid;
  gap: 1rem;
  margin-top: 1.4rem;
}
.value-list li {
  position: relative;
  padding-left: 1.8rem;
  color: var(--text-muted);
}
.value-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
  background: var(--gradient);
}
.value-list strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Work page groups ---------- */
.group + .group {
  margin-top: clamp(2.5rem, 6vw, 4rem);
}
.group__head {
  margin-bottom: 1.4rem;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.site-footer__inner {
  display: grid;
  gap: 1.6rem;
  padding-block: clamp(2.2rem, 5vw, 3.2rem);
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.footer-brand img {
  width: 34px;
  height: 34px;
}
.footer-brand__name {
  font-weight: 600;
  font-size: 1.05rem;
}
.footer-blurb {
  color: var(--text-muted);
  max-width: 42ch;
  margin: 0;
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}
.footer-row a {
  color: var(--text);
  font-weight: 500;
}
.footer-nav {
  display: flex;
  gap: 1rem;
  list-style: none;
  flex-wrap: wrap;
}

@media (min-width: 720px) {
  .site-footer__inner {
    grid-template-columns: 1.3fr 1fr;
    align-items: start;
  }
  .footer-row {
    grid-column: 1 / -1;
  }
}
