/**
 * @file global.css
 * Base styles, typography resets, and utility classes for the Wizard theme.
 * Imports tokens.css — do not define raw values here, use custom properties.
 */

@import 'tokens.css';
/* Google Fonts are loaded dynamically by wizard_preprocess_html() in wizard.theme
   based on the admin's font choices in Appearance > Wizard > Settings. */

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

/* ── Base ── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-bg-default);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
}

h1 { font-size: var(--font-size-5xl); font-weight: var(--font-weight-extrabold); letter-spacing: var(--letter-spacing-tight); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
  margin-bottom: var(--space-4);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-base);
}

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

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

ul, ol {
  list-style: none;
}

/* ── Layout Utilities ── */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--section-padding-x);
}

.section {
  padding-block: var(--section-padding-y);
  padding-inline: var(--section-padding-x);
}

/* Section background alternates */
.section--white      { background-color: var(--color-bg-default); }
.section--offwhite   { background-color: var(--color-bg-offwhite); }
.section--lavender   { background-color: var(--color-bg-lavender); }
.section--pink       { background-color: var(--color-bg-pink); }
.section--blue       { background-color: var(--color-primary); }

/* ── Section Label (orange eyebrow text) ── */
.section-label {
  display: block;
  font-family: var(--font-heading);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-3);
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-base);
  padding: 14px var(--space-8);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background var(--transition-base), transform var(--transition-fast);
  cursor: pointer;
  border: none;
  line-height: 1;
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-white);
}

.btn--primary:hover {
  background-color: var(--color-accent-hover);
  color: var(--color-white);
  transform: translateY(-1px);
}

.btn--outline {
  background-color: transparent;
  color: var(--color-accent);
  border: 2px solid var(--color-accent);
}

.btn--outline:hover {
  background-color: var(--color-accent);
  color: var(--color-white);
}

.btn--white {
  background-color: var(--color-white);
  color: var(--color-primary);
}

.btn--white:hover {
  background-color: var(--color-offwhite);
  color: var(--color-primary);
}

/* ── Cards ── */
.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
}

/* ── Page Layout ── */
.layout-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.layout-main {
  flex: 1 0 auto;
}

/* ── Navigation region ── */
/*
 * Drupal's displace.js sets these CSS variables automatically for any admin
 * theme (Gin sidebar, classic horizontal toolbar, etc.):
 *   --drupal-displace-offset-top  = height of any fixed bar above the content
 *   --drupal-displace-offset-left = width of any fixed sidebar to the left
 * We use them so the nav sits below / beside the admin chrome when present,
 * and sits flush at 0/0 for anonymous visitors (where both vars default to 0).
 */
.layout-navigation {
  background-color: var(--color-primary);
  position: fixed;
  top: var(--drupal-displace-offset-top, 0px);
  left: var(--drupal-displace-offset-left, 0px);
  right: 0;
  z-index: var(--z-nav);
}

/* Push page content down so it starts below the fixed nav */
.layout-wrapper {
  padding-top: calc(var(--nav-height) + var(--drupal-displace-offset-top, 0px));
}

/* Three-zone nav: [Branding left] [Menu right] */
.layout-nav-inner {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--section-padding-x);
  height: var(--nav-height);
}

/* Canvas wraps all nav components in a single <div> — that div is the flex row */
.layout-nav-inner > div {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  height: 100%;
  width: 100%;
}

/* Branding block: shrinks to content, stays left */
.layout-nav-inner .site-branding {
  flex-shrink: 0;
}

/* Menu block: grows to fill remaining space */
.layout-nav-inner .nav-menu {
  flex: 1 1 auto;
}

/* ── Site branding block ── */
.site-branding__name {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-extrabold);
  font-size: var(--font-size-xl);
  color: var(--color-white);
  text-decoration: none;
  letter-spacing: var(--letter-spacing-tight);
  white-space: nowrap;
}

.site-branding__name:hover {
  color: var(--color-white);
}

.site-branding__accent {
  color: var(--color-accent);
}

.site-branding__logo img {
  height: 36px;
  width: auto;
}

/* ── Main navigation menu ── */
.nav-menu {
  display: flex;
  align-items: center;
  justify-content: flex-end; /* push links to the right */
  width: 100%;
}

.nav-menu ul {
  display: flex;
  gap: var(--space-8);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: color var(--transition-base);
  white-space: nowrap;
}

.nav-menu a:hover,
.nav-menu a.is-active {
  color: var(--color-white);
}

.nav-menu a.is-active {
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 2px;
}

/* Nav CTA button — slightly more compact than full-size btn */
.nav-cta.btn {
  padding: 10px var(--space-6);
  flex-shrink: 0;
  font-size: var(--font-size-sm);
}

/* ── Skip Link (accessibility) ── */
.visually-hidden,
.visually-hidden-focusable:not(:focus):not(:focus-within) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Drupal admin toolbar offset ── */
/* Handled automatically by --drupal-displace-offset-* vars above.
   Keep this rule only as a belt-and-suspenders guard for the Gin
   mobile top bar (< 61 em), which uses --gin-toolbar-y-offset. */
@media (max-width: 60.99em) {
  body.toolbar-fixed .layout-navigation {
    top: var(--gin-toolbar-y-offset, var(--drupal-displace-offset-top, 39px));
  }

  body.toolbar-fixed .layout-wrapper {
    padding-top: calc(var(--nav-height) + var(--gin-toolbar-y-offset, var(--drupal-displace-offset-top, 39px)));
  }
}
