/* ==========================================================================
   Modern CSS Reset
   ParhaatNettikasinot.ai
   Based on modern best practices (Andy Bell, Josh Comeau, Elad Shechter)
   ========================================================================== */

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

/* ------------------------------------------------------------------
   Remove default margins & padding
   ------------------------------------------------------------------ */
* {
  margin: 0;
  padding: 0;
}

/* ------------------------------------------------------------------
   Core document
   ------------------------------------------------------------------ */
html {
  /* Prevent font-size inflation on mobile */
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;

  /* Smooth scrolling for anchor links */
  scroll-behavior: smooth;

  /* Consistent scroll padding for sticky header */
  scroll-padding-top: calc(var(--header-height, 72px) + 1rem);

  /* Base font size 16px */
  font-size: 100%;

  /* Better tab sizing */
  tab-size: 4;
  -moz-tab-size: 4;
}

/* ------------------------------------------------------------------
   Body defaults
   ------------------------------------------------------------------ */
body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-bg);

  /* Font smoothing */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  /* Prevent horizontal overflow */
  overflow-x: hidden;
}

/* ------------------------------------------------------------------
   Typography reset
   ------------------------------------------------------------------ */
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  text-wrap: balance;
  line-height: var(--line-height-tight);
  font-weight: var(--font-weight-bold);
}

p {
  overflow-wrap: break-word;
  text-wrap: pretty;
}

/* ------------------------------------------------------------------
   Lists
   ------------------------------------------------------------------ */
ul,
ol {
  list-style: none;
}

/* Restore list styles for article body content areas */
.article-body ul,
.article-body ol,
.article-content ul,
.article-content ol {
  list-style: revert;
  padding-left: 1.5em;
}

/* ------------------------------------------------------------------
   Links
   ------------------------------------------------------------------ */
a {
  color: inherit;
  text-decoration: none;
}

a:not([class]) {
  text-decoration-skip-ink: auto;
  color: var(--color-text-link);
}

/* ------------------------------------------------------------------
   Media elements
   ------------------------------------------------------------------ */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  font-style: italic; /* Alt text styling */
}

/* ------------------------------------------------------------------
   Form elements
   ------------------------------------------------------------------ */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Minimum 44px touch target for interactive elements */
button,
input,
select,
textarea,
a[role="button"],
[role="button"] {
  min-height: 44px;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  min-height: 44px;
}

textarea {
  resize: vertical;
}

fieldset {
  border: none;
}

/* ------------------------------------------------------------------
   Tables
   ------------------------------------------------------------------ */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

/* ------------------------------------------------------------------
   Interactive elements
   ------------------------------------------------------------------ */
summary {
  cursor: pointer;
}

details summary {
  list-style: none;
}

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

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

/* Focus styles */
:focus-visible {
  outline: 3px solid var(--color-secondary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sr-only-focusable:focus,
.sr-only-focusable:active {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ------------------------------------------------------------------
   Selection color
   ------------------------------------------------------------------ */
::selection {
  background-color: var(--color-primary-200);
  color: var(--color-primary-dark);
}

/* ------------------------------------------------------------------
   Scrollbar styling (Webkit + Firefox)
   ------------------------------------------------------------------ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

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

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

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

/* ------------------------------------------------------------------
   Hidden utility
   ------------------------------------------------------------------ */
[hidden] {
  display: none !important;
}

/* Article image responsiveness */
.article-content img, .art-content img, .art-img img { max-width: 100%; height: auto; }

/* Scrollable tables on mobile */
.table-wrapper, .article-content table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
