/* ==========================================================================
   Wellnest — base.css
   Tokens, reset, typography, buttons, forms, utilities.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* surfaces */
  --cream: #faf4ea;
  --cream-2: #f4ead9;
  --sand: #f1e4d3;
  --paper: #fffcf6;
  --espresso: #2b1f17;
  --espresso-2: #3a2a1e;

  /* ink */
  --ink: #241a12;
  --ink-2: #4a3a2c;
  --muted: #7d6b59;
  --muted-2: #9a8874;

  /* accents */
  --gold: #b08d57;
  --gold-soft: #d9c3a0;
  --clay: #c4714a;
  --clay-dark: #a85b37;
  --sage: #71855f;
  --sage-soft: #e7ecdf;
  --rust: #a8553c;
  --rust-soft: #f4e2da;

  /* lines */
  --line: rgba(43, 31, 23, 0.14);
  --line-soft: rgba(43, 31, 23, 0.08);
  --line-strong: rgba(43, 31, 23, 0.3);
  --line-light: rgba(250, 244, 234, 0.22);

  /* type */
  --display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Jost", "Avenir Next", "Segoe UI", system-ui, sans-serif;

  --fs-display: clamp(2.9rem, 7.4vw, 6.4rem);
  --fs-h2: clamp(2rem, 4.2vw, 3.5rem);
  --fs-h3: clamp(1.4rem, 2vw, 1.85rem);
  --fs-lead: clamp(1.06rem, 1.5vw, 1.3rem);
  --fs-body: 1.0625rem;
  --fs-sm: 0.9375rem;
  --fs-xs: 0.8125rem;

  /* layout */
  --page: 1360px;
  --gutter: clamp(1.25rem, 5vw, 4.5rem);
  --gap: clamp(1.5rem, 3vw, 2.75rem);
  --section: clamp(4.5rem, 9vw, 9.5rem);
  --radius: 3px;
  --radius-lg: 6px;

  /* motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* elevation */
  --shadow-sm: 0 1px 2px rgba(43, 31, 23, 0.06);
  --shadow-md: 0 18px 50px -28px rgba(43, 31, 23, 0.45);
  --shadow-lg: 0 40px 90px -50px rgba(43, 31, 23, 0.55);
}

/* dark sections flip the ink tokens */
.on-dark {
  --ink: #f8f1e5;
  --ink-2: #e2d5c4;
  --muted: #bda98f;
  --muted-2: #a08c74;
  --line: rgba(250, 244, 234, 0.2);
  --line-soft: rgba(250, 244, 234, 0.1);
  --line-strong: rgba(250, 244, 234, 0.34);
  color: var(--ink);
}

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--cream);
}

body {
  font-family: var(--sans);
  font-weight: 300;
  font-size: var(--fs-body);
  line-height: 1.7;
  color: var(--ink-2);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

body.is-locked {
  overflow: hidden;
}

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

img {
  height: auto;
  background: var(--cream-2);
}

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

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

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

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

h1,
h2,
h3,
h4 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-display);
  font-weight: 300;
}

h2 {
  font-size: var(--fs-h2);
}

h3 {
  font-size: var(--fs-h3);
  line-height: 1.2;
}

p {
  text-wrap: pretty;
}

::selection {
  background: var(--gold-soft);
  color: var(--espresso);
}

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

.on-dark :focus-visible {
  outline-color: var(--gold-soft);
}

/* ---------- Layout helpers ---------- */
.wrap {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow {
  max-width: 900px;
}

.section {
  padding-block: var(--section);
}

.section--tight {
  padding-block: clamp(3rem, 6vw, 6rem);
}

.section--paper {
  background: var(--paper);
}

.section--sand {
  background: var(--sand);
}

.section--dark {
  background: var(--espresso);
  color: #f5ece0;
}

.rule {
  height: 1px;
  background: var(--line);
  border: 0;
}

/* ---------- Type helpers ---------- */
.eyebrow {
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.eyebrow::before {
  content: "";
  width: 2.2rem;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
  flex: none;
}

.eyebrow--plain::before {
  display: none;
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.65;
  color: var(--ink-2);
  font-weight: 300;
}

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

.serif-accent {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.08em;
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--clay);
  --btn-fg: #fff8f0;
  --btn-bd: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.95rem 1.7rem;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  transition: background 0.35s var(--ease), color 0.35s var(--ease),
    border-color 0.35s var(--ease), transform 0.35s var(--ease);
  white-space: nowrap;
}

.btn:hover {
  --btn-bg: var(--clay-dark);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn svg {
  width: 1rem;
  height: 1rem;
  flex: none;
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bd: var(--line-strong);
}

.btn--ghost:hover {
  --btn-bg: var(--ink);
  --btn-fg: var(--cream);
  --btn-bd: var(--ink);
}

.btn--light {
  --btn-bg: transparent;
  --btn-fg: #fdf6ea;
  --btn-bd: rgba(253, 246, 234, 0.45);
}

.btn--light:hover {
  --btn-bg: #fdf6ea;
  --btn-fg: var(--espresso);
  --btn-bd: #fdf6ea;
}

.btn--solid-light {
  --btn-bg: #fdf6ea;
  --btn-fg: var(--espresso);
}

.btn--solid-light:hover {
  --btn-bg: #fff;
  --btn-fg: var(--espresso);
}

.btn--sm {
  padding: 0.7rem 1.15rem;
  font-size: 0.78rem;
}

.btn--block {
  width: 100%;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 0.3s var(--ease), gap 0.3s var(--ease);
}

.link-arrow:hover {
  gap: 0.9rem;
  border-color: var(--clay);
  color: var(--clay-dark);
}

.link-arrow svg {
  width: 0.95rem;
  height: 0.95rem;
}

/* ---------- Forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field > label,
.field__label {
  font-size: 0.78rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="date"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  padding: 0.85rem 0.95rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 300;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  appearance: none;
}

.field textarea {
  resize: vertical;
  min-height: 6rem;
  line-height: 1.6;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted-2);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(176, 141, 87, 0.16);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--rust);
  box-shadow: 0 0 0 3px rgba(168, 85, 60, 0.12);
}

.field__error {
  font-size: 0.8rem;
  color: var(--rust);
  display: none;
}

.field__error.is-visible {
  display: block;
}

.hint {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

.check {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-2);
  cursor: pointer;
}

.check input {
  appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  margin-top: 0.15rem;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--paper);
  cursor: pointer;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}

.check input:checked {
  background: var(--clay);
  border-color: var(--clay);
}

.check input:checked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff8f0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-6.5'/%3E%3C/svg%3E")
    center / 0.85rem no-repeat;
}

/* ---------- Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
  will-change: opacity, transform;
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

.reveal[data-delay="1"] {
  transition-delay: 0.08s;
}
.reveal[data-delay="2"] {
  transition-delay: 0.16s;
}
.reveal[data-delay="3"] {
  transition-delay: 0.24s;
}
.reveal[data-delay="4"] {
  transition-delay: 0.32s;
}

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 999;
  padding: 0.7rem 1.1rem;
  background: var(--espresso);
  color: var(--cream);
  border-radius: 3px;
  font-size: 0.85rem;
  transform: translateY(-200%);
  transition: transform 0.25s var(--ease);
}

.skip-link:focus {
  transform: none;
}

.hide {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
