/* =========================================================================
   base.css
   --------
   Design tokens ("Imperial Topaz" palette), CSS reset, typography and
   layout primitives shared across the whole site.

   Palette notes:
   The brief specified an "Imperial Topaz" theme with two valid anchor
   colors (--gold, --amber below). The gemstone itself runs from deep
   honey-gold through burnt-sherry orange into a dark mahogany-brown, so
   the remaining tones were chosen to complete that family rather than
   default to an unrelated color.
   ========================================================================= */

:root {
  /* ---- Imperial Topaz palette ------------------------------------- */
  --cream:        #FFF7EC; /* warm parchment background */
  --cream-deep:   #F7E9D2; /* slightly deeper cream for section bands */
  --gold:         #FFD77A; /* golden highlight (given) */
  --amber:        #E6A520; /* rich amber, primary accent (given) */
  --sherry:       #E8703A; /* burnt sherry-orange accent */
  --mahogany:     #7A4A0E; /* deep topaz-brown, secondary dark */
  --espresso:     #3A2311; /* near-black brown, primary text/dark bg */

  /* ---- Functional aliases ------------------------------------------ */
  --color-bg:            var(--cream);
  --color-bg-alt:        var(--cream-deep);
  --color-bg-dark:       var(--espresso);
  --color-text:          var(--espresso);
  --color-text-soft:     #6B5236;
  --color-text-on-dark:  var(--cream);
  --color-primary:       var(--amber);
  --color-primary-dark:  var(--mahogany);
  --color-accent:        var(--sherry);
  --color-highlight:     var(--gold);
  --color-border:        #E9D8B8;
  --color-success:       #3E7D4E;
  --color-error:         #B4402C;

  /* ---- Typography ---------------------------------------------------
     Display: Fraunces  - a warm, editorial serif with real character
     for headings (used sparingly, at weight, for personality).
     Body: Work Sans     - a clean humanist sans for readability.
  */
  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* ---- Typography --------------------------------------------------- */
  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --fs-h1: clamp(1.85rem, 4.5vw + 0.8rem, 4.2rem);
  --fs-h2: clamp(1.45rem, 3vw + 0.6rem, 2.6rem);
  --fs-h3: clamp(1.15rem, 1.8vw + 0.5rem, 1.75rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;

  /* ---- Spacing scale -------------------------------------------------- */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.75rem;
  --space-lg: 3rem;
  --space-xl: 4.5rem;

  /* ---- Layout ---------------------------------------------------------- */
  --content-width: 1180px;
  --radius-sm: 6px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --shadow-soft: 0 10px 30px rgba(58, 35, 17, 0.10);
  --shadow-strong: 0 20px 50px rgba(58, 35, 17, 0.22);

  --transition-fast: 0.2s ease;
  --transition-med: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (max-width: 640px) {
  :root {
    --space-md: 1.25rem;
    --space-lg: 2.2rem;
    --space-xl: 3rem;
  }
}

/* Respect users who've asked for reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Reset --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* account for fixed navbar */
  overflow-x: hidden;
  overscroll-behavior-x: none; /* no sideways rubberband / white edge reveal */
  width: 100%;
  background: var(--espresso); /* matches footer at extreme bottom edge */
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-x: none; /* no horizontal elastic bleed */
  width: 100%;
  max-width: 100vw;
}

main {
  width: 100%;
  flex: 1 0 auto; /* pins footer to bottom edge on short pages */
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }

ul, ol { padding: 0; margin: 0; list-style: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 var(--space-xs);
  color: var(--color-text);
  word-break: break-word;
  hyphens: auto;
}

h1 { font-size: var(--fs-h1); font-weight: 700; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { margin: 0 0 var(--space-sm); word-break: break-word; }

button { font-family: inherit; }

/* Visible focus ring everywhere for keyboard accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

/* ---- Layout primitives --------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-left: max(max(1rem, 3.5vw), env(safe-area-inset-left, 0px));
  padding-right: max(max(1rem, 3.5vw), env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}

.section {
  padding-block: var(--space-xl);
}

.section--alt {
  background: var(--color-bg-alt);
}

.section--dark {
  background: var(--color-bg-dark);
  color: var(--color-text-on-dark);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark p {
  color: var(--color-text-on-dark);
}

.section-head {
  max-width: 640px;
  margin-bottom: var(--space-lg);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary-dark);
  margin-bottom: var(--space-xs);
  flex-wrap: wrap;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--color-accent);
  display: inline-block;
  flex-shrink: 0;
}

.text-soft { color: var(--color-text-soft); }

.grid {
  display: grid;
  gap: var(--space-md);
  width: 100%;
}

@media (min-width: 580px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 820px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
