/* ==========================================================================
   Cellery Design System - Base Styles
   Reset, Typography, and Foundation
   ========================================================================== */

/* ========================================================================
   FONTS
   ======================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500&family=Nunito:wght@400;500;600;700;800&family=Rubik:wght@300;400&display=swap');

/* ========================================================================
   CSS RESET (Modern Minimal)
   ======================================================================== */

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

* {
  margin: 0;
  padding: 0;
}

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

/* Offset anchor scroll for sticky header */
:target {
  scroll-margin-top: calc(var(--header-height-scrolled) + var(--space-6));
}

body {
  min-height: 100vh;
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

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

/* Remove default styling from summary */
summary {
  cursor: pointer;
}

/* Remove spinner from number inputs */
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;
}

/* ========================================================================
   ROOT & BODY
   ======================================================================== */

html {
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-primary);
  background-color: var(--color-background);
}

/* ========================================================================
   TYPOGRAPHY
   ======================================================================== */

/* Headings */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-extrabold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text-primary);
}

h1, .h1 {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-6);
}

h2, .h2 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-5);
}

h3, .h3 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-4);
}

h4, .h4 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-3);
}

h5, .h5 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-2);
}

h6, .h6 {
  font-size: var(--font-size-base);
  margin-bottom: var(--space-2);
}

/* Paragraphs */
p {
  margin-bottom: var(--space-4);
  line-height: var(--line-height-relaxed);
}

p:last-child {
  margin-bottom: 0;
}

/* Lead text */
.lead {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-secondary);
}

/* Small text */
small,
.small {
  font-size: var(--font-size-sm);
}

/* Caption text */
.caption {
  font-family: var(--font-caption);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-light);
  color: var(--color-text-muted);
}

/* Data/numeric text */
.data {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
}

/* Strong */
strong,
.strong {
  font-weight: var(--font-weight-bold);
}

/* ========================================================================
   LINKS
   ======================================================================== */

a {
  color: var(--color-teal-cellery);
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-bluish-cellery);
}

/* Animated underline link */
.link-animated {
  position: relative;
  display: inline-block;
}

.link-animated::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-teal-cellery);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-normal) var(--ease-out);
}

.link-animated:hover::after {
  transform: scaleX(1);
}

/* ========================================================================
   LISTS
   ======================================================================== */

.list {
  list-style: none;
  padding-left: 0;
}

.list li {
  margin-bottom: var(--space-2);
}

.list-bulleted {
  padding-left: var(--space-6);
}

.list-bulleted li {
  position: relative;
}

.list-bulleted li::before {
  content: '';
  position: absolute;
  left: calc(var(--space-6) * -1 + var(--space-2));
  top: 0.6em;
  width: 6px;
  height: 6px;
  background-color: var(--color-teal-cellery);
  border-radius: 50%;
}

/* ========================================================================
   SELECTION
   ======================================================================== */

::selection {
  background-color: var(--color-teal-cellery);
  color: var(--color-blue-cellery);
}

/* ========================================================================
   FOCUS STYLES (Accessibility)
   ======================================================================== */

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* ========================================================================
   SKIP LINK (Accessibility)
   ======================================================================== */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-tooltip);
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-blue-cellery);
  color: var(--color-text-inverse);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-md);
  transition: top var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ========================================================================
   SCREEN READER ONLY
   ======================================================================== */

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

/* ========================================================================
   REDUCED MOTION
   ======================================================================== */

@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;
  }
}

/* ========================================================================
   UTILITY CLASSES
   ======================================================================== */

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Text colors */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-teal { color: var(--color-teal-cellery); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }

/* Font weights */
.font-regular { font-weight: var(--font-weight-regular); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }
.font-extrabold { font-weight: var(--font-weight-extrabold); }

/* Display */
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }

/* Visibility */
.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Width/Height */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* Margin auto */
.mx-auto { margin-left: auto; margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }
.m-auto { margin: auto; }

/* White space */
.nowrap { white-space: nowrap; }
