/* ==========================================================================
   AWS - Hobart - main.css
   Design tokens, base element styles, accessibility primitives.

   Every value the visual language spec defines lives here as a custom
   property. Components reference these properties. No component file
   carries a raw hex value, a one-off radius or a one-off shadow.
   ========================================================================== */

:root {
  /* --- Palette -----------------------------------------------------------
     Matched to cityofhobart.org, read from its served stylesheets. Full
     source and the values not used here are in docs/design-reference.md.
     Every ratio below is against --color-surface unless stated.            */
  --color-surface:        #F5FAFF; /* page background                        */
  --color-surface-white:  #FFFFFF; /* raised light surface                   */
  --color-band:           #E7EDF4; /* alt band, table stripes, card hover    */
  --color-ink:            #212121; /* body text, 15.34:1                     */

  /* Dark surfaces. The city's chrome is primary blue, not near-black, so
     these are separate from --color-ink rather than reusing it.            */
  --color-dark-surface:   #3F5F76; /* header, footer, utility bar, dark bands */
  --color-dark-surface-2: #283C4B; /* deep band, gradient end                */

  --color-action:         #3F5F76; /* links and buttons, 6.43:1              */
  --color-action-hover:   #344F62; /* darkened, not the city's lighter hover */

  /* Gold accent. FILL ONLY on light surfaces - 1.59:1 as text, so it is
     never used for type there. Text variants are provided below.           */
  --color-accent:         #FFBC50;
  --color-accent-on-dark: #FFCB77; /* accent as text on dark, 4.52:1         */
  --color-accent-text:    #985E00; /* accent family as text on light, 5.08:1 */

  /* Secondary blue. The city sets h3 in #5884A3, which is 3.81:1 - large
     text only. Anything at body size uses the darkened variant.            */
  --color-secondary:      #5884A3;
  --color-secondary-text: #4A6F89; /* 5.09:1, safe at any size              */

  /* --- Derived values, not brand colors --------------------------------- */
  --color-ink-muted:      #55636D; /* muted body copy, 5.90:1               */
  --color-ink-faint:      #CFD4D7; /* decorative hairline on light          */
  --color-hairline:       #D7DFE8;
  --color-hairline-dark:  rgba(245, 250, 255, 0.18);
  --color-muted-on-dark:  #CBD7E1; /* muted copy on dark surfaces, 4.61:1   */
  --color-tile:           rgba(63, 95, 118, 0.10); /* icon tile fill        */
  --color-error:          #B3261E; /* form errors, 6.06:1 on white          */
  --color-error-surface:  #FCEEEE; /* form error message background         */

  /* --- Typography --------------------------------------------------------
     The city pairs Oswald headings with Poppins 500 body. Both are Google
     Fonts. Body weight is 500, not 400 - that weight is a large part of
     what the site looks like.

     Deliberate deviation: the city's type SCALE is a municipal CMS default
     (h1 28px, h2 25.6px). This is a brochure with a full-window hero, so
     the chassis's editorial scale below is kept. The match is carried by
     palette, family, weight and the accent motif, not by heading sizes.   */
  --font-display: 'Oswald', system-ui, sans-serif;
  --font-sans:    'Poppins', system-ui, sans-serif;
  /* 17px, not 16px. The audience spans a wide age range and the site
     carries long explanatory copy.                                        */
  --font-size-base: 1.0625rem;
  --line-height-base: 1.65;
  --line-height-tight: 1.1;
  --tracking-nav: 0.04em; /* Oswald uppercase needs air at nav sizes        */

  /* --- Structure -------------------------------------------------------- */
  --container-max:  1200px;
  --container-pad:  1.5rem;
  --space-section:      7.5rem; /* 120px, desktop section padding           */
  --space-section-sm:   4rem;   /* mobile section padding                   */

  /* --- Component tokens --------------------------------------------------
     The city's radius vocabulary: 10px cards, 3px accent bars, 0 buttons.
     It has no pill anywhere in its active theme.                          */
  --radius-media:  10px; /* images and cards                                */
  --radius-tile:   8px;  /* small icon tiles only                           */
  --radius-button: 0;    /* buttons are sharp rectangles                    */
  --radius-bar:    3px;  /* the accent underline bars                       */
  --shadow-card:   0 3px 6px rgba(0, 0, 0, 0.16);
  --shadow-header: 0 2px 5px rgba(0, 0, 0, 0.20);
  --hairline-weight: 1px;
  --tap-target: 44px;
  --accent-bar-w: 50px; /* grows to full width on hover, the city's motif   */

  /* --- Motion ----------------------------------------------------------- */
  --transition-base: 300ms ease-in-out; /* the city's consistent .3s        */
}

/* --------------------------------------------------------------------------
   Base elements
   -------------------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-sans);
  /* 500, matching the city. Poppins 400 reads noticeably lighter and loses
     the weight that characterises the reference. */
  font-weight: 500;
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
}

/* The city sets headings in the primary blue rather than body ink. */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: var(--color-action);
  text-wrap: balance;
}

h1 { font-weight: 600; }
h2 { font-weight: 700; }

/* h3 takes the city's secondary blue. That colour is 3.81:1 on the page
   background - large text only - so h3 must not drop below 24px. Anything
   smaller uses --color-secondary-text. */
h3 {
  font-weight: 700;
  color: var(--color-secondary);
  font-size: clamp(1.5rem, 2vw, 1.625rem);
}

/* h4 to h6 were not specified by the client. Derived from the reference,
   which drops to the body family at small sizes. Recorded in the brief. */
h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--color-ink);
}

p {
  max-width: 68ch;
}

a {
  color: var(--color-action);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--color-action-hover);
}

strong {
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Focus and skip link
   Focus is never suppressed. Both are WCAG 2.2 requirements.
   -------------------------------------------------------------------------- */

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

.on-dark :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--color-accent-on-dark);
}

.skip-to-main {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background-color: var(--color-dark-surface);
  color: var(--color-surface);
  padding: 0.875rem 1.5rem;
  font-weight: 600;
  text-decoration: none;
}

.skip-to-main:focus {
  left: 0;
}

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

/* --------------------------------------------------------------------------
   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;
  }
}
