/* ==========================================================================
   Glimra Stories — Design System
   Garden + Circuit: warm paper background, storybook color palette,
   rounded display type paired with a highly legible body face.
   ========================================================================== */

:root {
  /* Brand palette (see brand/brand-foundation.md) */
  --glimra-blue: #2F6690;
  --glimra-blue-dark: #1F4A6B;
  --robo-silver: #D7DEE3;
  --robo-ice: #9FD8E0;
  --garden-green: #4F9D69;
  --garden-green-dark: #3B7A50;
  --raseel-pink: #D97AA0;
  --raseel-pink-dark: #B85980;
  --sunbeam-yellow: #F4B942;
  --sunbeam-yellow-dark: #D89A2A;
  --ink: #1C1F26;
  --paper: #FBF7EF;
  --paper-dim: #F2EBDC;
  --white: #FFFFFF;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 28px;
  --radius-pill: 999px;

  --shadow-soft: 0 6px 18px rgba(28, 31, 38, 0.10);
  --shadow-lift: 0 12px 32px rgba(28, 31, 38, 0.16);

  --font-display: "Baloo 2", "Fredoka", "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

  --max-width: 1180px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--glimra-blue-dark); }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 0.5em; color: var(--glimra-blue-dark); }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.25em; }
button { font-family: inherit; }

/* Visible, high-contrast focus ring everywhere — WCAG 2.2 focus-visible requirement */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--sunbeam-yellow-dark);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--white);
  padding: 0.75em 1.25em;
  z-index: 1000;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 24px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85em 1.6em;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.btn-primary { background: var(--sunbeam-yellow); color: var(--ink); }
.btn-primary:hover { background: var(--sunbeam-yellow-dark); }
.btn-secondary { background: var(--glimra-blue); color: var(--white); }
.btn-secondary:hover { background: var(--glimra-blue-dark); }
.btn-outline { background: transparent; border-color: var(--glimra-blue); color: var(--glimra-blue-dark); }
.btn-outline:hover { background: var(--glimra-blue); color: var(--white); }
.btn-ghost { background: transparent; color: var(--glimra-blue-dark); padding: 0.6em 1em; }
.btn-block { width: 100%; justify-content: center; }

/* ---- Header / Nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
}
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 14px;
  gap: 16px;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--ink);
}
.brand-mark svg { width: 42px; height: 42px; }

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  padding: 0.6em 0.9em;
  border-radius: var(--radius-pill);
}
.main-nav a:hover, .main-nav a[aria-current="page"] { background: var(--robo-silver); }

.nav-actions { display: flex; align-items: center; gap: 10px; }

.lang-switch {
  display: flex;
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  overflow: hidden;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
}
.lang-switch button {
  border: none;
  background: var(--white);
  color: var(--ink);
  padding: 0.5em 0.85em;
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--glimra-blue); color: var(--white); }

.nav-toggle {
  display: none;
  border: 2px solid var(--ink);
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
}

/* ---- Hero ---- */
.hero {
  padding-block: 56px 72px;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-dim) 100%);
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--robo-ice);
  color: var(--glimra-blue-dark);
  padding: 0.4em 1em;
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
}
.hero h1 { font-size: clamp(2.1rem, 4vw, 3.2rem); }
.hero .lede { font-size: 1.15rem; max-width: 46ch; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 24px; }
.hero-art { position: relative; }

/* ---- Sections ---- */
section { padding-block: 64px; }
.section-heading { text-align: center; max-width: 62ch; margin-inline: auto 0; margin-bottom: 40px; }
.section-heading.centered { margin-inline: auto; text-align: center; }
.section-heading p { color: #4b5060; }

.band-alt { background: var(--white); }
.band-blue { background: var(--glimra-blue); color: var(--white); }
.band-blue h2, .band-blue h3 { color: var(--white); }

/* ---- Cards / grids ---- */
.grid { display: grid; gap: 28px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-icon {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  background: var(--sunbeam-yellow);
  border-radius: var(--radius-sm);
  border: 2px solid var(--ink);
}

.book-card {
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.book-cover { aspect-ratio: 3/4; background: var(--paper-dim); border-bottom: 2px solid var(--ink); overflow: hidden; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-icon img { width: 32px; height: 32px; object-fit: contain; }
.book-card-body { padding: 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.skill-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  line-height: 1;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-display);
  background: var(--garden-green);
  color: var(--white);
  padding: 0.35em 0.8em;
  border-radius: var(--radius-pill);
}
.book-card h3 { margin-bottom: 0; font-size: 1.25rem; }
.book-meta { color: #555; font-size: 0.92rem; }

.quote-card {
  background: var(--robo-silver);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
}

/* ---- Forms ---- */
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; text-align: left; }
.form-field label { font-weight: 700; font-family: var(--font-display); }
.form-field input, .form-field select, .form-field textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.75em 0.9em;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
}
.form-hint { font-size: 0.85rem; color: #555; }
.form-note {
  background: var(--paper-dim);
  border: 2px dashed var(--glimra-blue);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.92rem;
  margin-top: 18px;
}
.form-success {
  display: none;
  background: var(--garden-green);
  color: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-weight: 700;
}
.form-success.visible { display: block; }

/* ---- Store ---- */
.price-tag { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--glimra-blue-dark); }
.stock-note { font-size: 0.85rem; font-weight: 700; color: var(--raseel-pink-dark); }

/* ---- Footer ---- */
.site-footer { background: var(--ink); color: var(--paper); padding-block: 48px 28px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.site-footer h4 { color: var(--white); font-size: 1rem; margin-bottom: 12px; }
.site-footer a { color: var(--robo-silver); text-decoration: none; }
.site-footer a:hover { color: var(--white); text-decoration: underline; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  margin-top: 32px;
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--robo-silver);
}

/* ---- Breadcrumbs / page header ---- */
.page-header { padding-block: 40px 24px; }
.breadcrumbs { font-size: 0.9rem; margin-bottom: 10px; }
.breadcrumbs a { color: var(--glimra-blue-dark); }

/* ---- Manuscript / book detail ---- */
.book-detail-grid { display: grid; grid-template-columns: 380px 1fr; gap: 48px; align-items: start; }
.book-detail-cover { position: sticky; top: 100px; }
.spec-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.spec-list li { display: flex; justify-content: space-between; border-bottom: 1px dashed #ccc; padding-bottom: 8px; }
.spec-list b { font-family: var(--font-display); }

/* ---- Utility ---- */
.stack { display: flex; flex-direction: column; gap: 8px; }
.center { text-align: center; }
.mt-lg { margin-top: 48px; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .book-detail-grid { grid-template-columns: 1fr; }
  .book-detail-cover { position: static; max-width: 280px; margin-inline: auto; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .main-nav { display: none; }
  .site-header.nav-open .main-nav {
    display: flex;
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    background: var(--paper);
    border-bottom: 3px solid var(--ink);
    padding: 12px 24px 20px;
  }
  .nav-toggle { display: inline-flex; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---- RTL readiness (Arabic phase 2) ---- */
[dir="rtl"] .form-field { text-align: right; }
[dir="rtl"] .breadcrumbs, [dir="rtl"] .spec-list li { direction: rtl; }
