@layer reset, global, compositions, utilities, blocks, exceptions;

@font-face {
  font-family: "Calistoga";
  src: url("/fonts/Calistoga-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Onest";
  src: url("/fonts/Onest.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, p, ol { margin: 0; }
  img { display: block; max-inline-size: 100%; }
}

@layer global {
  :root {
    --ink: #1c1a19;
    --ground: #ffffff;
    --muted: #5f5a56;
    --accent: oklch(0.55 0.19 33);
    --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    --step-4: clamp(2.5rem, 2rem + 2.5vw, 4rem);
    --space-s: clamp(0.75rem, 0.7rem + 0.25vw, 1rem);
    --space-l: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    --font-display: "Calistoga", Georgia, serif;
    --font-text: "Onest", system-ui, -apple-system, sans-serif;
    --gutter: clamp(1rem, 0.8rem + 1vw, 2rem);
    color-scheme: light;
  }

  body {
    min-block-size: 100vh;
    display: grid;
    place-items: center;
    padding: var(--gutter);
    background: var(--ground);
    color: var(--ink);
    font-family: var(--font-text);
    font-size: var(--step-0);
    line-height: 1.5;
  }

  h1 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: var(--step-4);
    line-height: 1.1;
  }

  p { color: var(--muted); }
}

@layer compositions {
  .center {
    max-inline-size: 40ch;
    text-align: center;
  }

  .flow > * + * { margin-block-start: var(--flow-space, var(--space-s)); }
}

@layer blocks {
  /* The app icon, masked the way the home screen shows it. */
  .app-icon {
    inline-size: clamp(6rem, 5rem + 5vw, 8rem);
    block-size: auto;
    margin-inline: auto;
    border-radius: 22.5%;
    --flow-space: 0;
  }

  .app-icon + h1 { --flow-space: var(--space-l); }

  /* A dictionary entry for the name, read left to right under the centered title. */
  .entry {
    --flow-space: var(--space-l);
    padding-block: var(--space-s);
    border-block: 1px solid color-mix(in oklch, var(--muted) 30%, transparent);
    text-align: start;
  }

  .entry > * { --flow-space: 0.5em; }

  .entry__head b {
    font-family: var(--font-display);
    font-weight: 400;
    color: var(--ink);
  }

  .entry__ipa { margin-inline: 0.25em; }

  .entry__senses {
    padding-inline-start: 1.5em;
    color: var(--muted);
  }

  .entry__senses li::marker {
    font-family: var(--font-display);
    color: var(--accent);
  }

  .entry + p { --flow-space: var(--space-l); }
}

@layer utilities {
  .accent { color: var(--accent); }
}
