/* Koe Earth — storefront styles */

/* Fonts are self-hosted (SIL Open Font License, see assets/fonts) */
@font-face {
  font-family: "Young Serif";
  src: url("../fonts/young-serif.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Jost";
  src: url("../fonts/jost.woff2") format("woff2");
  font-weight: 300 700; font-style: normal; font-display: swap;
}

:root {
  --olive: #425423;
  --olive-deep: #2c3916;
  --olive-soft: #e4e6d2;
  --cream: #faf6ef;
  --paper: #f1eadb;
  --gold: #b8913f;
  --earth: #85562b;
  --ink: #26301a;
  --muted: #5d604c;
  --line: #ddd3bf;
  --danger: #a1321f;

  --serif: "Young Serif", Georgia, "Noto Serif", serif;
  --sans: "Jost", "Segoe UI", Roboto, system-ui, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: 2.125rem;
  --step-4: clamp(2.5rem, 6vw + 0.5rem, 4.5rem);

  --gutter: 16px;
  --radius: 10px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--olive); text-underline-offset: 3px; }
a:hover { color: var(--olive-deep); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0 0 0.5em; color: var(--olive); }
h1 { font-size: var(--step-4); letter-spacing: -0.01em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
p { margin: 0 0 1em; }

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

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 700px) { :root { --gutter: 32px; } }

.skip { position: absolute; left: -999px; top: 8px; background: var(--olive); color: #fff; padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; }

.plain { list-style: none; margin: 0; padding: 0; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  font: 500 var(--step-0)/1 var(--sans);
  border-radius: 999px; border: 1.5px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--olive); color: var(--cream); }
.btn-primary:hover { background: var(--olive-deep); color: var(--cream); }
.btn-ghost { background: transparent; color: var(--olive); border-color: var(--olive); }
.btn-ghost:hover { background: var(--olive); color: var(--cream); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.icon-btn { background: none; border: 0; padding: 10px; color: var(--ink); cursor: pointer; border-radius: 999px; }
.icon-btn:hover { background: var(--paper); }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: rgba(250, 246, 239, .94);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.brand img { height: 54px; width: auto; }
.main-nav { display: none; margin-left: auto; gap: 28px; }
.main-nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.main-nav a:hover { color: var(--olive); text-decoration: underline; }
.cart-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 1.5px solid var(--olive); color: var(--olive);
  border-radius: 999px; padding: 8px 16px; font: 500 var(--step-0)/1 var(--sans); cursor: pointer;
}
.cart-btn:hover { background: var(--olive); color: var(--cream); }
.cart-count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--gold); color: var(--olive-deep); font-size: var(--step--1); font-weight: 600;
  display: inline-grid; place-items: center;
}
.cart-count[hidden] { display: none; }
@media (min-width: 760px) {
  .main-nav { display: flex; }
  .cart-btn { margin-left: 8px; }
}

/* ---------- hero ---------- */

.hero { padding: 32px 0 56px; }
.hero-grid { display: grid; gap: 28px; }
.hero-photo { order: -1; }
.hero-photo img { border-radius: var(--radius); width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.lede { font-size: var(--step-1); max-width: 34ch; }
.hero-price { color: var(--earth); font-weight: 500; max-width: 40ch; }
@media (min-width: 900px) {
  .hero { padding: 64px 0 88px; }
  .hero-grid { grid-template-columns: 1fr 1.05fr; align-items: center; gap: 56px; }
  .hero-photo { order: 0; }
}

/* ---------- price ladder ---------- */

.ladder { background: var(--paper); padding: 56px 0; border-block: 1px solid var(--line); }
.section-lede { color: var(--muted); max-width: 52ch; }
.ladder-steps { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 12px; }
.ladder-step {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "bars count price" "bars save price";
  align-items: center; column-gap: 16px;
  background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
}
.ladder-step:last-child { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.mini-bars { grid-area: bars; display: flex; align-items: flex-end; gap: 4px; width: 76px; }
.mini-bars i {
  display: block; width: 22px; height: 30px; border-radius: 4px;
  background: linear-gradient(to bottom, #2d54c4 0 64%, #a2412e 64% 100%);
}
.mini-bars i:nth-child(2) { background: linear-gradient(to bottom, #2d54c4 0 64%, #e6dcc6 64% 100%); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.ladder-count { grid-area: count; font-weight: 500; }
.ladder-save { grid-area: save; color: var(--muted); font-size: var(--step--1); }
.ladder-price { grid-area: price; font-family: var(--serif); font-size: var(--step-2); color: var(--olive); }
@media (min-width: 760px) {
  .ladder-steps { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .ladder-step { grid-template-columns: 1fr auto; grid-template-areas: "bars bars" "count price" "save price"; row-gap: 4px; padding: 22px; }
  .mini-bars { height: 44px; margin-bottom: 14px; }
}

/* ---------- products ---------- */

.shop { padding: 64px 0; }
.products { display: grid; gap: 48px; margin-top: 28px; }
.product { display: grid; gap: 20px; }
.product-photo img { border-radius: var(--radius); width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.product h3 { margin-bottom: 4px; }
.product-meta { color: var(--earth); font-weight: 500; }
@media (min-width: 900px) {
  .products { grid-template-columns: 1fr 1fr; gap: 48px; }
}

/* Soap anatomy: the cross-section of each bar, one row per clay layer */
.anatomy {
  margin: 24px 0; display: grid; grid-template-columns: 92px 1fr; grid-template-rows: 1fr 1fr; column-gap: 0;
}
.anatomy-bar {
  grid-row: 1 / span 2; display: grid; grid-template-rows: 1fr 1fr; border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 6px 14px -8px rgba(38, 48, 26, .45);
}
.anatomy-layer {
  display: block; min-height: 70px;
  background-color: var(--clay);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0,0,0,.22) 0 1px, transparent 1.6px),
    radial-gradient(circle at 70% 60%, rgba(0,0,0,.18) 0 1px, transparent 1.6px),
    radial-gradient(circle at 45% 80%, rgba(255,255,255,.22) 0 1px, transparent 1.6px),
    linear-gradient(to bottom, rgba(255,255,255,.16), rgba(0,0,0,.06));
  background-size: 9px 9px, 13px 11px, 11px 14px, 100% 100%;
}
.anatomy-layer + .anatomy-layer { border-top: 2px solid rgba(255,255,255,.35); }
.anatomy-notes { display: contents; }
.anatomy-note {
  grid-column: 2; position: relative; margin: 0; padding: 10px 0 10px 40px; align-self: center;
  color: var(--muted); font-size: var(--step--1);
}
.anatomy-note::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 30px; border-top: 1.5px solid var(--gold);
}
.anatomy-note::after {
  content: ""; position: absolute; left: -4px; top: calc(50% - 3.5px); width: 7px; height: 7px; border-radius: 50%; background: var(--gold);
}
.anatomy-note strong { display: block; color: var(--ink); font-size: var(--step-0); font-weight: 500; }

.buy-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.stepper {
  display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 999px; background: #fff;
}
.stepper button {
  width: 44px; height: 44px; border: 0; background: none; font-size: 1.25rem; color: var(--olive); cursor: pointer; border-radius: 999px;
}
.stepper button:hover { background: var(--paper); }
.stepper output { min-width: 28px; text-align: center; font-weight: 500; }
.buy-row .btn-primary { flex: 1 1 160px; }
.stock-out { color: var(--danger); font-weight: 500; }

.duo {
  margin-top: 48px; padding: 20px 22px; border-radius: var(--radius); border: 1px dashed var(--gold);
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
}
.duo p { margin: 0; }

/* ---------- how to use ---------- */

.use { background: var(--olive-deep); color: var(--olive-soft); padding: 64px 0; }
.use h2 { color: var(--cream); }
.use .section-lede { color: #c9ccb1; }
.use-grid { display: grid; gap: 24px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 14px; }
.steps li { counter-increment: step; position: relative; padding-left: 48px; min-height: 32px; font-size: var(--step-1); }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0.05em;
  font-family: var(--serif); font-size: var(--step-2); color: var(--gold); line-height: 1;
}
.steps strong { color: var(--cream); font-weight: 500; }
.use-note { font-size: var(--step--1); color: #c9ccb1; max-width: 60ch; border-top: 1px solid rgba(255,255,255,.15); padding-top: 16px; margin: 0; }
@media (min-width: 900px) {
  .use-grid { grid-template-columns: 1fr 1.2fr; column-gap: 64px; }
  .use-note { grid-column: 2; }
}

/* ---------- inside / story ---------- */

.inside { padding: 64px 0; }
.inside-grid { display: grid; gap: 32px; }
.inside-grid > div:first-child p { max-width: 46ch; }
.ingredients { display: grid; gap: 20px; }
.ingredients > div { border-left: 3px solid var(--gold); padding-left: 16px; }
.ingredients h3 { font-size: var(--step-1); margin-bottom: 4px; }
.ingredients p { color: var(--muted); margin: 0; }
@media (min-width: 900px) { .inside-grid { grid-template-columns: 1fr 1fr; gap: 64px; } }

/* ---------- FAQ ---------- */

.faq { padding: 24px 0 72px; }
.faq-wrap > * { max-width: 780px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none; padding: 18px 36px 18px 0; position: relative; font-weight: 500;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-size: 1.5rem; color: var(--olive); line-height: 1;
}
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--muted); padding-bottom: 8px; max-width: 64ch; }

/* ---------- footer ---------- */

.site-footer { background: var(--paper); border-top: 1px solid var(--line); padding: 48px 0 24px; font-size: var(--step--1); }
.footer-grid { display: grid; gap: 28px; }
.footer-logo { width: 96px; height: 96px; border-radius: 50%; margin-bottom: 12px; }
.footer-h { font-family: var(--sans); font-size: var(--step-0); font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.site-footer li { margin-bottom: 6px; }
.footer-base { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); }
.footer-base p { margin: 0; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }

/* ---------- cart drawer ---------- */

.drawer-scrim { position: fixed; inset: 0; background: rgba(38, 48, 26, .45); z-index: 40; }
.drawer {
  position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(420px, 100%);
  background: var(--cream); display: flex; flex-direction: column;
  box-shadow: -12px 0 32px -16px rgba(38, 48, 26, .5);
  transform: translateX(0); transition: transform .22s ease;
}
.drawer[hidden], .drawer-scrim[hidden] { display: none; }
.drawer.is-entering { transform: translateX(100%); }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: var(--step-2); margin: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 20px; }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-line img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
.cart-line-name { font-weight: 500; margin: 0; }
.cart-line-price { color: var(--muted); font-size: var(--step--1); margin: 0; }
.cart-line .stepper button { width: 36px; height: 36px; font-size: 1.1rem; }
.cart-line .remove { background: none; border: 0; padding: 4px 0; color: var(--muted); text-decoration: underline; font: inherit; font-size: var(--step--1); cursor: pointer; }
.cart-empty { padding: 32px 0; text-align: left; }
.cart-empty[hidden] { display: none; }
.drawer-foot { border-top: 1px solid var(--line); padding: 16px 20px 20px; background: var(--paper); }
.drawer-foot[hidden] { display: none; }
.nudge { background: var(--cream); border: 1px dashed var(--gold); border-radius: 8px; padding: 10px 12px; font-size: var(--step--1); }
.nudge:empty { display: none; }

.totals { margin: 0 0 16px; }
.totals > div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; }
.totals .grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-weight: 600; font-size: var(--step-1); }
.totals .grand dt { color: var(--ink); }
.totals [hidden] { display: none; }

body.drawer-open { overflow: hidden; }

/* ---------- checkout / order / policy pages ---------- */

.page { padding: 40px 0 72px; }
.page h1 { font-size: var(--step-3); }
.checkout-grid { display: grid; gap: 32px; }
@media (min-width: 900px) { .checkout-grid { grid-template-columns: 1.3fr 1fr; gap: 56px; align-items: start; } }

.form-section { border: 0; padding: 0; margin: 0 0 28px; }
.form-section legend { font-family: var(--serif); font-size: var(--step-1); color: var(--olive); margin-bottom: 12px; padding: 0; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 500; font-size: var(--step--1); }
.field .hint { color: var(--muted); font-size: var(--step--1); font-weight: 400; }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink); background: #fff; width: 100%;
  border: 1.5px solid var(--line); border-radius: 8px; padding: 11px 12px; min-height: 48px;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--olive); outline: 2px solid rgba(66, 84, 35, .2); outline-offset: 0; }
.field.has-error input, .field.has-error select { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: var(--step--1); margin: 0; }
.row-2 { display: grid; gap: 0 16px; align-items: start; }
@media (min-width: 560px) { .row-2 { grid-template-columns: 1fr 1fr; } }
.hp { position: absolute; left: -5000px; }

.summary { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
@media (min-width: 900px) { .summary { position: sticky; top: 92px; } }
.summary h2 { font-size: var(--step-1); }
.summary-lines { list-style: none; margin: 0 0 12px; padding: 0; }
.summary-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }

.notice { border-radius: 8px; padding: 14px 16px; margin-bottom: 20px; }
.notice-error { background: #f6e1da; color: #6e2414; border: 1px solid #e3b5a8; }
.notice-ok { background: #e4ead3; color: #2c3916; border: 1px solid #c4cfa4; }
.notice-wait { background: #f5ecd6; color: #5d4614; border: 1px solid #e3cf9f; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.secure-note { color: var(--muted); font-size: var(--step--1); margin-top: 12px; }

.order-status { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--olive-soft); color: var(--olive-deep); font-weight: 500; font-size: var(--step--1); }
.order-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.order-card h2 { font-size: var(--step-1); }
.timeline { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.timeline li { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.timeline li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.timeline li.done { color: var(--ink); }
.timeline li.done::before { background: var(--olive); border-color: var(--olive); }

.prose { max-width: 70ch; }
.prose h2 { font-size: var(--step-2); margin-top: 1.5em; }
.prose li { margin-bottom: 6px; }
