/* ==========================================================================
   Agroly Lanka — Base
   Fonts, reset, elements, typography, utilities. Tokens only, no raw values.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. FONTS — self-hosted, variable, latin + latin-ext
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../assets/fonts/fraunces-300-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../assets/fonts/fraunces-300-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Nunito Sans";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../assets/fonts/nunito-sans-300-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito Sans";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../assets/fonts/nunito-sans-300-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --------------------------------------------------------------------------
   2. RESET
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

/* The reset above overrides the UA's `margin: auto` on <dialog>, which is the
   thing that centres a modal in the viewport. Without this, showModal() pins
   the dialog to the top-left corner. */
dialog { margin: auto; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--sp-11);
}

body {
  background-color: var(--clr-bg);
  color: var(--clr-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

img { height: auto; }

input,
button,
textarea,
select { font: inherit; color: inherit; }

button { background: none; border: none; cursor: pointer; }

ul, ol { list-style: none; padding: 0; }

a { color: inherit; text-decoration: none; }

:target { scroll-margin-top: var(--sp-11); }

/* --------------------------------------------------------------------------
   3. TYPOGRAPHY
   Headings are lowercase by house style — see .u-lower / heading defaults.
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-variation-settings: var(--font-display-soft);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
  text-transform: lowercase;
}

h1 { font-size: var(--fs-4xl); font-weight: var(--fw-medium); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-3xl); font-weight: var(--fw-medium); }
h3 { font-size: var(--fs-xl);  font-weight: var(--fw-semibold); }
h4 { font-size: var(--fs-lg);  font-weight: var(--fw-semibold); }

p { text-wrap: pretty; }

strong, b { font-weight: var(--fw-semibold); }

::selection {
  background-color: var(--c-sprout-pale);
  color: var(--c-forest-deep);
}

/* --------------------------------------------------------------------------
   4. FOCUS & ACCESSIBILITY
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--clr-focus);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

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

.skip-link {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: var(--z-modal);
  padding: var(--sp-3) var(--sp-5);
  background-color: var(--clr-primary);
  color: var(--clr-text-inverse);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  transform: translateY(-160%);
  transition: transform var(--dur-base) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(0); }

/* --------------------------------------------------------------------------
   5. LAYOUT UTILITIES
   -------------------------------------------------------------------------- */
.shell {
  width: 100%;
  max-width: var(--w-page);
  margin-inline: auto;
  padding-inline: var(--sp-gutter);
}
.shell--wide   { max-width: var(--w-wide); }
.shell--narrow { max-width: var(--w-content); }

.section { position: relative; padding-block: var(--sp-section); }
.section--tight { padding-block: var(--sp-section-tight); }
.section--flush-top { padding-block-start: 0; }

.u-prose  { max-width: var(--w-prose); }
.u-narrow { max-width: var(--w-narrow); }
.u-center { margin-inline: auto; text-align: center; }

/* --------------------------------------------------------------------------
   6. TEXTURE OVERLAYS
   -------------------------------------------------------------------------- */
.grain { position: relative; }
.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--tex-grain);
  background-size: var(--tex-size);
  background-repeat: repeat;
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: var(--z-base);
}
.grain--dark::after {
  opacity: var(--grain-opacity-dark);
  mix-blend-mode: overlay;
}
.grain > * { position: relative; z-index: var(--z-raised); }

/* --------------------------------------------------------------------------
   7. MOTION — reveal on scroll, gentle and slow
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(var(--sp-6));
  transition:
    opacity var(--dur-slower) var(--ease-out),
    transform var(--dur-slower) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-visible { opacity: 1; transform: none; }

@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;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
