/* css/base.css */
/* Base HTML & Reset Styles - Material Design 3 */

/* ========================================================================
   CSS RESET & NORMALIZE
   ======================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Prevent tap highlight on mobile for clean UI */
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px; /* Base 16px for rem scaling */
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-body-medium);
  min-height: 100vh;
  /* Font smoothing for crisp rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
}

/* ========================================================================
   TYPOGRAPHY
   ======================================================================== */
h1 {
  font: var(--md-sys-typescale-display-small);
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

h2 {
  font: var(--md-sys-typescale-title-large);
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

h3 {
  font: var(--md-sys-typescale-title-medium);
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

h4, h5, h6 {
  font: var(--md-sys-typescale-title-small);
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
}

p {
  font: var(--md-sys-typescale-body-medium);
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
}

a {
  color: var(--md-sys-color-primary);
  text-decoration: none;
  transition: color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

a:hover {
  color: var(--md-sys-color-on-primary-container);
}

/* Monospace text */
code, pre, .mono-text {
  font: var(--md-sys-typescale-font-mono);
  font-size: 0.875rem; /* 14px */
}

/* ========================================================================
   FORMS & INPUTS RESET
   ======================================================================== */
button,
input,
optgroup,
select,
textarea {
  font: inherit;
  color: inherit;
  margin: 0;
  border: none;
  outline: none;
  background: transparent;
}

button {
  cursor: pointer;
  padding: 0;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.38; /* Material 3 disabled state opacity */
}

textarea {
  resize: vertical;
}

/* Remove default appearance for webkit */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="search"],
input[type="password"],
textarea,
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Remove number input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* Remove search input clear button in IE/Edge/Webkit */
input[type="search"]::-ms-clear,
input[type="search"]::-ms-reveal {
  display: none;
  width: 0;
  height: 0;
}
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

/* ========================================================================
   ACCESSIBILITY & UTILITIES
   ======================================================================== */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Focus rings for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

/* Hide elements visually but keep accessible to screen readers */
.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;
}

[hidden] {
  display: none !important;
}

/* ========================================================================
   SCROLLBAR (Chrome/Workspace Style)
   ======================================================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--md-sys-color-outline);
}

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--md-sys-color-outline-variant) transparent;
}
