/* =============================================================
   assets/css/reset.css
   AdNeutral — CSS Reset & Base Styles
   Load order: variables.css → reset.css
   ============================================================= */


/* ─────────────────────────────────────────────────────────────
   BOX MODEL
   ───────────────────────────────────────────────────────────── */

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


/* ─────────────────────────────────────────────────────────────
   ROOT & HTML
   ───────────────────────────────────────────────────────────── */

html {
  font-size: 100%;          /* 16px base — never override with px */
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 2;
  hanging-punctuation: first last;
}

/* Respect OS reduced-motion preference for scroll too */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}


/* ─────────────────────────────────────────────────────────────
   BODY
   ───────────────────────────────────────────────────────────── */

html {
  background-color: var(--color-bg);
}

section,
main,
article {
  background-color: transparent;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-loose);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
}


/* ─────────────────────────────────────────────────────────────
   TYPOGRAPHY — HEADINGS
   ───────────────────────────────────────────────────────────── */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-snug);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-3xl);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
}

h2 {
  font-size: var(--text-2xl);
  line-height: var(--leading-normal);
  letter-spacing: 0;
}

h3 {
  font-family: var(--font-body);
  font-size: var(--text-xl);
  line-height: var(--leading-relaxed);
  letter-spacing: 0;
}

h4 {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  letter-spacing: 0;
}

h5,
h6 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-loose);
  letter-spacing: 0;
}


/* ─────────────────────────────────────────────────────────────
   TYPOGRAPHY — BODY COPY
   ───────────────────────────────────────────────────────────── */

p {
  color: var(--text-secondary);
  line-height: var(--leading-loose);
  text-wrap: pretty;
  max-width: 70ch;
}

p + p {
  margin-top: var(--space-3);
}

strong,
b {
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

em,
i {
  font-style: italic;
}

small {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

mark {
  background-color: var(--accent-muted);
  color: var(--accent);
  padding: 0 0.25em;
  border-radius: var(--radius-sm);
}

del {
  color: var(--text-muted);
  text-decoration: line-through;
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sup { top: -0.5em; }
sub { bottom: -0.25em; }


/* ─────────────────────────────────────────────────────────────
   LINKS
   ───────────────────────────────────────────────────────────── */

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast),
              opacity var(--transition-fast);
}

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Remove default link color for elements that style their own links */
a:not([class]) {
  text-decoration-skip-ink: auto;
}


/* ─────────────────────────────────────────────────────────────
   LISTS
   ───────────────────────────────────────────────────────────── */

ul,
ol {
  list-style: none;
}

/* Restore list styles for prose content (articles, terms pages) */
.prose ul,
.article-body ul {
  list-style: disc;
  padding-left: var(--space-4);
  color: var(--text-secondary);
  line-height: var(--leading-loose);
}

.prose ol,
.article-body ol {
  list-style: decimal;
  padding-left: var(--space-4);
  color: var(--text-secondary);
  line-height: var(--leading-loose);
}

.prose li,
.article-body li {
  margin-top: var(--space-1);
}

.prose li + li,
.article-body li + li {
  margin-top: 0.375rem;
}

dt {
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

dd {
  color: var(--text-secondary);
  margin-left: var(--space-3);
}


/* ─────────────────────────────────────────────────────────────
   IMAGES & MEDIA
   ───────────────────────────────────────────────────────────── */

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
  border-style: none;
}

/* Prevent alt text overflow on broken images */
img[alt] {
  overflow: hidden;
  text-overflow: ellipsis;
}

svg {
  fill: currentColor;
  flex-shrink: 0;
}

picture {
  display: contents;
}

figure {
  display: block;
}

figure figcaption {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
  text-align: center;
}


/* ─────────────────────────────────────────────────────────────
   CODE & PRE
   ───────────────────────────────────────────────────────────── */

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-tertiary);
  color: var(--accent);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow-x: auto;
  line-height: 1.7;
  tab-size: 2;
  -webkit-overflow-scrolling: touch;
}

/* Reset nested code inside pre */
pre code {
  background: none;
  padding: 0;
  border: none;
  border-radius: 0;
  font-size: inherit;
  color: inherit;
}

kbd {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-bottom: 2px solid var(--border);
}


/* ─────────────────────────────────────────────────────────────
   BLOCKQUOTE
   ───────────────────────────────────────────────────────────── */

blockquote {
  border-left: 3px solid var(--accent);
  padding: var(--space-2) var(--space-3);
  margin: var(--space-4) 0;
  background: var(--accent-glow);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

blockquote p {
  color: var(--text-primary);
  font-style: italic;
  margin: 0;
}

blockquote cite {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
  font-style: normal;
}


/* ─────────────────────────────────────────────────────────────
   HORIZONTAL RULE
   ───────────────────────────────────────────────────────────── */

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}


/* ─────────────────────────────────────────────────────────────
   TABLES
   ───────────────────────────────────────────────────────────── */

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
  font-size: var(--text-sm);
}

th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-hover);
}

caption {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: left;
  padding-bottom: var(--space-2);
}


/* ─────────────────────────────────────────────────────────────
   FORMS — BASE ELEMENT RESETS
   ───────────────────────────────────────────────────────────── */

button,
input,
select,
textarea,
optgroup {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  margin: 0;
}

button {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
  vertical-align: middle;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

input,
textarea,
select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  display: block;
  width: 100%;
}

input[type="checkbox"],
input[type="radio"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: auto;
  display: inline-block;
  cursor: pointer;
  accent-color: var(--accent);
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

input::-ms-clear,
input::-ms-reveal {
  display: none;
}

textarea {
  resize: vertical;
  vertical-align: top;
  min-height: 120px;
}

select {
  cursor: pointer;
  padding-right: var(--space-5);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B92A5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-2) center;
}

select::-ms-expand {
  display: none;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

legend {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  padding: 0 var(--space-1);
}

label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
}

/* Focus ring — consistent across all interactive elements */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Remove focus ring for mouse users — only show for keyboard */
:focus:not(:focus-visible) {
  outline: none;
}


/* ─────────────────────────────────────────────────────────────
   INTERACTIVE — MISC
   ───────────────────────────────────────────────────────────── */

details {
  cursor: pointer;
}

summary {
  display: list-item;
  cursor: pointer;
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  list-style: none;
}

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

dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  color: var(--text-primary);
  padding: var(--space-6);
  max-width: min(560px, calc(100vw - var(--space-4)));
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

[hidden] {
  display: none !important; /* Enforced for semantic correctness — not a specificity hack */
}

[disabled] {
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.5;
}

[aria-busy="true"] {
  cursor: progress;
}

[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}


/* ─────────────────────────────────────────────────────────────
   SCROLLBAR — WEBKIT
   Custom styled to match the dark design system.
   ───────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-primary);
}


/* ─────────────────────────────────────────────────────────────
   SELECTION
   ───────────────────────────────────────────────────────────── */

::selection {
  background: var(--accent-muted);
  color: var(--accent);
}

::-moz-selection {
  background: var(--accent-muted);
  color: var(--accent);
}


/* ─────────────────────────────────────────────────────────────
   PRINT
   Hide decorative and interactive UI when printing.
   ───────────────────────────────────────────────────────────── */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  nav,
  .nav,
  .sidebar,
  .ad-slot,
  #cookie-banner,
  #progress-bar,
  .btn-primary,
  .btn-secondary,
  .share-buttons {
    display: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.75em;
  }

  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  img {
    page-break-inside: avoid;
    max-width: 100% !important;
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }

  p, h2, h3 {
    orphans: 3;
    widows: 3;
  }

  body {
    font-size: 12pt;
    font-family: Georgia, serif;
    line-height: 1.5;
  }
}
