@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=DM+Serif+Display:ital@0;1&display=swap');

:root {
  --ink: #24152f;
  --plum: #4f216c;
  --violet: #7445a2;
  --brand-purple: #9b51e0;
  --brand-mint: #8fd6b8;
  --lilac: #d8c4eb;
  --cream: #f8f3e9;
  --paper: #fffdf8;
  --coral: #e75c4b;
  --gold: #e4af55;
  --line: rgba(36, 21, 47, .16);
  --serif: "DM Serif Display", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --shadow: 0 24px 70px rgba(36, 21, 47, .16);
  --pastel-rainbow: linear-gradient(105deg, #ffe4ed 0%, #ffeecf 24%, #e4f4d4 46%, #d9f1f3 68%, #e8ddff 86%, #ffdff2 100%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body { margin: 0; overflow-x: hidden; color: var(--ink); background: var(--cream); font-family: var(--sans); line-height: 1.55; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.wrap { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.section { padding-block: clamp(48px, 8vw, 96px); }
.skip-link { position: fixed; z-index: 100; left: 16px; top: -60px; padding: 12px 18px; background: white; border-radius: 4px; }
.skip-link:focus { top: 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Header / nav ---------------------------------------------------------- */
.site-header { height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand img { width: 210px; height: auto; }
.site-header nav { display: flex; gap: 20px; align-items: center; }
.site-header nav a { font-size: .82rem; font-weight: 700; text-decoration: none; }
.site-header nav a:hover { color: var(--plum); }
.nav-cta { padding: 11px 19px; border: 1px solid var(--ink); border-radius: 999px; }
.nav-cta.is-current { color: white; background: var(--ink); }
.nav-cta:not(.is-current):hover { background: var(--pastel-rainbow); background-size: 180% 180%; }

/* Hero ------------------------------------------------------------------ */
.hero { min-height: 400px; display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(30px, 5vw, 70px); align-items: center; padding-block: 24px 40px; }
.hero-copy { min-width: 0; }
.eyebrow, .kicker { margin: 0 0 14px; color: var(--brand-purple); font-weight: 800; font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 400; letter-spacing: -.03em; line-height: 1; }
h1 { max-width: 640px; font-size: clamp(2.6rem, 5vw, 4.4rem); }
h2 { font-size: clamp(2rem, 4vw, 3.4rem); }
h3 { font-size: 1.4rem; }
.lede { max-width: 560px; margin: 22px 0 22px; font-size: clamp(1rem, 1.4vw, 1.14rem); color: #5d5264; }
.trust-list { display: flex; gap: 10px 22px; flex-wrap: wrap; margin: 0 0 20px; padding: 0; list-style: none; font-size: .78rem; color: #66586e; }
.trust-list li::before { content: "✓"; margin-right: 6px; color: var(--plum); font-weight: 900; }
.compare-line { font-size: .9rem; color: #5d5264; }
.compare-line a, .compare-cta a { color: var(--plum); font-weight: 700; text-decoration: none; }
.compare-line a:hover, .compare-cta a:hover { text-decoration: underline; }
.hero-art { position: relative; min-width: 0; display: flex; align-items: center; justify-content: center; }
.hero-art img { position: relative; z-index: 2; width: 78%; max-width: 360px; filter: drop-shadow(0 30px 26px rgba(36,21,47,.24)); transform: rotate(-3deg); border-radius: 4px; }
.sun-orbit { position: absolute; width: 320px; height: 320px; border-radius: 50%; background: var(--brand-purple); opacity: .82; }
.sun-orbit::before { content: ""; position: absolute; inset: -24px; border: 1px solid rgba(36,21,47,.2); border-radius: 50%; }

/* Headings -------------------------------------------------------------- */
.section-heading { max-width: 720px; margin-bottom: 30px; }
.section-heading.align-left { margin-inline: 0; }
.section-heading p:last-child { margin: 12px 0 0; color: #5d5264; }

/* Catalog grid ---------------------------------------------------------- */
.catalog-status { padding: 20px; text-align: center; color: #5d5264; }
.issue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: clamp(18px, 2.4vw, 30px); }
.issue-card { position: relative; display: flex; flex-direction: column; padding: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(36,21,47,.07); }
.issue-card.is-soldout { opacity: .82; }
.issue-cover-wrap { position: relative; aspect-ratio: 3 / 4; margin-bottom: 12px; border-radius: 8px; overflow: hidden; background: var(--lilac); }
.issue-cover-wrap img { width: 100%; height: 100%; object-fit: cover; }
.issue-card.is-soldout .issue-cover-wrap img { filter: grayscale(.55); }
.soldout-badge { position: absolute; top: 10px; left: 10px; padding: 5px 12px; border-radius: 999px; background: var(--ink); color: white; font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.issue-number { font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--brand-purple); }
.issue-title { margin: 4px 0 2px; font-family: var(--serif); font-size: 1.12rem; line-height: 1.1; }
.issue-cover-label { margin: 0 0 12px; font-size: .78rem; color: #6a5d73; }
.issue-price { margin: 0 0 10px; font-weight: 700; }
.issue-foot { margin-top: auto; }
.qty-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qty-row label { font-size: .74rem; font-weight: 700; color: #4a3e55; }
.qty-stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty-stepper button { width: 36px; border: 0; background: var(--cream); color: var(--ink); font-size: 1.1rem; font-weight: 800; cursor: pointer; }
.qty-stepper button:hover { background: var(--lilac); }
.qty-stepper button:disabled { opacity: .4; cursor: not-allowed; }
.qty-stepper input { width: 46px; border: 0; border-inline: 1px solid var(--line); text-align: center; font: inherit; font-weight: 700; -moz-appearance: textfield; }
.qty-stepper input::-webkit-outer-spin-button, .qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.issue-in-cart { margin: 8px 0 0; font-size: .72rem; font-weight: 700; color: var(--plum); }
.soldout-note { margin: 0; font-size: .74rem; color: #6a5d73; }

/* Cart ------------------------------------------------------------------ */
.cart-section { background: white; border-top: 1px solid var(--line); }
.cart-layout { display: grid; grid-template-columns: 1.5fr .9fr; gap: clamp(24px, 4vw, 56px); align-items: start; }
.cart-empty { padding: 30px; text-align: center; color: #6a5d73; background: var(--cream); border-radius: 12px; }
.address-fields { margin: 0 0 24px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; }
.address-fields legend { padding: 0 8px; font-family: var(--serif); font-size: 1.3rem; }
.delivery-heading { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin: 28px 0 12px; }
.delivery-heading h3 { margin-bottom: 6px; }
.delivery-heading .field-note { margin: 0; }
.button-secondary { flex: 0 0 auto; min-height: 44px; padding: 9px 15px; border: 1px solid var(--plum); border-radius: 6px; color: var(--plum); background: white; font: 700 .78rem var(--sans); cursor: pointer; }
.button-secondary:hover { background: #f5edf9; }
.button-secondary:disabled { opacity: .5; cursor: not-allowed; }
.destinations { display: grid; gap: 18px; }
.destination-card { min-width: 0; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 34px rgba(36,21,47,.07); }
.destination-header { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding: 20px; border-bottom: 1px solid var(--line); background: linear-gradient(120deg, #fffdf8, #f5edf9); }
.destination-header h3 { font-size: clamp(1.45rem, 3vw, 1.9rem); }
.delivery-number { margin: 0 0 4px; color: var(--brand-purple); font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.delivery-meta { margin: 7px 0 0; color: #6a5d73; font-size: .76rem; }
.address-remove { flex: 0 0 auto; min-height: 38px; padding: 6px 0 6px 10px; border: 0; background: transparent; color: #b43f32; font: 700 .75rem var(--sans); text-decoration: underline; cursor: pointer; }
.delivery-magazines { padding: 20px; border-bottom: 1px solid var(--line); }
.delivery-magazines-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 12px; }
.delivery-magazines h4, .issue-chooser h4 { margin: 0; font-family: var(--serif); font-size: 1.08rem; }
.delivery-magazines-heading a { color: var(--plum); font-size: .75rem; font-weight: 700; }
.delivery-empty { margin: 0; color: #6a5d73; font-size: .82rem; }
.delivery-items { display: grid; gap: 10px; }
.delivery-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.delivery-item img { width: 48px; height: 64px; object-fit: cover; border-radius: 4px; }
.delivery-item-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.delivery-item-copy strong { font-family: var(--serif); font-size: .94rem; font-weight: 400; line-height: 1.15; }
.delivery-item-copy span { color: #6a5d73; font-size: .7rem; }
.delivery-item .qty-row { justify-content: flex-end; }
.delivery-address { margin: 0; padding: 20px; border: 0; }
.delivery-address legend { padding: 18px 0 0; font-family: var(--serif); font-size: 1.08rem; }
.chooser-toggle { min-height: 46px; margin: 0 20px 20px; padding: 10px 16px; border: 1px solid var(--plum); border-radius: 7px; background: white; color: var(--plum); font: 700 .8rem var(--sans); cursor: pointer; }
.chooser-toggle:hover { background: #f5edf9; }
.issue-chooser { padding: 20px; border-top: 1px solid var(--line); background: #f7f0fa; }
.issue-chooser > .field-note { margin-top: 6px; }
.chooser-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.chooser-card { min-width: 0; padding: 9px; background: white; border: 1px solid var(--line); border-radius: 9px; }
.chooser-card.is-soldout { opacity: .68; }
.chooser-cover { position: relative; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 5px; background: var(--lilac); }
.chooser-cover img { width: 100%; height: 100%; object-fit: cover; }
.chooser-soldout { position: absolute; inset: auto 4px 4px; padding: 3px; border-radius: 4px; background: var(--ink); color: white; text-align: center; font-size: .55rem; font-weight: 800; text-transform: uppercase; }
.chooser-card h5 { min-height: 2.4em; margin: 7px 0; font: 400 .78rem/1.2 var(--serif); }
.chooser-card .qty-row { align-items: flex-start; flex-direction: column; }
.chooser-card .qty-stepper { width: 100%; }
.chooser-card .qty-stepper button { flex: 1 1 0; width: auto; }
.chooser-card .qty-stepper input { width: 40px; }
.order-confirmation { margin-block: 36px 70px; padding: clamp(28px, 6vw, 64px); border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); }
.order-confirmation h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.test-banner { position: sticky; z-index: 200; top: 0; padding: 7px; text-align: center; color: #321b00; background: #ffd56a; font: 800 .72rem var(--sans); letter-spacing: .08em; }
.field-note { margin: 0 0 16px; font-size: .82rem; color: #6a5d73; }
.addr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: .78rem; font-weight: 700; color: #4a3e55; }
.field small { font-weight: 500; color: #8a7d93; }
.field-wide { grid-column: 1 / -1; }
.field input, .field select { min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font: inherit; font-weight: 500; color: var(--ink); }
.field input:focus, .field select:focus { border-color: var(--violet); }
.field-error { margin: 8px 0 0; min-height: 1.1em; color: var(--coral); font-size: .8rem; font-weight: 700; }

/* Summary --------------------------------------------------------------- */
.cart-summary { position: sticky; top: 20px; padding: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.summary-lines { margin: 16px 0; display: grid; gap: 10px; }
.summary-lines .row { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; }
.summary-lines .row.muted { color: #6a5d73; font-size: .82rem; }
.summary-lines .row.total { padding-top: 12px; border-top: 1px solid var(--line); font-family: var(--serif); font-size: 1.3rem; }
.summary-note { margin: 0 0 16px; font-size: .76rem; color: #6a5d73; }
.button { min-height: 54px; width: 100%; display: inline-flex; justify-content: center; align-items: center; padding: 14px 24px; border: 0; border-radius: 6px; font-size: .9rem; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, background .2s ease; }
.button:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(36,21,47,.18); }
.button-primary { color: white; background: var(--plum); }
.button-primary:hover { background: #713094; }
.button[aria-disabled="true"], .button:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }
.gate-note { margin: 12px 0 0; font-size: .82rem; color: #5d5264; }
.gate-note.is-gated { padding: 12px 14px; background: #fff4d6; border: 1px solid #f0d68a; border-radius: 8px; color: #5a4600; font-weight: 600; }
.compare-cta { margin: 18px 0 0; font-size: .82rem; color: #5d5264; }

/* Footer — canonical MedMag logo always stays in its normal brand colors. */
.site-footer { padding: 40px 0; border-top: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.footer-inner img { width: 180px; filter: none; opacity: 1; }
.footer-inner p { margin: 0; color: #4a3e55; }
.footer-nav { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.footer-nav a { font-size: .82rem; font-weight: 700; text-decoration: none; color: var(--plum); }
.footer-nav a:hover { text-decoration: underline; }
.noscript { padding: 16px; text-align: center; background: #fff4d6; color: #5a4600; }

/* Responsive ------------------------------------------------------------ */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { order: -1; min-height: 300px; }
  .cart-layout { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
}
@media (max-width: 560px) {
  .site-header { height: auto; padding-block: 14px; flex-wrap: wrap; }
  .brand img { width: 170px; }
  .site-header nav { gap: 12px; }
  .site-header nav a { font-size: .76rem; }
  .nav-cta { padding: 9px 14px; }
  .addr-grid { grid-template-columns: 1fr; }
  .issue-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .delivery-heading { align-items: stretch; flex-direction: column; }
  .button-secondary { width: 100%; }
  .issue-card .qty-row { align-items: flex-start; flex-direction: column; }
  .delivery-item { grid-template-columns: 42px minmax(0, 1fr); }
  .delivery-item img { width: 42px; height: 56px; }
  .delivery-item .qty-row { grid-column: 1 / -1; justify-content: space-between; }
  .chooser-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .destination-header, .delivery-magazines, .delivery-address, .issue-chooser { padding-inline: 16px; }
  .chooser-toggle { width: calc(100% - 32px); margin-inline: 16px; }
  .address-remove { max-width: 96px; text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
