/* Base typography, layout primitives (container, section) and buttons. */

@layer base {
  html body {
    font-size: var(--theme-font-size-base);
    line-height: 1.75;
    font-weight: 400;
  }

  h1,
  h2,
  h3,
  h4 {
    font-family: var(--theme-font-heading);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-wrap: balance;
  }

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

  a {
    color: inherit;
  }

  :focus-visible {
    outline: 2px solid var(--theme-color-accent);
    outline-offset: 3px;
  }

  .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 100;
    padding: 0.75rem 1rem;
    background: var(--theme-color-primary);
    color: var(--theme-color-primary-foreground);
  }

  .skip-link:focus {
    top: 1rem;
  }
}

@layer components {
  .container {
    width: min(100% - 2 * var(--theme-gutter), var(--theme-container));
    margin-inline: auto;
  }

  .container--narrow {
    width: min(100% - 2 * var(--theme-gutter), var(--theme-container-narrow));
  }

  .section {
    padding-block: var(--theme-space-xl);
  }

  .section--tight {
    padding-block: var(--theme-space-lg);
  }

  .section--muted {
    background: var(--theme-color-surface);
  }

  .section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: var(--theme-space-sm);
    margin-bottom: var(--theme-space-md);
  }

  .section-head__eyebrow,
  .page-hero__eyebrow {
    margin-bottom: 0.5rem;
    font-size: var(--theme-font-size-sm);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--theme-color-secondary);
  }

  .page-hero__eyebrow {
    color: var(--theme-color-accent);
  }

  .section-head__title {
    font-size: var(--theme-font-size-h2);
  }

  .section-head__note {
    max-width: 44ch;
    color: var(--theme-color-text-muted);
    line-height: 1.6;
  }

  /* Small uppercase label with a short line before it (Prime design). */
  .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--theme-color-text-muted);
  }

  .eyebrow--light {
    color: var(--theme-color-inverse-text);
  }

  .eyebrow::before {
    content: '';
    width: 1.75rem;
    height: 1.5px;
    background: currentcolor;
    opacity: 0.7;
  }

  /* Buttons, as in the Prime design artifact: pill shaped, label left and a
     round icon with an arrow right that nudges on hover. The circle is
     ::after, the arrow ::before (a mask on top of it), so every .button gets
     them without extra markup.
     .button             solid green, white arrow on a translucent circle
     .button--outline    green line, green circle; fills green on hover
     .button--light      white, green circle (on dark backgrounds)
     .button--ghost-light  white line on dark, no icon */
  .button {
    --button-icon-bg: rgb(255 255 255 / 16%);
    --button-icon-fg: var(--theme-color-primary-foreground);
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 52px;
    padding: 6px 7px 6px 26px;
    border: 1.5px solid transparent;
    border-radius: 999px;
    background: var(--theme-color-primary);
    color: var(--theme-color-primary-foreground);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition:
      background-color 0.25s,
      color 0.25s,
      border-color 0.25s;
  }

  .button::after {
    content: '';
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--button-icon-bg);
    transition:
      translate 0.3s,
      background-color 0.25s;
  }

  /* z-index: the circle moves on hover (translate), which would otherwise
     paint it over the arrow. */
  .button::before {
    content: '';
    position: absolute;
    z-index: 1;
    top: 50%;
    right: 18px;
    width: 16px;
    height: 16px;
    background: var(--button-icon-fg);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E")
      center / contain no-repeat;
    translate: 0 -50%;
    transition:
      translate 0.3s,
      background-color 0.25s;
  }

  .button:hover::after,
  .button:focus-visible::after {
    translate: 3px 0;
  }

  .button:hover::before,
  .button:focus-visible::before {
    translate: 3px -50%;
  }

  .button:hover {
    background: color-mix(in srgb, var(--theme-color-primary) 75%, #000);
  }

  .button--outline {
    --button-icon-bg: var(--theme-color-primary);
    border-color: var(--theme-color-primary);
    background: transparent;
    color: var(--theme-color-primary);
  }

  .button--outline:hover {
    --button-icon-bg: var(--theme-color-primary-foreground);
    --button-icon-fg: var(--theme-color-primary);
    background: var(--theme-color-primary);
    color: var(--theme-color-primary-foreground);
  }

  .button--light {
    --button-icon-bg: var(--theme-color-primary);
    background: var(--theme-color-contrast);
    color: var(--theme-color-primary);
  }

  .button--light:hover {
    background: #e7eeec;
  }

  .button--ghost-light {
    justify-content: center;
    padding-right: 26px;
    border-color: rgb(255 255 255 / 60%);
    background: transparent;
    color: var(--theme-color-contrast);
  }

  .button--ghost-light::before,
  .button--ghost-light::after {
    display: none;
  }

  .button--ghost-light:hover {
    border-color: var(--theme-color-contrast);
    background: rgb(255 255 255 / 12%);
  }

  /* Arrow pointing down (e.g. "Meer berichten laden"). */
  .button--down::before {
    rotate: 90deg;
  }

  .button--down:hover::before,
  .button--down:focus-visible::before {
    translate: 0 calc(-50% + 3px);
  }

  .button--down:hover::after,
  .button--down:focus-visible::after {
    translate: 0;
  }

  .button--small {
    gap: 12px;
    min-height: 44px;
    padding: 4px 5px 4px 20px;
    font-size: 0.875rem;
  }

  .button--small::after {
    width: 32px;
    height: 32px;
  }

  .button--small::before {
    right: 13px;
    width: 14px;
    height: 14px;
  }

  @media (width <= 35rem) {
    .button {
      width: 100%;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .button::before,
    .button::after {
      transition: none;
    }
  }

  .link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 500;
    font-size: var(--theme-font-size-sm);
    text-decoration: none;
  }

  .link-arrow--back::before {
    content: '\2190';
  }

  /* Page intro band for inner pages. */
  .page-hero {
    padding-block: calc(var(--theme-header-height) + var(--theme-space-lg)) var(--theme-space-lg);
    background: var(--theme-color-inverse);
    color: var(--theme-color-inverse-text);
  }

  /* Large page header (template-parts/page-header.php), after the Prime
     design: green band, faint P mark, back link, large title and intro. */
  .page-header {
    position: relative;
    overflow: hidden;
    padding-top: clamp(150px, 14vw, 200px);
    background: var(--theme-color-inverse);
    color: var(--theme-color-inverse-text);
  }

  .page-header__mark {
    position: absolute;
    top: 40px;
    right: -80px;
    width: 560px;
    max-width: none;
    opacity: 0.07;
    filter: brightness(0) invert(1);
    pointer-events: none;
  }

  .page-header__inner {
    position: relative;
    padding-bottom: clamp(56px, 6vw, 80px);
  }

  .page-header__lead + * {
    margin-top: clamp(40px, 5vw, 64px);
  }

  .page-header__back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    font-size: var(--theme-font-size-sm);
    font-weight: 500;
    text-decoration: none;
    opacity: 0.85;
  }

  .page-header__back:hover {
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 4px;
  }

  .page-header__title {
    margin-block: 22px 26px;
    font-size: clamp(2.5rem, 5vw, 4.25rem);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.035em;
  }

  .page-header__lead {
    max-width: 620px;
    font-size: clamp(1rem, 1.25vw, 1.125rem);
    font-weight: 300;
    line-height: 1.55;
    color: rgb(255 255 255 / 84%);
  }

  /* Same column as .container. */
  .page-hero__inner {
    width: min(100% - 2 * var(--theme-gutter), var(--theme-container));
    margin-inline: auto;
  }

  .page-hero__title {
    font-size: var(--theme-font-size-h1);
  }

  .page-hero__lead {
    margin-top: var(--theme-space-sm);
    font-size: var(--theme-font-size-lg);
    color: var(--theme-color-inverse-muted);
  }

  .classic-content a {
    color: var(--theme-color-primary);
    text-underline-offset: 0.2em;
  }

  .nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: var(--theme-space-lg);
  }

  .nav-links .page-numbers {
    display: grid;
    place-items: center;
    min-width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--theme-color-border);
    border-radius: var(--theme-radius-sm);
    text-decoration: none;
  }

  .nav-links .current {
    background: var(--theme-color-primary);
    border-color: var(--theme-color-primary);
    color: var(--theme-color-primary-foreground);
  }
}

@media (prefers-reduced-motion: reduce) {
  @layer base {
    *,
    *::before,
    *::after {
      transition-duration: 0.01ms !important;
      animation-duration: 0.01ms !important;
    }
  }
}
