/* =========================================================
   CODERN
   Base Styles
   File: css/base.css
   Version: 3.0.0

   Theme Support:
   - Dark Mode = Original Codern theme
   - Light Mode = Clean white theme
   - Uses variables from variables.css
   - No hardcoded theme colors
   ========================================================= */


/* ---------------------------------------------------------
   1. HTML & BODY
   --------------------------------------------------------- */

html {
  font-size: 16px;

  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height, 80px);

  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;

  background-color: var(--color-bg);
  color: var(--color-text);

  transition:
    background-color var(--theme-transition-duration, 300ms)
      var(--theme-transition-easing, ease),
    color var(--theme-transition-duration, 300ms)
      var(--theme-transition-easing, ease);

  scrollbar-width: thin;
  scrollbar-color:
    var(--color-border)
    var(--color-bg);
}

body {
  min-height: 100vh;
  margin: 0;

  background-color: var(--color-bg);
  color: var(--color-text);

  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-base);

  overflow-x: hidden;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  transition:
    background-color var(--theme-transition-duration, 300ms)
      var(--theme-transition-easing, ease),
    color var(--theme-transition-duration, 300ms)
      var(--theme-transition-easing, ease);
}


/* ---------------------------------------------------------
   2. GLOBAL THEME TRANSITION
   --------------------------------------------------------- */

body,
main,
section,
article,
header,
footer,
nav,
aside,
div,
button,
a,
input,
textarea,
select,
.card,
.glass,
.panel {
  transition:
    background-color var(--theme-transition-duration, 300ms)
      var(--theme-transition-easing, ease),
    border-color var(--theme-transition-duration, 300ms)
      var(--theme-transition-easing, ease),
    color var(--theme-transition-duration, 300ms)
      var(--theme-transition-easing, ease),
    box-shadow var(--theme-transition-duration, 300ms)
      var(--theme-transition-easing, ease);
}


/* ---------------------------------------------------------
   3. MAIN PAGE STRUCTURE
   --------------------------------------------------------- */

main {
  display: block;
  width: 100%;
  min-height: 100vh;
}

section {
  position: relative;
  width: 100%;
}

article {
  display: block;
}

header,
footer,
nav,
aside {
  display: block;
}


/* ---------------------------------------------------------
   4. LINKS
   --------------------------------------------------------- */

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: inherit;
}

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}


/* ---------------------------------------------------------
   5. IMAGES & MEDIA
   --------------------------------------------------------- */

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

svg {
  width: auto;
  height: auto;
}

iframe {
  display: block;
  max-width: 100%;
  border: 0;
}


/* ---------------------------------------------------------
   6. BUTTONS & FORM CONTROLS
   --------------------------------------------------------- */

button,
input,
optgroup,
select,
textarea {
  margin: 0;

  font: inherit;
  color: inherit;
}

button,
select {
  text-transform: none;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

input,
textarea,
select {
  width: 100%;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

button,
input,
textarea,
select {
  border-radius: 0;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}


/* ---------------------------------------------------------
   7. HEADINGS
   --------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;

  color: var(--color-heading);

  font-family: var(--font-family-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-heading);

  text-wrap: balance;

  transition:
    color var(--theme-transition-duration, 300ms)
      var(--theme-transition-easing, ease);
}

h1 {
  font-size: var(--font-size-h1);
}

h2 {
  font-size: var(--font-size-h2);
}

h3 {
  font-size: var(--font-size-h3);
}

h4 {
  font-size: var(--font-size-h4);
}

h5 {
  font-size: var(--font-size-h5);
}

h6 {
  font-size: var(--font-size-h6);
}


/* ---------------------------------------------------------
   8. TEXT ELEMENTS
   --------------------------------------------------------- */

p {
  margin: 0;
  max-width: 75ch;
}

strong,
b {
  font-weight: var(--font-weight-bold);
}

small {
  font-size: var(--font-size-sm);
}

mark {
  padding: 0.1em 0.25em;

  background: var(--color-primary);
  color: var(--color-on-primary);

  border-radius: var(--radius-xs, 3px);
}

blockquote {
  margin: 0;
}

pre,
code,
kbd,
samp {
  font-family: var(--font-family-mono);
}

pre {
  overflow-x: auto;

  padding: var(--space-md, 1rem);

  background-color: var(--color-surface);
  color: var(--color-text);

  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);

  -webkit-overflow-scrolling: touch;
}

code {
  font-size: 0.9em;
}


/* ---------------------------------------------------------
   9. LISTS
   --------------------------------------------------------- */

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

li {
  margin: 0;
}


/* ---------------------------------------------------------
   10. TABLES
   --------------------------------------------------------- */

table {
  width: 100%;

  border-collapse: collapse;
  border-spacing: 0;

  color: var(--color-text);
}

th {
  text-align: left;
  font-weight: var(--font-weight-semibold);
}

th,
td {
  border-color: var(--color-border);
}


/* ---------------------------------------------------------
   11. HORIZONTAL RULE
   --------------------------------------------------------- */

hr {
  height: 1px;
  margin: 0;

  border: 0;

  background-color: var(--color-border);
}


/* ---------------------------------------------------------
   12. FORM PLACEHOLDERS
   --------------------------------------------------------- */

::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

::-webkit-input-placeholder {
  color: var(--color-text-muted);
}

::-moz-placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}


/* ---------------------------------------------------------
   13. TEXT SELECTION
   --------------------------------------------------------- */

::selection {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

::-moz-selection {
  background: var(--color-primary);
  color: var(--color-on-primary);
}


/* ---------------------------------------------------------
   14. SCROLLBAR
   --------------------------------------------------------- */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);

  transition:
    background-color var(--theme-transition-duration, 300ms)
      var(--theme-transition-easing, ease);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}


/* ---------------------------------------------------------
   15. ACCESSIBILITY
   --------------------------------------------------------- */

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;

  width: 1px !important;
  height: 1px !important;

  padding: 0 !important;
  margin: -1px !important;

  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;

  white-space: nowrap !important;
  border: 0 !important;
}


/* ---------------------------------------------------------
   16. DISABLED ELEMENTS
   --------------------------------------------------------- */

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}


/* ---------------------------------------------------------
   17. THEME-SPECIFIC BASE BEHAVIOR
   --------------------------------------------------------- */

/*
   Dark mode:
   Uses the original Codern visual system from variables.css.
*/

[data-theme="dark"] body,
body:not([data-theme]) {
  background-color: var(--color-bg);
  color: var(--color-text);
}


/*
   Light mode:
   The actual light colors are controlled centrally
   by variables.css.
*/

[data-theme="light"] body {
  background-color: var(--color-bg);
  color: var(--color-text);
}


/* ---------------------------------------------------------
   18. MOBILE TOUCH BEHAVIOR
   --------------------------------------------------------- */

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  overscroll-behavior-x: none;
}


/* ---------------------------------------------------------
   19. REDUCED MOTION
   --------------------------------------------------------- */

@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;
    transition-delay: 0ms !important;

    scroll-behavior: auto !important;
  }
}


/* ---------------------------------------------------------
   20. RESPONSIVE TYPOGRAPHY
   --------------------------------------------------------- */

@media (max-width: 768px) {
  html {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
}


/* ---------------------------------------------------------
   21. SMALL-SCREEN SAFETY
   --------------------------------------------------------- */

@media (max-width: 360px) {
  html {
    font-size: 13px;
  }

  body {
    overflow-x: hidden;
  }
}