/* NutraShore Emulsifiers — design tokens
   Water phase = brine (dark). Oil phase = tide (pale). The accent is oil amber, used only for actions. */
:root {
  --brine: #06272e;
  --brine-deep: #041b20;
  --meniscus: #007580;
  --tide: #f8f3ec;
  --foam: #ffffff;
  --rinse: #d9e6e3;
  --ink: #06272e;
  --muted: #3f6168;
  --oil: #00afaa;
  --oil-ink: #06272e;
  --warn: #a8402d;
  --ok: #1d6b4f;
  --radius: 14px;
  --wrap: 1180px;
  --display: "Quicksand", "Segoe UI", system-ui, sans-serif;
  --body: "Quicksand", "Segoe UI", system-ui, -apple-system, sans-serif;
  --blue5: #085d67; --blue3: #00afaa; --blue2: #5fcac9; --blue1: #99d9d9; --beige2: #cda076; --beige1: #e1bf9d;
  --grad: linear-gradient(120deg, #06272e 0%, #085d67 28%, #00afaa 55%, #99d9d9 74%, #f8f3ec 86%, #cda076 100%);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 130px; }
body { margin: 0; font-family: var(--body); font-size: 17px; font-weight: 600; line-height: 1.55; color: var(--ink); background: var(--tide); font-variant-numeric: tabular-nums; }
img, svg { max-width: 100%; display: block; }
a { color: var(--meniscus); text-underline-offset: 3px; }
a:hover { color: var(--brine); }
:focus-visible { outline: 3px solid var(--blue3); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--foam); padding: 8px 14px; z-index: 100; border-radius: var(--radius); }
.skip:focus { left: 8px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 0.5em; font-weight: 500; }
h1 { font-size: clamp(2.4rem, 5.6vw, 4.3rem); font-weight: 500; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.05rem; letter-spacing: -0.01em; }
p { margin: 0 0 1em; max-width: 68ch; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 58ch; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.site-header { background: var(--foam); border-bottom: 1px solid var(--rinse); position: sticky; top: 0; z-index: 40; }
.site-header .wrap { display: flex; align-items: center; gap: 22px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--brine); font-family: var(--display); font-weight: 500; font-size: 1.5rem; letter-spacing: -0.02em; }
.brand small { font-family: var(--body); font-weight: 500; color: var(--muted); font-size: 0.85rem; letter-spacing: 0; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a { padding: 8px 12px; text-decoration: none; color: var(--ink); border-radius: var(--radius); font-weight: 500; font-size: 0.98rem; }
.nav a:hover { background: var(--tide); }
.nav a[aria-current="page"] { color: var(--brine); box-shadow: inset 0 -3px 0 var(--beige2); border-radius: 0; }
.nav .cart-link { font-weight: 600; }
.nav .cart-count { display: inline-block; min-width: 1.5em; text-align: center; background: var(--brine); color: #fff; border-radius: 99px; font-size: 0.8rem; padding: 0 6px; margin-left: 4px; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 1rem/1 var(--body); padding: 14px 20px; border-radius: var(--radius); border: 2px solid var(--brine); background: var(--brine); color: #fff; cursor: pointer; text-decoration: none; min-height: 48px; }
.btn:hover { background: var(--brine-deep); color: #fff; }
.btn.oil { background: var(--oil); border-color: var(--oil); color: var(--oil-ink); }
.btn.oil:hover { background: #2cc3be; color: var(--oil-ink); }
.btn.ghost { background: transparent; color: var(--brine); }
.btn.ghost:hover { background: var(--foam); color: var(--brine); }
.btn.small { padding: 9px 13px; min-height: 38px; font-size: 0.92rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.on-brine .btn.ghost { color: #fff; border-color: #fff; }
.on-brine .btn.ghost:hover { background: rgba(255,255,255,0.12); color: #fff; }
label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=search], select, textarea {
  width: 100%; font: 400 1rem/1.3 var(--body); padding: 12px 13px; border: 1.5px solid #7f9ea2; border-radius: var(--radius); background: var(--foam); color: var(--ink); min-height: 48px; }
textarea { min-height: 120px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--blue3); outline-offset: 0; border-color: var(--brine); }
.field { margin-bottom: 18px; }
.hint { font-size: 0.88rem; color: var(--muted); margin-top: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.error-text { color: var(--warn); font-weight: 600; }
.notice { border-left: 4px solid var(--oil); background: var(--foam); padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; }
.notice.warn { border-color: var(--warn); }
.notice.ok { border-color: var(--ok); }

/* sections + the oil/water interface */
.section { padding: 64px 0; }
.section.water { background: var(--brine); color: #e8f2f1; }
.section.water h2, .section.water h3 { color: #fff; }
.section.water a { color: #99d9d9; }
.section.water .muted { color: #b9d6d6; }
.section.paper { background: var(--foam); }
.interface { height: 30px; position: relative; margin: 0; overflow: hidden; line-height: 0; }
.interface svg { width: 100%; height: 30px; display: block; }
.interface.down { background: linear-gradient(to bottom, var(--oilside, var(--tide)) 0 50%, var(--brine) 50% 100%); }
.interface.up { background: linear-gradient(to bottom, var(--brine) 0 50%, var(--oilside, var(--tide)) 50% 100%); }
.interface.to-paper { --oilside: var(--foam); }

/* hero */
.hero { padding: 56px 0 40px; }
.hero h1 { max-width: 14ch; color: var(--brine); }
.hero .lede { margin-bottom: 28px; }
.matcher { background: var(--foam); border: 1.5px solid var(--brine); border-radius: 10px; padding: 18px; max-width: 760px; }
.matcher label { font-size: 1rem; }
.matcher .row { display: flex; gap: 10px; flex-wrap: wrap; }
.matcher .row input { flex: 1 1 260px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip { font: 500 0.92rem var(--body); background: var(--tide); border: 1px solid var(--rinse); color: var(--brine); padding: 6px 12px; border-radius: 99px; cursor: pointer; }
.chip:hover { background: #e9efe9; }
.chip[aria-pressed="true"] { background: var(--brine); color: #fff; border-color: var(--brine); }
.result { margin-top: 18px; animation: reveal 220ms ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .result { animation: none; } html { scroll-behavior: auto; } }

/* comparison */
.compare { width: 100%; border-collapse: collapse; font-size: 0.97rem; background: var(--foam); }
.compare th, .compare td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rinse); vertical-align: top; }
.compare thead th { background: var(--brine); color: #fff; font-family: var(--display); font-weight: 700; font-size: 1rem; }
.compare tbody th { font-weight: 600; width: 28%; color: var(--muted); background: #fbf7f1; }
.compare td.same { background: #e9f5ee; }
.table-scroll { overflow-x: auto; border: 1px solid var(--rinse); border-radius: var(--radius); }
.tag { display: inline-block; font-size: 0.82rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--tide); color: var(--brine); border: 1px solid var(--rinse); white-space: nowrap; }
.tag.high { background: #e1f2e9; color: var(--ok); border-color: #b6dcc8; }
.tag.medium { background: #fdf1d4; color: #7a5200; border-color: #efd391; }
.tag.low { background: #f8e3df; color: var(--warn); border-color: #e9bdb4; }

/* ledger (library) */
.toolbar { display: grid; grid-template-columns: 2fr 1.2fr 1fr 1fr 1.2fr; gap: 12px; align-items: end; margin-bottom: 14px; }
@media (max-width: 960px) { .toolbar { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .toolbar { grid-template-columns: 1fr; } }
.ledger { width: 100%; border-collapse: collapse; background: var(--foam); }
.ledger th, .ledger td { padding: 12px 12px; border-bottom: 1px solid var(--rinse); text-align: left; vertical-align: top; }
.ledger thead th { position: sticky; top: 64px; background: var(--brine); color: #fff; font-weight: 600; font-size: 0.92rem; z-index: 2; white-space: nowrap; }
.ledger thead th button { all: unset; cursor: pointer; }
.ledger thead th button:focus-visible { outline: 3px solid var(--blue3); }
.ledger tbody tr:hover { background: #fbf7f1; }
.ledger .code { font-family: var(--display); font-weight: 800; font-size: 1.15rem; color: var(--brine); text-decoration: none; letter-spacing: -0.01em; }
.ledger .pos { font-size: 0.9rem; color: var(--muted); max-width: 46ch; margin: 2px 0 0; }
.ledger td.num { white-space: nowrap; }
@media (max-width: 900px) {
  .ledger thead { display: none; }
  .ledger, .ledger tbody, .ledger tr, .ledger td { display: block; width: 100%; }
  .ledger tr { border-bottom: 3px solid var(--rinse); padding: 10px 0; }
  .ledger td { border: 0; padding: 4px 12px; }
  .ledger td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--muted); }
}
.drawer { position: fixed; left: 0; right: 0; bottom: 0; background: var(--brine-deep); color: #fff; padding: 12px 0; z-index: 50; transform: translateY(110%); transition: transform 180ms ease-out; }
.drawer.open { transform: none; }
.drawer .wrap { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }

/* product detail */
.keyspecs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--rinse); background: var(--foam); border-radius: var(--radius); }
.keyspecs div { padding: 14px 16px; border-right: 1px solid var(--rinse); }
.keyspecs div:last-child { border-right: 0; }
.keyspecs dt { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.keyspecs dd { margin: 2px 0 0; font-family: var(--display); font-size: 1.3rem; font-weight: 700; color: var(--brine); }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; gap: 24px; } }
.plain-list { margin: 0 0 1em; padding-left: 1.2em; }
.plain-list li { margin-bottom: 4px; }
.specs-table { width: 100%; border-collapse: collapse; background: var(--foam); }
.specs-table th, .specs-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--rinse); }
.specs-table th { width: 46%; font-weight: 600; color: var(--muted); }

/* applications */
.app-layout { display: grid; grid-template-columns: 300px 1fr; gap: 36px; align-items: start; }
@media (max-width: 900px) { .app-layout { grid-template-columns: 1fr; } }
.app-nav { position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow: auto; background: var(--foam); border: 1px solid var(--rinse); border-radius: var(--radius); }
@media (max-width: 900px) { .app-nav { position: static; max-height: none; } }
.app-nav h3 { font-size: 0.95rem; margin: 0; padding: 12px 14px 6px; color: var(--muted); font-family: var(--body); letter-spacing: 0; }
.app-nav button { all: unset; display: block; width: 100%; box-sizing: border-box; padding: 10px 14px; cursor: pointer; border-left: 4px solid transparent; font-weight: 500; }
.app-nav button:hover { background: var(--tide); }
.app-nav button[aria-current="true"] { border-left-color: var(--oil); background: var(--tide); font-weight: 700; color: var(--brine); }
.app-nav button:focus-visible { outline: 3px solid var(--blue3); outline-offset: -3px; }
.grade-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--rinse); }
.grade-row .code { font-family: var(--display); font-weight: 800; font-size: 1.1rem; }
@media (max-width: 640px) { .grade-row { grid-template-columns: 1fr; gap: 6px; } }

/* selector (AI) */
.drop { border: 2px dashed var(--brine); border-radius: 10px; background: var(--foam); padding: 30px 20px; text-align: center; cursor: pointer; }
.drop.over { background: #e3f3f2; border-style: solid; }
.drop strong { font-family: var(--display); font-size: 1.2rem; }
.preview { display: flex; gap: 12px; align-items: center; margin-top: 12px; padding: 10px 14px; background: var(--foam); border: 1px solid var(--rinse); border-radius: var(--radius); }
.preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; }
.reco { background: var(--foam); border: 1px solid var(--rinse); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.reco h3 { margin-bottom: 4px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--rinse); border-top-color: var(--brine); border-radius: 50%; animation: spin 800ms linear infinite; display: inline-block; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* ways-in list on water section */
.ways { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid rgba(255,255,255,0.25); }
.ways > div { padding: 24px 24px 24px 0; border-right: 1px solid rgba(255,255,255,0.18); margin-right: 24px; }
.ways > div:last-child { border-right: 0; margin-right: 0; }
@media (max-width: 860px) { .ways { grid-template-columns: 1fr; } .ways > div { border-right: 0; margin-right: 0; border-bottom: 1px solid rgba(255,255,255,0.18); } }

/* chemistry index */
.chem-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0; border-top: 1px solid var(--rinse); }
.chem-grid a { display: block; padding: 16px 18px 16px 0; border-bottom: 1px solid var(--rinse); text-decoration: none; color: var(--ink); }
.chem-grid a:hover strong { text-decoration: underline; }
.chem-grid strong { font-family: var(--display); font-size: 1.1rem; color: var(--brine); display: block; }

/* footer */
.site-footer { background: var(--brine-deep); color: #b9d6d6; padding: 40px 0 28px; font-size: 0.95rem; }
.site-footer a { color: #e8f2f1; }
.site-footer .cols { display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; }
.site-footer p { max-width: 60ch; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.fine { font-size: 0.85rem; color: #8fb7b8; margin-top: 22px; border-top: 1px solid rgba(255,255,255,0.15); padding-top: 14px; }

#xout, #sout { margin-top: 32px; }
@media (max-width: 760px) {
  .site-header { position: static; }
  .site-header .wrap { padding-top: 10px; padding-bottom: 6px; gap: 4px; }
  .nav { margin-left: -12px; }
  .nav a { padding: 8px 10px; }
  .hero { padding-top: 32px; }
}
.ledger .btn { white-space: nowrap; }
.ledger td:last-child { width: 1%; }

.interface.down { background: var(--oilside, var(--tide)); }
.interface.up { background: var(--brine); }
.section.water .btn.ghost { color: #fff; border-color: #fff; }
.section.water .btn.ghost:hover { background: rgba(255,255,255,0.12); color: #fff; }
.section.water .btn.oil, .section.water .btn.oil:hover { color: var(--oil-ink); }

/* ---- NutraShore brand layer (guidelines v.01) ---- */
body { background: var(--tide); }
.site-header { background: rgba(255,255,255,0.92); backdrop-filter: blur(8px); border-bottom: 0; }
.site-header::after { content: ""; display: block; height: 3px; background: var(--grad); }
.brand { gap: 12px; }
.brand .mark { width: 30px; height: auto; flex: none; }
.brand .word { display: inline-flex; align-items: baseline; color: var(--brine); line-height: 1; }
.brand .word b { font-weight: 500; text-transform: none; }
.brand .word i { font-style: normal; font-weight: 500; text-transform: uppercase; letter-spacing: -0.01em; }
.brand small { border-left: 2px solid var(--blue2); padding-left: 12px; color: var(--blue5); font-weight: 600; }
.btn { border-radius: 999px; font-weight: 700; }
.btn.oil { background: var(--blue3); border-color: var(--blue3); color: var(--brine); }
.btn.oil:hover { background: var(--blue2); border-color: var(--blue2); color: var(--brine); }
.btn.ghost:hover { background: var(--blue1); border-color: var(--brine); color: var(--brine); }
.chip { border-radius: 999px; }
.section.water { background: var(--brine); position: relative; overflow: hidden; }
.section.water > * { position: relative; z-index: 1; }
.section.water::before { content: ""; position: absolute; inset: auto -8% -42% auto; width: 520px; height: 520px; background: var(--grad); opacity: .22; border-radius: 48% 52% 60% 40% / 50% 40% 60% 50%; filter: blur(2px); z-index: 0; }
.hero { position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: 10px; width: min(36vw, 400px); aspect-ratio: 1124/1351; background: url(brand/blob.svg) no-repeat center/contain; opacity: .95; pointer-events: none; }
.hero > .wrap { position: relative; z-index: 1; }
.hero h1 { max-width: 15ch; }
@media (max-width: 860px) { .hero::after { opacity: .22; width: 70vw; right: -20vw; } }
.card, .grade-row, .drop, .compare, .matchcard, .chem-grid > * { border-radius: var(--radius); }
.site-footer { position: relative; }
.site-footer::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--grad); }
.site-footer .brandline { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; color: #fff; font-size: 1.4rem; font-weight: 500; }
.site-footer .brandline img { width: 28px; }
.gradient-rule { height: 4px; border: 0; border-radius: 4px; background: var(--grad); margin: 28px 0; }

.specbox { margin: 8px 0 18px; border: 1.5px dashed var(--blue2); border-radius: var(--radius); padding: 12px 16px; background: rgba(255,255,255,.6); }
.specbox summary { cursor: pointer; font-weight: 700; color: var(--blue5); }
.specbox[open] summary { margin-bottom: 12px; }

/* document pack panel */
.docpack{margin:18px 0;padding:16px 18px;border:1px solid var(--line,#d9e2e4);border-radius:var(--radius);background:#fff}
.docpack h3{margin:0 0 6px}
.docpack .field{margin:8px 0}
.docpack input{width:100%;box-sizing:border-box}
.docpack ul{margin-top:12px}
