/*
  Wärmeliefergemeinschaft Ungerdorf
  Layers run lowest to highest priority; specificity only matters within a layer.
*/
@layer reset, tokens, base, layout, components;


/* ---------- Reset ---------- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, dl, dd, ul, address, figure { margin: 0; }
  ul { padding: 0; list-style: none; }
  img, picture { display: block; max-width: 100%; }
  address { font-style: normal; }
}


/* ---------- Design tokens ---------- */
@layer tokens {
  @font-face {
    font-family: "Archivo";
    src: url("/fonts/archivo.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
  }
  @font-face {
    font-family: "IBM Plex Mono";
    src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
  }
  @font-face {
    font-family: "IBM Plex Mono";
    src: url("/fonts/ibm-plex-mono-500.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
  }

  :root {
    /* Colour */
    --color-paper: #f6f0e6;
    --color-white: #ffffff;
    --color-ink: #191c19;
    --color-text: #474c46;
    --color-muted: #5b605a;
    --color-rule: #d6d8d3;
    --color-accent: #b8431e;
    --color-forest: #1f3a2f;
    --color-forest-rule: #37574a;
    --color-amber: #f3c38c;
    --color-on-forest: #e6ebe6;
    --color-on-forest-muted: #bccbc1;

    /* Type */
    --font-sans: "Archivo", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;
    --text-sm: 0.875rem;   /* 14px */
    --text-md: 1.0625rem;  /* 17px */
    --text-lg: 1.1875rem;  /* 19px */

    /* Space */
    --container: 1120px;
    --gutter: clamp(20px, 5vw, 48px);
    --section-space: clamp(64px, 9vw, 112px);
  }
}


/* ---------- Base elements ---------- */
@layer base {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  @media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
  }

  body {
    background: var(--color-paper);
    color: var(--color-ink);
    font-family: var(--font-sans);
    font-size: var(--text-md);
    line-height: 1.55;
  }

  h1, h2, h3 {
    font-weight: 600;
    line-height: 1.1;
    text-wrap: balance;
    hyphens: auto;
  }

  p { text-wrap: pretty; }

  a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
  }
  a:hover { color: var(--color-accent); }
  a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
  }

  [id] { scroll-margin-top: 24px; }

  .mono { font-family: var(--font-mono); }
}


/* ---------- Layout ---------- */
@layer layout {
  .container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  /* The header floats over the hero photo. */
  .site-header {
    position: absolute;
    inset: 0 0 auto;
    z-index: 1;
    max-width: var(--container);
    margin-inline: auto;
    padding: 16px var(--gutter);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0 32px;
    color: var(--color-paper);

    & a { text-decoration: none; }
    & a:hover { color: var(--color-amber); }
  }

  .site-header__brand {
    padding-block: 12px;
    font-weight: 700;
  }

  .site-header__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0 28px;
    font-size: 0.9375rem;

    /* Keeps touch targets at least 44px tall. */
    & a { display: inline-block; padding-block: 12px; }
  }

  .site-footer {
    margin-top: clamp(80px, 10vw, 128px);
    background: var(--color-forest);
    color: var(--color-on-forest);
    font-size: 0.9375rem;

    & h2 {
      margin-bottom: 12px;
      font-size: inherit;
      color: var(--color-white);
    }
    & a:hover { color: var(--color-amber); }
  }

  .site-footer__columns {
    padding-block: 56px 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 40px;
    color: #c4c7c1;

    & .mono { font-size: var(--text-sm); }
    & li { padding-block: 4px; }
  }

  .site-footer__copyright {
    padding-block: 20px 32px;
    border-top: 1px solid var(--color-forest-rule);
    font-size: 0.8125rem;
    color: #b0c2b7;
  }
}


/* ---------- Components ---------- */
@layer components {
  .eyebrow {
    margin-bottom: 20px;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .eyebrow--muted {
    margin-bottom: 8px;
    color: var(--color-muted);
  }

  .section-title {
    margin-bottom: 40px;
    font-size: clamp(1.75rem, 3.4vw, 2.5rem);
    letter-spacing: -0.02em;
  }

  .button {
    display: inline-block;
    padding: 14px 22px;
    border-radius: 2px;
    background: var(--color-accent);
    color: var(--color-white);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;

    &:hover { color: var(--color-white); background: #9c3818; }
  }


  /* Hero: full-bleed forest photo, text sits on the darkened lower part. */
  .hero {
    position: relative;
    isolation: isolate;
    min-height: clamp(560px, 100svh, 900px);
    display: flex;
    align-items: flex-end;
    background: var(--color-forest);
    color: var(--color-paper);

    /* Darkens the top for the header and the bottom for the text. */
    &::after {
      content: "";
      position: absolute;
      inset: 0;
      z-index: -1;
      background: linear-gradient(
        to bottom,
        rgb(15 28 22 / 0.55) 0%,
        rgb(15 28 22 / 0) 22%,
        rgb(15 28 22 / 0) 38%,
        rgb(15 28 22 / 0.85) 100%
      );
    }

    & .eyebrow { color: var(--color-amber); }
  }

  .hero__image {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 55%;
  }

  .hero__content {
    padding-block: 140px clamp(48px, 7vw, 88px);
  }

  .hero__title {
    max-width: 13ch;
    font-size: clamp(2.5rem, 6.4vw, 5.25rem);
    line-height: 1.02;
    letter-spacing: -0.03em;
    color: var(--color-white);
  }

  .hero__intro {
    margin-top: 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 24px 48px;
    color: #e3e8e2;

    & p { max-width: 46ch; }
  }


  /* Stats band */
  .stats {
    background: var(--color-forest);
    color: var(--color-on-forest-muted);
  }

  .stats__grid {
    padding-block: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .stat {
    padding: 24px 16px 24px 0;
    display: flex;
    flex-direction: column-reverse; /* value above label, label read first */
  }

  .stat__label { font-size: var(--text-sm); }

  .stat__value {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 3vw, 2.125rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--color-amber);
  }


  /* Plants list */
  .plants {
    padding-block: var(--section-space);
    background: var(--color-white);
  }

  .plant {
    padding-block: 28px 32px;
    border-top: 1px solid var(--color-rule);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 12px 40px;

    &:first-of-type { border-top-color: var(--color-ink); }
    &:last-of-type { border-bottom: 1px solid var(--color-ink); }
  }

  .plant__year {
    flex: 0 0 96px;
    font-family: var(--font-mono);
    font-weight: 500;
    line-height: 1.2;
    color: var(--color-accent);
  }

  .plant__summary {
    flex: 1 1 260px;
    min-width: 0;
  }

  .plant__name {
    margin-bottom: 6px;
    font-size: 1.5rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
  }

  .plant__supplies {
    margin-bottom: 10px;
    color: var(--color-text);
  }

  .plant__boiler {
    font-size: var(--text-sm);
    color: var(--color-muted);
  }

  .plant__specs {
    flex: 1.3 1 340px;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 24px;
    font-size: var(--text-sm);

    & dt { color: var(--color-muted); }
    & dd { font-family: var(--font-mono); font-size: 1rem; }
  }


  /* Contact */
  .contact {
    padding-top: var(--section-space);
    display: flex;
    flex-wrap: wrap;
    gap: 48px 64px;

    & .section-title { margin-bottom: 20px; }
  }

  .contact__main {
    flex: 1 1 320px;
    min-width: 0;
  }

  .contact__people {
    flex: 1.4 1 420px;
    min-width: 0;
  }

  .contact__lead {
    max-width: 36ch;
    margin-bottom: 24px;
    color: var(--color-text);
  }

  .contact__direct {
    font-size: var(--text-lg);
    line-height: 1.7;
  }

  .contact__phone { font-weight: 600; }

  .contact__address {
    margin-top: 24px;
    color: var(--color-text);
  }

  .person {
    padding-block: 16px;
    border-top: 1px solid var(--color-rule);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 4px 24px;

    &:last-child { border-bottom: 1px solid var(--color-rule); }
  }

  .person__name { font-weight: 600; }

  .person__role,
  .person__email {
    font-size: 0.9375rem;
    color: var(--color-muted);
  }
  .person__email { color: inherit; }
}
