/* =========================================================
   Casa Verde Press — foundations
   Shared by the public site and the owner dashboard.
   ========================================================= */

:root {
  /* Palette — sampled from the Casa Verde Press logo */
  --cream: #faf5ef;          /* logo paper */
  --cream-2: #f3ece1;
  --cream-3: #ebe2d3;
  --paper: #fffcf7;
  --olive: #4e5936;          /* logo ink */
  --olive-deep: #3b4429;
  --forest: #2c331f;
  --sage: #b7c09a;
  --sage-soft: #e4e7d4;
  --matcha: #8a9a5b;
  --clay: #9c5a37;
  --text: #24271d;
  --text-muted: #5b5e4d;
  --line: #d9cfbf;
  --line-strong: #b9ae99;
  --danger: #9e3426;
  --danger-soft: #f6e3dd;
  --ok: #3f6b33;
  --ok-soft: #e1ecd8;
  --warn: #8a5a12;
  --warn-soft: #f6ead2;

  /* Type */
  --font-display: "Cormorant", "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Jost", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;

  --step--1: clamp(0.84rem, 0.82rem + 0.1vw, 0.9rem);
  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.08rem);
  --step-1: clamp(1.2rem, 1.12rem + 0.4vw, 1.4rem);
  --step-2: clamp(1.5rem, 1.33rem + 0.85vw, 2rem);
  --step-3: clamp(1.9rem, 1.6rem + 1.5vw, 2.9rem);
  --step-4: clamp(2.4rem, 1.9rem + 2.6vw, 4.2rem);

  /* Space */
  --gutter: clamp(1.1rem, 0.7rem + 2vw, 2.5rem);
  --section: clamp(4rem, 3rem + 5vw, 8rem);
  --radius: 3px;
  --max: 76rem;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --focus: 0 0 0 3px var(--cream), 0 0 0 5px var(--olive);

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  font-variant-numeric: lining-nums;
  background: var(--cream);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--olive-deep);
}

p { margin: 0 0 1em; }
a { color: var(--olive); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--olive-deep); }

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

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--olive); color: var(--cream);
  padding: 0.7rem 1rem; border-radius: var(--radius);
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 1rem; color: var(--cream); }

/* Small caps label, echoing the "PRESS" lettering of the logo */
.eyebrow {
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--olive);
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--olive);
  --btn-fg: var(--cream);
  --btn-border: var(--olive);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  min-height: 48px;
  padding: 0.75em 1.5em;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { --btn-bg: var(--olive-deep); --btn-border: var(--olive-deep); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn--ghost { --btn-bg: transparent; --btn-fg: var(--olive-deep); --btn-border: var(--line-strong); }
.btn--ghost:hover { --btn-bg: var(--cream-2); --btn-fg: var(--olive-deep); --btn-border: var(--olive); }
.btn--light { --btn-bg: var(--cream); --btn-fg: var(--olive-deep); --btn-border: var(--cream); }
.btn--light:hover { --btn-bg: var(--paper); --btn-fg: var(--forest); --btn-border: var(--paper); }
.btn--danger { --btn-bg: transparent; --btn-fg: var(--danger); --btn-border: currentColor; }
.btn--danger:hover { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-border: var(--danger); }
.btn--block { width: 100%; }
.btn--small { min-height: 40px; padding: 0.5em 1em; font-size: 0.76rem; }

.link-btn {
  background: none; border: 0; padding: 0.25rem 0; cursor: pointer;
  color: var(--olive); text-decoration: underline; text-underline-offset: 0.2em;
  min-height: 44px;
}

/* Loading spinner inside buttons */
.btn .spinner { display: none; }
.btn.is-loading .spinner { display: inline-block; }
.spinner {
  width: 1em; height: 1em; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { display: grid; gap: 0.35rem; margin-bottom: 1.1rem; }
.field > label, .fieldset > legend {
  font-size: 0.9rem; font-weight: 500; color: var(--text);
}
.field .hint { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.optional { font-weight: 400; color: var(--text-muted); }

.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 0.85rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 1rem; /* ≥16px prevents iOS zoom */
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.textarea { min-height: 5.5rem; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--olive); box-shadow: 0 0 0 3px rgba(78, 89, 54, 0.18); outline: none; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234e5936' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.4rem;
}
[aria-invalid="true"] { border-color: var(--danger) !important; }

.field-error {
  color: var(--danger); font-size: 0.86rem; margin: 0;
  display: flex; gap: 0.4em; align-items: baseline;
}
.field-error:empty { display: none; }
.field-error::before { content: "!"; font-weight: 600; display: inline-grid; place-items: center; width: 1.15em; height: 1.15em; border-radius: 50%; background: var(--danger); color: var(--paper); font-size: 0.75em; flex: none; }

.fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; min-width: 0; }
.fieldset > legend { padding: 0; margin-bottom: 0.5rem; }

/* Choice tiles: radio/checkbox styled as selectable rows (keyboard + screen reader native) */
.choices { display: grid; gap: 0.5rem; }
.choices--row { grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); }
.choice { position: relative; display: block; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice__body {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  min-height: 52px; padding: 0.7rem 0.95rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--paper);
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.choice__body::before {
  content: ""; flex: none; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: var(--paper);
  transition: all 0.2s var(--ease);
  order: -1;
}
.choice input[type="checkbox"] + .choice__body::before { border-radius: 2px; }
.choice__label { flex: 1; font-weight: 500; line-height: 1.3; }
.choice__label small { display: block; font-weight: 400; color: var(--text-muted); font-size: 0.84rem; margin-top: 0.1rem; }
.choice__meta { color: var(--text-muted); font-size: 0.9rem; white-space: nowrap; }
.choice input:checked + .choice__body { border-color: var(--olive); background: var(--sage-soft); box-shadow: inset 0 0 0 1px var(--olive); }
.choice input:checked + .choice__body::before { border-color: var(--olive); background: var(--olive); box-shadow: inset 0 0 0 3px var(--paper); }
.choice input[type="checkbox"]:checked + .choice__body::before {
  box-shadow: none;
  background: var(--olive) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='%23fffcf7' stroke-width='1.8'/%3E%3C/svg%3E") center / 80% no-repeat;
}
.choice input:focus-visible + .choice__body { box-shadow: var(--focus); }
.choice input:disabled + .choice__body { opacity: 0.5; cursor: not-allowed; }

/* Quantity stepper */
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); }
.stepper button {
  width: 44px; min-height: 44px; border: 0; background: none; cursor: pointer;
  font-size: 1.2rem; color: var(--olive-deep);
  display: grid; place-items: center;
}
.stepper button:hover { background: var(--cream-2); }
.stepper button:disabled { color: var(--line-strong); cursor: not-allowed; background: none; }
.stepper output { min-width: 2.2rem; display: grid; place-items: center; font-weight: 500; font-variant-numeric: tabular-nums; border-inline: 1px solid var(--line); }

/* Notices */
.notice {
  border-left: 3px solid var(--olive);
  background: var(--sage-soft);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.93rem;
  margin: 0 0 1rem;
}
.notice p:last-child { margin: 0; }
.notice--warn { border-color: var(--warn); background: var(--warn-soft); }
.notice--danger { border-color: var(--danger); background: var(--danger-soft); }
.notice--dev { border: 2px dashed var(--danger); background: #fff4ef; font-family: ui-monospace, Menlo, monospace; font-size: 0.82rem; }

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 0.45em;
  padding: 0.2em 0.7em; border-radius: 999px;
  font-size: 0.78rem; font-weight: 500; letter-spacing: 0.02em;
  border: 1px solid currentColor; white-space: nowrap;
}
.pill::before { content: ""; width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; }
.pill--ok { color: var(--ok); background: var(--ok-soft); }
.pill--warn { color: var(--warn); background: var(--warn-soft); }
.pill--danger { color: var(--danger); background: var(--danger-soft); }
.pill--neutral { color: var(--text-muted); background: var(--cream-2); }
.pill--olive { color: var(--olive-deep); background: var(--sage-soft); }

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