/* ==========================================================================
   JOTL — base.css
   Self-hosted fonts, reset, and base typography.
   Depends on tokens.css being loaded first.

   Contents
     1. @font-face  — Playfair Display (display) + Plus Jakarta Sans (body)
     2. Reset
     3. Document and body defaults
     4. Headings and the type scale
     5. Body copy, links, lists
     6. Media and embeds
     7. Long-form prose (blog posts, policies, rendered markdown)
     8. Forms — element defaults only; control styling lives in components.css
     9. Focus, selection, skip link
    10. Layout utilities
    11. Reduced motion and print
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. @font-face

   Both families are self-hosted variable woff2, latin + latin-ext only.
   Six files, 168 KB total. No Google Fonts request at runtime — that keeps
   the site free of third-party connections and means the fonts are covered
   by the same privacy stance as the rest of the site.

   Available weights are 400–700 for both families. Anything outside that
   range is synthesised by the browser, so do not ask for it.
   -------------------------------------------------------------------------- */

/* Playfair Display — normal */
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/playfair-display-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: "Playfair Display";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/playfair-display-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;
}

/* Playfair Display — italic (used for pull quotes and editorial asides) */
@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/playfair-display-italic-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: "Playfair Display";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/playfair-display-italic-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;
}

/* Plus Jakarta Sans — normal. No italic: the body face has no italic cut in
   use anywhere in the design, and one is not worth 60 KB. */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/plus-jakarta-sans-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: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/plus-jakarta-sans-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;
}

html {
  /* Anchor targets clear the sticky header instead of hiding beneath it. */
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

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

svg {
  fill: currentColor;
}

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

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

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

hr {
  border: 0;
  height: var(--border-width);
  background: var(--border);
}

[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   3. Document and body defaults
   -------------------------------------------------------------------------- */

html {
  font-family: var(--font-body);
  font-size: 100%;
  line-height: var(--type-body-md-lh);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--type-body-md);
  font-weight: var(--weight-regular);
  line-height: var(--type-body-md-lh);
  color: var(--text);
  background-color: var(--bg);
  /* Theme changes fade rather than snap. Colour only: fading property
     "all" here would smear every component's own transitions. */
  transition:
    background-color var(--dur-base) var(--ease-standard),
    color var(--dur-base) var(--ease-standard);
}

/* --------------------------------------------------------------------------
   4. Headings and the type scale

   Mobile values first, desktop values from 768px up. Every heading is
   Playfair Display; every non-heading is Plus Jakarta Sans. Nothing renders
   below 400 weight, because the variable range starts there.
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-regular);
  color: var(--text);
  text-wrap: balance;
}

h1 {
  font-size: var(--type-display-hero-mobile);
  line-height: var(--type-display-hero-mobile-lh);
  letter-spacing: var(--type-display-hero-ls);
}

h2 {
  font-size: var(--type-headline-lg-mobile);
  line-height: var(--type-headline-lg-mobile-lh);
  letter-spacing: var(--type-headline-lg-ls);
}

h3 {
  font-size: var(--type-headline-md);
  line-height: var(--type-headline-md-lh);
  letter-spacing: -0.01em;
}

h4 {
  font-size: var(--type-headline-sm);
  line-height: var(--type-headline-sm-lh);
  font-weight: var(--type-headline-sm-weight);
}

h5 {
  font-family: var(--font-body);
  font-size: var(--type-label-md);
  line-height: var(--type-label-md-lh);
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
}

h6 {
  font-family: var(--font-body);
  font-size: var(--type-label-sm);
  line-height: var(--type-label-sm-lh);
  font-weight: var(--type-label-sm-weight);
  letter-spacing: var(--type-label-sm-ls);
  text-transform: uppercase;
}

@media (min-width: 768px) {
  h1 {
    font-size: var(--type-display-hero);
    line-height: var(--type-display-hero-lh);
  }

  h2 {
    font-size: var(--type-headline-lg);
    line-height: var(--type-headline-lg-lh);
  }
}

/* Utility classes for cases where the element name and the visual size
   diverge — an h2 that must read as a hero, a p that must read as a label. */
.t-display-hero {
  font-family: var(--font-display);
  font-size: var(--type-display-hero-mobile);
  line-height: var(--type-display-hero-mobile-lh);
  letter-spacing: var(--type-display-hero-ls);
}

/* Between the home hero and a section heading: the shop's page title. */
.t-display-sm {
  font-family: var(--font-display);
  font-size: var(--type-headline-lg-mobile);
  line-height: 1.12;
  letter-spacing: var(--type-headline-lg-ls);
  font-weight: var(--weight-regular, 400);
  color: var(--on-surface);
}

@media (min-width: 768px) {
  .t-display-sm {
    font-size: var(--type-display-hero-mobile);
    line-height: 1.08;
  }
}

.t-headline-lg {
  font-family: var(--font-display);
  font-size: var(--type-headline-lg-mobile);
  line-height: var(--type-headline-lg-mobile-lh);
  letter-spacing: var(--type-headline-lg-ls);
}

.t-headline-md {
  font-family: var(--font-display);
  font-size: var(--type-headline-md);
  line-height: var(--type-headline-md-lh);
}

.t-headline-sm {
  font-family: var(--font-display);
  font-size: var(--type-headline-sm);
  line-height: var(--type-headline-sm-lh);
  font-weight: var(--type-headline-sm-weight);
}

.t-body-lg {
  font-family: var(--font-body);
  font-size: var(--type-body-lg);
  line-height: var(--type-body-lg-lh);
}

.t-body-md {
  font-family: var(--font-body);
  font-size: var(--type-body-md);
  line-height: var(--type-body-md-lh);
}

.t-body-sm {
  font-family: var(--font-body);
  font-size: var(--type-body-sm);
  line-height: var(--type-body-sm-lh);
}

.t-label-md {
  font-family: var(--font-body);
  font-size: var(--type-label-md);
  line-height: var(--type-label-md-lh);
  font-weight: var(--type-label-md-weight);
}

.t-label-sm {
  font-family: var(--font-body);
  font-size: var(--type-label-sm);
  line-height: var(--type-label-sm-lh);
  font-weight: var(--type-label-sm-weight);
  letter-spacing: var(--type-label-sm-ls);
  text-transform: uppercase;
}

/* The apothecary eyebrow — the small uppercase gold line above section
   headings. Always Plus Jakarta Sans, always tracked out. */
.t-eyebrow {
  font-family: var(--font-body);
  font-size: var(--type-label-apothecary);
  line-height: var(--type-label-apothecary-lh);
  font-weight: var(--type-label-apothecary-weight);
  letter-spacing: var(--type-label-apothecary-ls);
  text-transform: uppercase;
  color: var(--gold-text);
}

@media (min-width: 768px) {
  .t-display-hero {
    font-size: var(--type-display-hero);
    line-height: var(--type-display-hero-lh);
  }

  .t-headline-lg {
    font-size: var(--type-headline-lg);
    line-height: var(--type-headline-lg-lh);
  }
}

/* --------------------------------------------------------------------------
   5. Body copy, links, lists
   -------------------------------------------------------------------------- */

p {
  font-size: var(--type-body-md);
  line-height: var(--type-body-md-lh);
  color: var(--text);
  text-wrap: pretty;
}

p + p {
  margin-top: var(--space-3);
}

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

small {
  font-size: var(--type-body-sm);
  line-height: var(--type-body-sm-lh);
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease-standard);
}

a:hover {
  color: var(--link-hover);
}

/* Components that are links but not underlined — buttons, cards, nav. They
   carry their own affordance, so the default underline would be noise. */
a.u-plain {
  text-decoration: none;
  color: inherit;
}

ul,
ol {
  padding-left: var(--space-4);
}

li + li {
  margin-top: var(--space-1);
}

dl {
  margin: 0;
}

dt {
  font-weight: var(--weight-semibold);
}

dd {
  margin: 0 0 var(--space-2) 0;
}

blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--type-headline-sm);
  line-height: var(--type-headline-sm-lh);
  padding-left: var(--space-4);
  border-left: var(--border-width-strong) solid var(--gold-decor);
  color: var(--text);
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

pre {
  overflow-x: auto;
  padding: var(--space-3);
  background: var(--bg-inset);
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   6. Media and embeds
   -------------------------------------------------------------------------- */

img {
  height: auto;
  /* Product and editorial photography in this project is photographic, so a
     hairline keeps pale images from bleeding into the cream surface. */
  background-color: var(--bg-inset);
}

figure {
  margin: 0;
}

figcaption {
  margin-top: var(--space-2);
  font-size: var(--type-body-sm);
  line-height: var(--type-body-sm-lh);
  color: var(--text-muted);
}

iframe {
  max-width: 100%;
  border: 0;
}

/* A responsive frame for the Calendly embed, video and maps. */
.embed {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-inset);
}

.embed--16x9 {
  aspect-ratio: 16 / 9;
}

.embed > iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   7. Long-form prose — blog posts, policy pages, rendered markdown

   `marked.parse()` output from content/blog-posts.json lands inside
   .prose, so this block has to cover everything a normal Markdown document
   can produce. Elements are styled through :where() to keep specificity flat
   and let component classes win without !important.
   -------------------------------------------------------------------------- */

.prose {
  max-width: var(--measure);
  font-size: var(--type-body-lg);
  line-height: var(--type-body-lg-lh);
  color: var(--text);
}

.prose > * + * {
  margin-top: var(--space-3);
}

.prose :where(h2) {
  margin-top: var(--space-5);
  font-size: var(--type-headline-md);
  line-height: var(--type-headline-md-lh);
}

.prose :where(h3) {
  margin-top: var(--space-4);
  font-size: var(--type-headline-sm);
  line-height: var(--type-headline-sm-lh);
  font-weight: var(--weight-semibold);
}

.prose :where(h4, h5, h6) {
  margin-top: var(--space-4);
  font-family: var(--font-body);
  font-size: var(--type-label-sm);
  line-height: var(--type-label-sm-lh);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--type-label-sm-ls);
  text-transform: uppercase;
  color: var(--text-muted);
}

.prose :where(ul, ol) {
  padding-left: var(--space-4);
}

.prose :where(li + li) {
  margin-top: var(--space-2);
}

.prose :where(blockquote) {
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

.prose :where(img) {
  border-radius: var(--radius-md);
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

.prose :where(table) {
  width: 100%;
  font-size: var(--type-body-md);
  line-height: var(--type-body-md-lh);
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

.prose :where(th, td) {
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--border-width) solid var(--border);
  text-align: left;
  vertical-align: top;
}

.prose :where(th) {
  font-family: var(--font-body);
  font-size: var(--type-label-sm);
  letter-spacing: var(--type-label-sm-ls);
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom-color: var(--border-strong);
}

/* Tables are the one thing that cannot wrap gracefully on a phone. Wrap them
   in .prose__table-scroll when rendered, or accept horizontal scroll here. */
.prose :where(table):not(:where(.prose__table-scroll table)) {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

.prose :where(hr) {
  margin-top: var(--space-5);
  margin-bottom: var(--space-5);
}

.prose :where(a) {
  color: var(--link);
}

/* The regulatory footer that every product page and policy page carries. */
.note {
  font-size: var(--type-body-sm);
  line-height: var(--type-body-sm-lh);
  color: var(--text-muted);
}

.note--bordered {
  padding: var(--space-3);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
}

/* --------------------------------------------------------------------------
   8. Forms — element defaults only
   -------------------------------------------------------------------------- */

input,
textarea,
select {
  background-color: var(--bg-raised);
  color: var(--text);
  border: var(--border-width) solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  min-height: var(--control-height-md);
  transition:
    border-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard);
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

select {
  cursor: pointer;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

/* iOS zooms the viewport when a focused control is under 16px. */
@media (max-width: 767px) {
  input,
  textarea,
  select {
    font-size: 16px;
  }
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

legend {
  padding: 0;
  font-family: var(--font-body);
  font-size: var(--type-label-md);
  font-weight: var(--weight-semibold);
}

label {
  display: block;
  font-size: var(--type-label-md);
  line-height: var(--type-label-md-lh);
  font-weight: var(--type-label-md-weight);
  color: var(--text-muted);
}

/* A required field is marked in the label text, not only by colour. */
label[data-required]::after {
  content: " *";
  color: var(--error);
}

::placeholder {
  font-size: var(--type-body-md);
}

/* Chrome's autofill yellow ignores the theme. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-raised) inset;
  transition: background-color 9999s ease-in-out 0s;
}

/* --------------------------------------------------------------------------
   9. Focus, selection, skip link
   -------------------------------------------------------------------------- */

:focus {
  outline: none;
}

:focus-visible {
  outline: var(--focus-width) solid var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-xs);
}

/* Windows high-contrast mode strips box shadows and outlines; force a
   visible system-coloured ring so focus never disappears there. */
@media (forced-colors: active) {
  :focus-visible {
    outline: var(--focus-width) solid Highlight;
  }
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-text);
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-skip-link);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-raised);
  color: var(--text);
  border: var(--border-width) solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--type-label-md);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-standard);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   10. Layout utilities
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container-lg);
  margin-inline: auto;
  padding-inline: var(--margin-mobile);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--gutter-md);
  }
}

@media (min-width: 1024px) {
  .container {
    padding-inline: var(--margin-desktop);
  }
}

.container--narrow {
  max-width: var(--container-md);
}

.container--wide {
  max-width: var(--container-xl);
}

/* Available to screen readers, not to sighted users. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Same, but becomes visible when it receives keyboard focus — used for the
   skip link inside layout wrappers where positioning is relative. */
.visually-hidden-focusable:not(:focus):not(:focus-visible) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.stack > * + * {
  margin-top: var(--space-3);
}

.stack-lg > * + * {
  margin-top: var(--space-5);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.text-muted {
  color: var(--text-muted);
}

.text-center {
  text-align: center;
}

/* --------------------------------------------------------------------------
   11. Reduced motion and print
   -------------------------------------------------------------------------- */

/* Tokens already collapse durations under reduced motion. This catches the
   scrolling-specific pieces that tokens cannot express. */
@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;
  }
}

/* Smooth scrolling is an enhancement, never the default. */
@media (prefers-reduced-motion: no-preference) {
  html:focus-within {
    scroll-behavior: smooth;
  }
}

@media print {
  body {
    background: #FFFFFF;
    color: #000000;
    font-size: 11pt;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #555555;
  }

  .skip-link,
  .visually-hidden {
    display: none !important;
  }
}
