/**
 * @file
 * LearnAbout base styles: reset, custom properties, typography, base elements.
 *
 * Brand concept: The Naturalist's Study — a cabinet of curiosities meets
 * handcrafted atelier, rooted in the natural world.
 */

/* =============================================================================
   CSS Custom Properties
   ============================================================================= */

:root {
  /* --- PRIMARY PALETTE --- */
  --la-cream: #F5F0E8;              /* Field Journal Cream — primary background */
  --la-ink: #2C2119;                /* Ink Walnut — primary text, dark backgrounds */
  --la-green: #4A6741;              /* Naturalist Green — primary accent, nature elements */
  --la-gold: #B8923F;              /* Specimen Gold — highlights, achievements, labels */

  /* --- ACCENT PALETTE --- */
  --la-terracotta: #C4704B;        /* Watercolor Terracotta — warm accent, alerts */
  --la-ultramarine: #3B5998;       /* Ultramarine Wash — cool accent, links */
  --la-violet: #7B5E7B;            /* Pressed Violet — secondary accent */
  --la-sage: #D4DCCA;              /* Light Sage — subtle backgrounds, borders */

  /* --- SUPPORTING PALETTE --- */
  --la-paper: #EDE6D6;             /* Warm Paper — secondary background, sidebar */
  --la-brass: #D4B06A;             /* Brass Light — hover states, secondary gold */
  --la-fern: #A3B494;              /* Faded Fern — muted green, disabled states */
  --la-leather: #8B7355;           /* Leather Brown — tertiary text, borders */

  /* --- SEMANTIC: BACKGROUNDS --- */
  --la-bg-primary: var(--la-cream);
  --la-bg-secondary: var(--la-paper);
  --la-bg-dark: var(--la-ink);
  --la-bg-accent: var(--la-green);

  /* --- SEMANTIC: TEXT --- */
  --la-text-primary: var(--la-ink);
  --la-text-secondary: rgba(44, 33, 25, 0.6);
  --la-text-muted: rgba(44, 33, 25, 0.4);
  --la-text-hint: rgba(44, 33, 25, 0.25);
  --la-text-on-dark: var(--la-cream);
  --la-text-on-dark-secondary: rgba(245, 240, 232, 0.5);

  /* --- SEMANTIC: BORDERS --- */
  --la-border-light: rgba(44, 33, 25, 0.08);
  --la-border-medium: rgba(44, 33, 25, 0.15);
  --la-border-dark: rgba(44, 33, 25, 0.25);

  /* --- SEMANTIC: LINKS --- */
  --la-link: var(--la-ultramarine);
  --la-link-hover: #2D4573;

  /* --- SEMANTIC: STATUS --- */
  --la-success: var(--la-green);
  --la-warning: var(--la-gold);
  --la-error: var(--la-terracotta);
  --la-info: var(--la-ultramarine);

  /* --- SHADOWS --- */
  --la-shadow-sm: 0 1px 3px rgba(44, 33, 25, 0.06);
  --la-shadow-md: 0 2px 12px rgba(44, 33, 25, 0.08);
  --la-shadow-lg: 0 4px 24px rgba(44, 33, 25, 0.1);
  --la-shadow-hover: 0 4px 16px rgba(44, 33, 25, 0.12);

  /* --- BORDER RADIUS --- */
  --la-radius-sm: 4px;
  --la-radius-md: 6px;
  --la-radius-lg: 8px;
  --la-radius-xl: 12px;
  --la-radius-round: 50%;

  /* --- SPACING SCALE --- */
  --la-space-xs: 4px;
  --la-space-sm: 8px;
  --la-space-md: 16px;
  --la-space-lg: 24px;
  --la-space-xl: 32px;
  --la-space-2xl: 48px;
  --la-space-3xl: 64px;

  /* --- TRANSITIONS --- */
  --la-transition-fast: 0.15s ease;
  --la-transition-base: 0.2s ease;
  --la-transition-slow: 0.3s ease;

  /* --- Z-INDEX SCALE --- */
  --la-z-dropdown: 100;
  --la-z-sticky: 200;
  --la-z-modal-backdrop: 300;
  --la-z-modal: 400;
  --la-z-toast: 500;

  /* --- COLLECTION COLORS (per-subject accents) --- */
  --la-collection-music: var(--la-green);
  --la-collection-math: var(--la-gold);
  --la-collection-science: var(--la-terracotta);
  --la-collection-language: var(--la-ultramarine);
  --la-collection-history: var(--la-violet);

  /* --- SPECIMEN RARITY COLORS --- */
  --la-rarity-common: var(--la-green);
  --la-rarity-uncommon: var(--la-terracotta);
  --la-rarity-rare: var(--la-ultramarine);
  --la-rarity-legendary: var(--la-gold);

  /* --- TYPOGRAPHY --- */
  --la-font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --la-font-body: 'Karla', 'Helvetica Neue', Arial, sans-serif;
  --la-font-accent: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --la-font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}


/* =============================================================================
   Reset
   ============================================================================= */

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

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

body {
  min-height: 100vh;
  background: var(--la-bg-primary);
  color: var(--la-text-primary);
  font-family: var(--la-font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

img {
  height: auto;
}

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

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

ul,
ol {
  list-style: none;
}

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

table {
  border-collapse: collapse;
  border-spacing: 0;
}

fieldset {
  border: none;
}

/* Screen reader only utility */
.visually-hidden,
.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;
}


/* =============================================================================
   Typography
   ============================================================================= */

/* --- Headings: Playfair Display --- */

h1, h2, h3, h4, h5, h6 {
  color: var(--la-text-primary);
  margin-bottom: 0.5em;
}

h1 {
  font-family: var(--la-font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.5px;
}

h2 {
  font-family: var(--la-font-display);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
}

h3 {
  font-family: var(--la-font-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

h4 {
  font-family: var(--la-font-display);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
}

h5 {
  font-family: var(--la-font-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

h6 {
  font-family: var(--la-font-body);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Body text utilities --- */

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-muted {
  color: var(--la-text-muted);
}

.text-secondary {
  color: var(--la-text-secondary);
}

/* --- Labels: Karla uppercase --- */

.la-label {
  font-family: var(--la-font-body);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--la-gold);
}

.la-label--subject[data-subject="music"] { color: var(--la-collection-music); }
.la-label--subject[data-subject="math"] { color: var(--la-collection-math); }
.la-label--subject[data-subject="science"] { color: var(--la-collection-science); }
.la-label--subject[data-subject="language"] { color: var(--la-collection-language); }
.la-label--subject[data-subject="history"] { color: var(--la-collection-history); }

/* --- Tagline / Accent: Cormorant Garamond --- */

.la-tagline {
  font-family: var(--la-font-accent);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* --- Specimen card labels --- */

.la-specimen-label {
  font-family: var(--la-font-body);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--la-gold);
}


/* =============================================================================
   Base Elements
   ============================================================================= */

/* --- Links --- */

a:not([class]) {
  color: var(--la-link);
  transition: color var(--la-transition-base);
}

a:not([class]):hover {
  color: var(--la-link-hover);
}

/* --- Paragraphs --- */

p {
  margin-bottom: 1em;
}

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

/* --- Blockquotes --- */

blockquote {
  padding-left: var(--la-space-lg);
  border-left: 3px solid var(--la-gold);
  font-family: var(--la-font-accent);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--la-text-secondary);
  margin: var(--la-space-lg) 0;
}

/* --- Horizontal rule --- */

hr {
  border: none;
  height: 1px;
  background: var(--la-border-light);
  margin: var(--la-space-xl) 0;
}

/* --- Code --- */

code,
pre {
  font-family: var(--la-font-mono);
  font-size: 0.875em;
}

code {
  background: var(--la-bg-secondary);
  padding: 2px 6px;
  border-radius: var(--la-radius-sm);
}

pre {
  background: var(--la-bg-secondary);
  padding: var(--la-space-md);
  border-radius: var(--la-radius-md);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

/* --- Selection --- */

::selection {
  background: rgba(74, 103, 65, 0.15);
  color: var(--la-ink);
}

/* --- Focus styles (global) --- */

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 103, 65, 0.2);
  border-radius: var(--la-radius-sm);
}


/* =============================================================================
   Base Form Elements
   ============================================================================= */

.la-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="number"],
textarea,
select {
  font-family: var(--la-font-body);
  font-size: 0.9375rem;
  padding: 10px 14px;
  border: 1px solid var(--la-border-medium);
  border-radius: var(--la-radius-md);
  background: white;
  color: var(--la-text-primary);
  transition: border-color var(--la-transition-base),
              box-shadow var(--la-transition-base);
  width: 100%;
}

.la-input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--la-green);
  box-shadow: 0 0 0 3px rgba(74, 103, 65, 0.1);
}

.la-input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--la-text-muted);
}

.la-form-label,
label {
  font-family: var(--la-font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--la-text-primary);
  margin-bottom: 6px;
  display: block;
}

/* --- Status Messages (Drupal 11 default template uses data-drupal-messages) --- */

[data-drupal-messages] > div {
  padding: var(--la-space-md) var(--la-space-lg);
  margin-bottom: var(--la-space-lg);
  border-radius: var(--la-radius-md);
  font-family: var(--la-font-body);
  font-size: 0.9375rem;
  line-height: 1.5;
  background: #eef4ec;
  border: 1px solid var(--la-success);
  color: #2d4a28;
}

[data-drupal-messages] > div[aria-label="Error message"] {
  background: #fdf0ec;
  border-color: var(--la-error);
  color: #7a2e19;
}

[data-drupal-messages] > div[aria-label="Warning message"] {
  background: #fdf6e8;
  border-color: var(--la-warning);
  color: #6b5620;
}

[data-drupal-messages] ul {
  margin: 0;
  padding: 0 0 0 var(--la-space-md);
}

[data-drupal-messages] li {
  margin-bottom: var(--la-space-xs);
}

[data-drupal-messages] li:last-child {
  margin-bottom: 0;
}

[data-drupal-messages] a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}
