/* ==========================================================================
   Maco Paper — Design System
   Editorial-premium direction: warm paper backgrounds, deep teal + coral
   brand accents (from the existing logo), a serif display face for
   headings and a clean grotesque for UI/body copy. No frameworks.
   ========================================================================== */

@import url('fonts.css');

:root {
  /* ---- Brand palette (derived from macopaper.com logo + brand marks) --- */
  --teal-900: #123837;
  --teal-800: #1a4d4b;
  --teal-700: #256b68;
  --teal-600: #34827e;
  --teal-500: #4e9695;
  --teal-400: #74aead;
  --teal-100: #e3efee;
  --teal-050: #f1f7f6;

  --coral-700: #c4623f;
  --coral-600: #dd7a52;
  --coral-500: #ef9772;
  --coral-400: #f4b39a;
  --coral-100: #fbe7dc;
  --coral-050: #fdf3ee;

  --ink-900: #1c1815;
  --ink-700: #3a352f;
  --ink-500: #6b6459;
  --ink-300: #a29a8c;

  --paper-000: #fffdfa;
  --paper-050: #faf5ed;
  --paper-100: #f4ecdf;
  --paper-200: #ece0cd;
  --border: #e4d9c6;

  --success: #2f7d5f;
  --danger: #b5432f;

  /* ---- Type ---- */
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* ---- Scale ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-9: 6.5rem;

  --radius-sm: 6px;
  --radius-md: 14px;
  --radius-lg: 26px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(28, 24, 21, 0.06), 0 1px 1px rgba(28, 24, 21, 0.04);
  --shadow-md: 0 12px 24px -12px rgba(28, 24, 21, 0.22);
  --shadow-lg: 0 30px 60px -20px rgba(18, 56, 55, 0.28);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 180ms;
  --dur-med: 380ms;
  --dur-slow: 640ms;

  --container: 1280px;
  --container-narrow: 860px;

  --header-h: 166px;
  --z-header: 100;
  --z-drawer: 200;
  --z-modal: 300;
  --z-toast: 400;

  color-scheme: light;
}

/* ---------------------------- Reset ---------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-900);
  background: var(--paper-050);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, picture, svg, video { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
table { border-collapse: collapse; }

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

/* ---------------------------- Typography ---------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--teal-900);
}
h1 { font-size: clamp(2.4rem, 4.4vw, 4.2rem); font-weight: 700; }
h2 { font-size: clamp(1.9rem, 3vw, 2.75rem); }
h3 { font-size: clamp(1.35rem, 1.8vw, 1.7rem); }
h4 { font-size: 1.1rem; }
p { color: var(--ink-700); }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--coral-600);
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 2px;
  background: var(--coral-500);
  border-radius: 2px;
}
.lede { font-size: 1.15rem; color: var(--ink-500); max-width: 52ch; }
.italic-accent { font-family: var(--font-display); font-style: italic; font-weight: 500; }

/* ---------------------------- Layout ---------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-5);
}
.container--narrow { max-width: var(--container-narrow); }
.section { padding-block: var(--space-8); }
.section--tight { padding-block: var(--space-6); }
@media (max-width: 640px) {
  .container { padding-inline: var(--space-4); }
  .section { padding-block: var(--space-7); }
}

/* ---------------------------- Accessibility ---------------------------- */
.skip-link {
  position: fixed;
  top: -60px;
  left: var(--space-4);
  z-index: 1000;
  background: var(--teal-900);
  color: var(--paper-000);
  padding: 0.85em 1.4em;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: var(--space-4); }

:focus-visible {
  outline: 2.5px solid var(--coral-600);
  outline-offset: 3px;
  border-radius: 4px;
}

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

/* ---------------------------- Buttons ---------------------------- */
.btn {
  --btn-bg: var(--teal-800);
  --btn-fg: var(--paper-000);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  padding: 0.95em 1.7em;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
  will-change: transform;
}
.btn:hover { background: var(--teal-700); box-shadow: var(--shadow-md); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn--coral { --btn-bg: var(--coral-600); }
.btn--coral:hover { background: var(--coral-700); }
.btn--outline {
  --btn-bg: transparent;
  --btn-fg: var(--teal-900);
  border-color: var(--teal-900);
}
.btn--outline:hover { background: var(--teal-900); --btn-fg: var(--paper-000); color: var(--paper-000); }
.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink-900);
  padding-inline: 0.2em;
  border-radius: 0;
}
.btn--ghost:hover { color: var(--teal-700); box-shadow: none; }
.btn--block { width: 100%; }
.btn--sm { padding: 0.6em 1.1em; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* magnetic wrapper set via JS transform */
.magnetic { transition: transform 260ms var(--ease-out); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  transition: background var(--dur-fast), transform var(--dur-fast) var(--ease-out);
  position: relative;
}
.icon-btn:hover { background: var(--teal-050); transform: translateY(-1px); }
.icon-btn svg { width: 20px; height: 20px; stroke: var(--teal-900); }

/* ---------------------------- Header ---------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  border-bottom: 1px solid transparent;
  transition: transform var(--dur-med) var(--ease-in-out), box-shadow var(--dur-med);
}
.site-header.is-scrolled { box-shadow: var(--shadow-sm); }
.site-header.is-hidden { transform: translateY(-100%); }

.header-top { background: var(--paper-000); border-bottom: 1px solid var(--border); }
.header-top-inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  height: 118px;
}
.brand { display: flex; align-items: center; gap: 0.6em; flex-shrink: 0; }
.brand img { height: 90px; width: auto; }

.header-search { flex: 1; display: flex; max-width: 820px; height: 39px; }
.header-search select {
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--paper-050);
  padding: 0 0.8em;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-700);
  max-width: 170px;
}
.header-search input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--border);
  border-left: none;
  border-right: none;
  padding: 0 1em;
  font-size: 0.92rem;
  background: var(--paper-000);
}
.header-search input:focus, .header-search select:focus { outline: none; box-shadow: 0 0 0 3px var(--teal-100) inset; }
.header-search button {
  flex-shrink: 0;
  width: 52px;
  border: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--teal-800);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast);
}
.header-search button:hover { background: var(--teal-700); }
.header-search button svg { width: 19px; height: 19px; stroke: #fff; }

.header-actions { display: flex; align-items: center; gap: var(--space-4); flex-shrink: 0; }
.header-search-mobile { display: none; }

.header-call {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink-700);
  white-space: nowrap;
}
.header-call svg { width: 19px; height: 19px; stroke: var(--teal-700); flex-shrink: 0; }

.header-navbar { background: var(--teal-900); }
.header-navbar-inner { display: flex; align-items: center; justify-content: center; height: 48px; }
.header-navbar ul { display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; height: 100%; }
.header-navbar li { height: 100%; display: flex; align-items: center; }
.header-navbar a {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--teal-100);
  transition: color var(--dur-fast);
  height: 100%;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
}
.header-navbar a:hover { color: #fff; }
.header-navbar a[aria-current="page"] { color: #fff; border-bottom-color: var(--coral-500); }

.cart-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  background: var(--coral-600);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease-out);
}
.cart-badge.is-visible { transform: scale(1); }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 42px; height: 42px;
  align-items: center; justify-content: center;
  background: none; border: none;
}
.menu-toggle span { width: 22px; height: 2px; background: var(--ink-900); border-radius: 2px; transition: transform var(--dur-fast), opacity var(--dur-fast); }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  :root { --header-h: 88px; }
  .header-navbar { display: none; }
  .header-search { display: none; }
  .header-search-mobile { display: inline-flex; }
  .header-call { display: none; }
  .menu-toggle { display: flex; }
  .header-top-inner { height: 88px; }
  .brand img { height: 71px; }
}

.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  background: var(--paper-000);
  display: flex;
  flex-direction: column;
  padding: var(--space-6) var(--space-5);
  overflow-y: auto;
  transform: translateY(-100%);
  transition: transform var(--dur-slow) var(--ease-in-out);
}
.mobile-nav.is-open { transform: translateY(0); }
.mobile-nav ul { display: flex; flex-direction: column; gap: 0; margin-top: var(--space-5); }
.mobile-nav a { display: block; padding: 0.55em 0; font-family: var(--font-display); font-size: 1.4rem; border-bottom: 1px solid var(--border); }
.mobile-nav .mobile-nav-top { display: flex; justify-content: space-between; align-items: center; }
.mobile-nav-top img { height: 44px; width: auto; }
.mobile-nav-footer { margin-top: auto; display: flex; gap: var(--space-4); }

/* ---------------------------- Footer ---------------------------- */
.site-footer { background: var(--teal-900); color: var(--paper-100); padding-block: var(--space-8) var(--space-6); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: var(--space-6); }
.footer-brand p { color: var(--teal-100); max-width: 32ch; }
.footer-brand img { height: 61px; width: auto; margin-bottom: var(--space-4); filter: brightness(0) invert(1); }
.footer-col h4 { color: var(--paper-000); font-family: var(--font-body); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: var(--space-4); }
.footer-col ul { display: flex; flex-direction: column; gap: 0.65em; }
.footer-col a { color: var(--teal-100); transition: color var(--dur-fast); }
.footer-col a:hover { color: var(--coral-400); }
.footer-social { display: flex; gap: var(--space-3); margin-top: var(--space-4); }
.footer-social .icon-btn { background: rgba(255,255,255,0.08); }
.footer-social .icon-btn svg { stroke: var(--paper-000); }
.footer-social .icon-btn:hover { background: rgba(255,255,255,0.16); }
.footer-bottom {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3);
  font-size: 0.82rem; color: var(--teal-400);
}
.footer-bottom a:hover { color: var(--paper-000); }
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---------------------------- Forms ---------------------------- */
.field { display: flex; flex-direction: column; gap: 0.5em; margin-bottom: var(--space-4); }
.field label { font-weight: 600; font-size: 0.86rem; color: var(--ink-700); }
.field .hint { font-size: 0.78rem; color: var(--ink-300); }
.input, .select, .textarea {
  width: 100%;
  padding: 0.85em 1em;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper-000);
  font-size: 0.95rem;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--teal-600);
  box-shadow: 0 0 0 4px var(--teal-100);
  outline: none;
}
.textarea { resize: vertical; min-height: 110px; }
.radio-card, .check-card {
  display: flex; align-items: flex-start; gap: 0.8em;
  padding: 0.9em 1em;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.radio-card:has(input:checked), .check-card:has(input:checked) {
  border-color: var(--teal-600);
  background: var(--teal-050);
}
.radio-card input, .check-card input { margin-top: 3px; accent-color: var(--teal-700); }
.field-error { color: var(--danger); font-size: 0.8rem; }
.input.is-invalid { border-color: var(--danger); }

/* ---------------------------- Scroll reveal ---------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.reveal.is-visible { opacity: 1; transform: none; }
.reveal-stagger > * { transition-delay: calc(var(--i, 0) * 70ms); }

/* ---------------------------- Misc utilities ---------------------------- */
.visually-hidden-focusable:not(:focus) { @apply sr-only; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: var(--space-2); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.badge {
  display: inline-flex; align-items: center;
  padding: 0.3em 0.75em;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge--sale { background: var(--coral-100); color: var(--coral-700); }
.badge--new { background: var(--teal-100); color: var(--teal-800); }
.badge--out { background: var(--paper-200); color: var(--ink-500); }

.divider { height: 1px; background: var(--border); border: none; margin-block: var(--space-6); }

.breadcrumb { display: flex; flex-wrap: wrap; gap: 0.5em; font-size: 0.85rem; color: var(--ink-500); margin-bottom: var(--space-5); }
.breadcrumb a:hover { color: var(--teal-700); }
.breadcrumb .sep { color: var(--ink-300); }

.page-hero { padding-block: var(--space-7) var(--space-6); text-align: center; }
.page-hero .lede { margin-inline: auto; }

.empty-state { text-align: center; padding: var(--space-8) var(--space-5); color: var(--ink-500); }
.empty-state svg { margin-inline: auto; margin-bottom: var(--space-4); stroke: var(--teal-400); }

/* ---------------------------- Sticky CTA (mobile) ---------------------------- */
.sticky-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-header);
  background: var(--paper-000);
  border-top: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  display: none;
  gap: var(--space-3);
  box-shadow: 0 -8px 24px rgba(28,24,21,0.08);
}
@media (max-width: 720px) {
  .sticky-cta.is-active { display: flex; }
}

/* ---------------------------- Toast ---------------------------- */
.toast-stack {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toast {
  max-width: min(360px, calc(100vw - 2 * var(--space-5)));
  background: var(--teal-900);
  color: #fff;
  padding: 0.9em 1.2em;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.88rem;
  display: flex; align-items: center; gap: 0.6em;
  transform: translateX(120%);
  transition: transform var(--dur-med) var(--ease-out);
}
.toast.is-visible { transform: translateX(0); }
@media (max-width: 560px) {
  .toast-stack { left: var(--space-4); right: var(--space-4); }
  .toast { width: 100%; }
}
