/* =========================================================================
   OWILI — design system
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. Fonts — STIX Two Text (self-hosted, latin + latin-ext)
   ---------------------------------------------------------------------- */

@font-face {
  font-family: "STIX Two Text";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/stix-two-text-v18-latin_latin-ext-regular.woff2")
    format("woff2");
}

@font-face {
  font-family: "STIX Two Text";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/stix-two-text-v18-latin_latin-ext-italic.woff2")
    format("woff2");
}

@font-face {
  font-family: "STIX Two Text";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/stix-two-text-v18-latin_latin-ext-500.woff2") format("woff2");
}

@font-face {
  font-family: "STIX Two Text";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/stix-two-text-v18-latin_latin-ext-500italic.woff2")
    format("woff2");
}

@font-face {
  font-family: "STIX Two Text";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/stix-two-text-v18-latin_latin-ext-600.woff2") format("woff2");
}

@font-face {
  font-family: "STIX Two Text";
  font-style: italic;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/stix-two-text-v18-latin_latin-ext-600italic.woff2")
    format("woff2");
}

/* -------------------------------------------------------------------------
   2. Tokens
   ---------------------------------------------------------------------- */

:root {
  /* --- Colour: the three brand values --------------------------------- */
  --color-background: hsl(173 36% 91%);
  --color-foreground: hsl(173 79% 14%);
  --color-accent: hsl(324 70% 32%);

  /* --- Colour: derived, same hues ------------------------------------- */
  --color-surface: hsl(173 36% 96%);
  --color-border: hsl(173 24% 78%);
  --color-muted: hsl(173 25% 34%);
  --color-accent-soft: hsl(324 45% 92%);
  --color-focus: var(--color-accent);

  /* --- Typography ------------------------------------------------------ */
  --font-serif: "STIX Two Text", Georgia, "Times New Roman", serif;
  --font-body: var(--font-serif);

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  /* Fluid scale, 320px → 1280px viewport */
  --text-sm: clamp(0.875rem, 0.84rem + 0.17vw, 0.9375rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1.03rem + 0.47vw, 1.4375rem);
  --text-xl: clamp(1.375rem, 1.19rem + 0.92vw, 2rem);
  --text-2xl: clamp(1.75rem, 1.4rem + 1.75vw, 2.9375rem);
  --text-3xl: clamp(2.25rem, 1.65rem + 3vw, 4.25rem);

  --leading-tight: 1.1;
  --leading-snug: 1.3;
  --leading-normal: 1.6;
  --tracking-tight: -0.01em;
  --tracking-wide: 0.08em;

  /* --- Space (0.25rem base) -------------------------------------------- */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;

  /* --- Layout ---------------------------------------------------------- */
  --measure: 62ch;
  --width-content: 68rem;
  --gutter: clamp(1.25rem, 5vw, 4rem);

  /* --- Shape & motion --------------------------------------------------- */
  --radius-sm: 0.25rem;
  --radius-md: 0.75rem;
  --radius-full: 9999px;
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --duration: 400ms;
}

/* -------------------------------------------------------------------------
   3. Reset & base
   ---------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  background-color: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1,
h2,
h3 {
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: var(--weight-semibold);
  text-wrap: balance;
}

p {
  max-width: var(--measure);
  text-wrap: pretty;
}

a {
  color: var(--color-accent);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}

::selection {
  background-color: var(--color-accent);
  color: var(--color-surface);
}

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

/* -------------------------------------------------------------------------
   4. Utilities
   ---------------------------------------------------------------------- */

.visually-hidden:not(:focus):not(:active) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* -------------------------------------------------------------------------
   5. Container
   ---------------------------------------------------------------------- */

.container {
  max-width: min(100%, 800px);
  margin-inline: auto;
}

/* -------------------------------------------------------------------------
   5. Hero
   ---------------------------------------------------------------------- */

.hero {
  /* Intrinsic proportions of owili-hello.svg (1352 × 894). */
  --mark-ratio: 1.5123;
  --hero-padding-block: clamp(1.25rem, 4vh, var(--space-lg));
  --fold-height: calc(100svh - (2 * var(--hero-padding-block)));

  display: grid;
  place-items: center;
  /* Fills the viewport so the mark is the whole of the fold. */
  min-height: 100svh;
  padding: var(--hero-padding-block) var(--gutter);
}

.hero__mark {
  /* Grow into whatever the fold allows: bounded by the width of the padding
     box, or by the height budget converted to a width through the drawing's
     own aspect ratio — whichever binds first. No fixed cap, so the mark
     scales up on large displays instead of stranding itself mid-screen. */
  width: min(100%, calc(var(--fold-height) * var(--mark-ratio)));
  height: auto;

  animation: mark-in var(--duration) var(--ease-out) both;
}

@keyframes mark-in {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
}

@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;
  }
}
