/* ==========================================================================
   Cyberry web-kit — shared design system for tool pages
   CI tokens sampled from cyberry.xyz. Light and dark are both first-class.
   Project-specific styles belong in the project's own assets/css, not here.
   ========================================================================== */

/* --- Fonts ---------------------------------------------------------------- */

@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/assets/fonts/poppins-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/poppins-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/poppins-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/poppins-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/montserrat-var.woff2') format('woff2-variations');
}

/* --- Tokens ---------------------------------------------------------------
   Brand hues are constant across themes; surfaces and ink swap.
   --------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  --purple: #8248e5;
  --purple-deep: #673ab7;
  --purple-soft: rgba(130, 72, 229, 0.1);
  --purple-grad: linear-gradient(135deg, #8248e5 0%, #673ab7 100%);
  --plum: #583469;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f6fb;
  --ink: #212121;
  --ink-strong: #000000;
  --muted: #6e798f;
  --line: #e8e6f0;

  --ok: #0d9b6a;
  --ok-soft: rgba(13, 155, 106, 0.1);
  --warn: #c2410c;
  --err: #dc2626;
  --err-soft: rgba(220, 38, 38, 0.08);

  --shadow-sm: 0 1px 3px rgba(17, 12, 34, 0.05);
  --shadow-lg: 0 16px 44px rgba(130, 72, 229, 0.13);

  --shell: 1080px;
  --radius: 12px;
  --radius-sm: 6px;
}

/* Explicit dark, and system-dark unless the user forced light. */
:root[data-theme='dark'],
:root[data-theme='dark'] * {
  scrollbar-color: #3a3350 #171326;
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --purple: #a077f0;
  --purple-deep: #8248e5;
  --purple-soft: rgba(160, 119, 240, 0.14);
  --purple-grad: linear-gradient(135deg, #8248e5 0%, #6d3fc0 100%);

  --bg: #0b0718;
  --surface: #141024;
  --surface-2: #1a1530;
  --ink: #e9e6f2;
  --ink-strong: #ffffff;
  --muted: #9d97b5;
  --line: #2a2340;

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --err: #f87171;
  --err-soft: rgba(248, 113, 113, 0.12);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;

    --purple: #a077f0;
    --purple-deep: #8248e5;
    --purple-soft: rgba(160, 119, 240, 0.14);
    --purple-grad: linear-gradient(135deg, #8248e5 0%, #6d3fc0 100%);

    --bg: #0b0718;
    --surface: #141024;
    --surface-2: #1a1530;
    --ink: #e9e6f2;
    --ink-strong: #ffffff;
    --muted: #9d97b5;
    --line: #2a2340;

    --ok: #34d399;
    --ok-soft: rgba(52, 211, 153, 0.12);
    --err: #f87171;
    --err-soft: rgba(248, 113, 113, 0.12);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.5);
  }
}

/* --- Reset ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s ease, color 0.2s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

:where(a, button, select, input, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  background: var(--purple);
  color: #fff;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

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

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

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

main {
  flex: 1;
}

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

.section--soft {
  background: var(--surface-2);
  border-block: 1px solid var(--line);
}

/* --- Typography ----------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.03em;
  color: var(--ink-strong);
}

.t-page {
  font-size: clamp(1.9rem, 4.2vw, 2.75rem);
}

.t-section {
  font-size: clamp(1.5rem, 2.8vw, 2rem);
}

.lead {
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  font-weight: 300;
  color: var(--muted);
}

.eyebrow {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--purple);
}

.accent {
  color: var(--purple);
}

/* --- Header ---------------------------------------------------------------
   A tool's mark is its name, per house style. No Cyberry logo up here.
   --------------------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(140%) blur(8px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  padding-block: 0.75rem;
}

.wordmark {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink-strong);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* The mark: a purple dot with a slow halo pulsing out of it. The halo is a
   pseudo-element so it can scale past the dot without affecting layout. */
.wordmark .dot {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--purple-grad);
  flex: 0 0 auto;
  animation: dot-breathe 2.8s ease-in-out infinite;
}

.wordmark .dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--purple);
  animation: dot-halo 2.8s ease-out infinite;
  pointer-events: none;
}

@keyframes dot-halo {
  0%   { transform: scale(1);   opacity: 0.5; }
  70%  { transform: scale(2.9); opacity: 0; }
  100% { transform: scale(2.9); opacity: 0; }
}

@keyframes dot-breathe {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--purple) 45%, transparent); }
  50%      { box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 12%, transparent); }
}

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

.header-link {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
}

.header-link:hover {
  color: var(--ink-strong);
}

/* --- Theme toggle ---------------------------------------------------------- */

.theme-toggle {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}

.theme-toggle:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* Show sun in dark mode, moon in light. */
.theme-toggle .icon-sun { display: none; }
:root[data-theme='dark'] .theme-toggle .icon-sun { display: block; }
:root[data-theme='dark'] .theme-toggle .icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme='light']) .theme-toggle .icon-moon { display: none; }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  padding: 0.85rem 1.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn--primary {
  background: var(--purple-grad);
  color: #fff;
  box-shadow: 0 6px 20px rgba(130, 72, 229, 0.26);
}

.btn--primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(130, 72, 229, 0.34);
}

.btn--primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn--ghost {
  background: transparent;
  color: var(--purple);
  border-color: color-mix(in srgb, var(--purple) 35%, transparent);
}

.btn--ghost:hover {
  background: var(--purple-soft);
}

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

/* --- Panels and cards ------------------------------------------------------ */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  box-shadow: var(--shadow-sm);
}

.panel + .panel {
  margin-top: 1rem;
}

.panel h2,
.panel h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

/* --- Form controls --------------------------------------------------------- */

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.6rem;
}

.field + .field {
  border-top: 1px solid var(--line);
}

.field label {
  font-size: 0.9rem;
  color: var(--muted);
}

select,
input[type='number'],
input[type='email'],
input[type='text'] {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  min-height: 40px;
}

select:hover,
input:hover {
  border-color: color-mix(in srgb, var(--purple) 45%, var(--line));
}

select {
  cursor: pointer;
  min-width: 170px;
}

input[type='number'] {
  width: 96px;
}

/* --- Status messages ------------------------------------------------------- */

.status {
  margin-top: 1rem;
  font-size: 0.9rem;
  text-align: center;
  min-height: 1.4em;
}

.status.error { color: var(--err); }
.status.success { color: var(--ok); }
.status.loading { color: var(--muted); }

/* --- Prose (the SEO content under the tool) -------------------------------- */

.prose {
  max-width: 68ch;
  margin-inline: auto;
}

.prose h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  margin-bottom: 0.85rem;
}

/* Legal pages are a long run of h2 sections — give them breathing room. */
.prose h2 ~ h2 {
  margin-top: 2rem;
}

.prose h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.4rem;
}

.prose p {
  color: var(--muted);
  font-weight: 300;
}

.prose p + p {
  margin-top: 0.85rem;
}

.prose a {
  color: var(--purple);
}

.prose ul {
  margin-top: 0.75rem;
  padding-left: 1.1rem;
  color: var(--muted);
  font-weight: 300;
}

.prose li + li {
  margin-top: 0.35rem;
}

/* --- FAQ ------------------------------------------------------------------- */

.faq {
  max-width: 68ch;
  margin-inline: auto;
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 1.1rem 2.25rem 1.1rem 0;
  position: relative;
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink-strong);
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: '';
  position: absolute;
  right: 0.35rem;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--purple);
  border-bottom: 2px solid var(--purple);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s ease;
}

.faq details[open] summary::after {
  transform: translateY(-30%) rotate(-135deg);
}

.faq details p {
  padding-bottom: 1.1rem;
  font-size: 0.9375rem;
  font-weight: 300;
  color: var(--muted);
}

/* --- Ad slot ---------------------------------------------------------------
   Reserved, labelled, and centred. Height is held so late-loading ads do not
   shift the page. Renders nothing visible until an ad actually fills it.
   --------------------------------------------------------------------------- */

.ad-slot {
  margin-block: clamp(2rem, 4vw, 3rem);
  text-align: center;
}

.ad-slot-label {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

.ad-slot-frame {
  min-height: 100px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.ad-slot-frame ins {
  display: block;
  width: 100%;
}

.ad-placeholder {
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0.7;
  padding: 1.5rem;
}

/* --- Newsletter ------------------------------------------------------------ */

.newsletter {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 3vw, 2rem);
  max-width: 620px;
}

.newsletter h2 {
  font-size: 1.15rem;
  margin-bottom: 0.4rem;
}

.newsletter p {
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--muted);
}

.newsletter-form {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
}

.newsletter-form input[type='email'] {
  flex: 1 1 240px;
  min-height: 46px;
}

.newsletter-consent {
  margin-top: 0.85rem;
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.5;
}

.newsletter-consent a {
  color: var(--purple);
}

.newsletter-msg {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  min-height: 1.3em;
}

.newsletter-msg.ok { color: var(--ok); }
.newsletter-msg.err { color: var(--err); }

/* --- Support / donate ------------------------------------------------------ */

.support-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--purple);
  text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--purple) 35%, transparent);
  border-radius: 100px;
  padding: 0.55rem 1.1rem;
  transition: background 0.18s ease;
}

.support-link:hover {
  background: var(--purple-soft);
}

.support-link svg {
  width: 17px;
  height: 17px;
}

/* --- Footer ----------------------------------------------------------------
   House style: the tool stands on its own, Cyberry is a quiet credit.
   --------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  padding-block: clamp(2rem, 4vw, 2.75rem) 1.75rem;
  margin-top: auto;
}

.footer-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-blurb {
  max-width: 34ch;
}

.footer-blurb .wordmark {
  font-size: 1rem;
}

.footer-blurb p {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--muted);
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-nav a {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding-block: 0.3rem;
  display: inline-block;
}

.footer-nav a:hover {
  color: var(--ink-strong);
}

.footer-base {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--muted);
}

.by-cyberry {
  color: var(--muted);
  text-decoration: none;
  /* Standalone link, so it needs the 24px WCAG 2.2 target minimum. */
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding-block: 0.3rem;
}

.by-cyberry img {
  height: 20px;
  width: auto;
  opacity: 0.85;
  transition: opacity 0.18s ease;
}

.by-cyberry:hover img {
  opacity: 1;
}

/* Swap the wordmark for the light-on-dark variant with the theme. */
.by-cyberry .logo-dark { display: none; }

:root[data-theme='dark'] .by-cyberry .logo-light { display: none; }
:root[data-theme='dark'] .by-cyberry .logo-dark { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .by-cyberry .logo-light { display: none; }
  :root:not([data-theme='light']) .by-cyberry .logo-dark { display: block; }
}

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

@media (max-width: 620px) {
  .shell {
    padding-inline: 1.1rem;
  }

  .field {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  select,
  input[type='number'] {
    width: 100%;
  }

  .footer-main {
    flex-direction: column;
  }

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

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