/* Saari Kauppa — "warm apothecary for pets"
   Brand: pink #E58DB4 / #c97a9d, navy #1a1a2e (elainklinikkasaari.fi), logo kept.
   Display: Fraunces (self-hosted). Body: Inter/system. */

@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  --brand: #E58DB4; --brand2: #c97a9d; --brand-deep: #a95f80;
  --brand-light: #fdf2f7; --cream: #fdf9f6; --card: #ffffff;
  --ink: #1a1a2e; --mut: #6d6a7c; --line: #eee4e9;
  --ok: #1c7a4c;
  --radius: 18px; --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(26,26,46,.05), 0 8px 24px -12px rgba(169,95,128,.18);
  --shadow-hover: 0 2px 4px rgba(26,26,46,.06), 0 16px 36px -12px rgba(169,95,128,.30);
  --display: 'Fraunces', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  font: 16px/1.6 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 85% -80px, rgba(229,141,180,.14), transparent 70%),
    radial-gradient(700px 380px at -10% 30%, rgba(229,141,180,.07), transparent 70%),
    var(--cream);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-deep); text-decoration: none; }
a:hover { color: var(--ink); }
img { max-width: 100%; height: auto; }
main { max-width: 1120px; margin: 0 auto; padding: 20px 18px 40px; }
h1 { font-family: var(--display); font-weight: 600; font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.15; margin: .6em 0 .45em; letter-spacing: -.01em; }
h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.25rem, 2.6vw, 1.55rem); margin: 1.5em 0 .7em; }
h2::after { content: ""; display: block; width: 44px; height: 3px; margin-top: 8px; border-radius: 2px; background: linear-gradient(90deg, var(--brand), transparent); }

/* ---------- header ---------- */
.top {
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center;
  padding: 10px 18px; position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.brand img { height: 40px; width: auto; }
.brand .shopword {
  font-family: var(--display); font-size: 1.2rem; color: var(--brand2);
  border-left: 1px solid var(--line); padding-left: 10px; line-height: 1;
}
.search { flex: 1 1 200px; }
.search input {
  width: 100%; padding: 10px 16px; font-size: .95rem; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--cream);
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(229,141,180,.2); background: #fff; }
.top nav { display: flex; gap: 4px; align-items: center; font-weight: 600; font-size: .95rem; }
.top nav a { padding: 8px 12px; border-radius: 999px; color: var(--ink); transition: background .15s; }
.top nav a:hover { background: var(--brand-light); }
#cartlink { background: var(--ink); color: #fff; }
#cartlink:hover { background: var(--brand-deep); }
#cartcount { color: var(--brand); font-variant-numeric: tabular-nums; }
.lang { border: 1.5px solid var(--line); font-size: .8rem; padding: 5px 10px !important; }

.phone-bar { text-align: center; font-size: .85rem; background: var(--brand-light); padding: 6px 12px; color: var(--mut); border-bottom: 1px solid var(--line); }
.phone-bar a { font-weight: 700; color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(130deg, var(--ink) 0%, #35304e 55%, var(--brand-deep) 130%);
  color: #fff; border-radius: var(--radius); padding: clamp(28px, 5vw, 48px) clamp(22px, 4vw, 44px);
  margin: 18px 0 26px; box-shadow: var(--shadow);
}
.hero::before {
  content: "🐾"; position: absolute; right: -14px; bottom: -26px; font-size: 9rem;
  opacity: .10; transform: rotate(-18deg); pointer-events: none;
}
.hero h1 { margin: 0 0 10px; color: #fff; max-width: 22ch; }
.hero h1 em, .hero .hl { font-style: normal; color: var(--brand); }
.hero p { opacity: .85; max-width: 52ch; font-size: 1.02rem; }

/* ---------- category tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 6px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 14px 14px; text-align: center; font-weight: 700; color: var(--ink);
  box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--brand); }
.tile img { height: 112px; object-fit: contain; display: block; margin: 0 auto 10px; transition: transform .25s ease; }
.tile:hover img { transform: scale(1.05); }
.tile span { font-family: var(--display); font-size: 1.05rem; }

/* ---------- mission band ---------- */
.story { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm); padding: 16px 20px; margin: 20px 0 4px; box-shadow: var(--shadow); }
.story p { margin: 0; font-size: .95rem; color: var(--ink); }
.story a { font-weight: 700; white-space: nowrap; }

/* ---------- product grid & cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; color: var(--ink);
  box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
  animation: rise .4s ease backwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--brand); }
.card img { height: 135px; object-fit: contain; margin-bottom: 10px; transition: transform .25s ease; }
.card:hover img { transform: scale(1.06); }
.card-name { font-size: .88rem; font-weight: 600; flex: 1; line-height: 1.35; }
.card-size {
  display: inline-block; align-self: flex-start; margin-top: 7px; text-align: center;
  background: var(--brand-light); color: var(--brand-deep);
  font-size: .75rem; font-weight: 700; border-radius: 999px; padding: 2px 9px;
}
.card-price { font-weight: 800; margin-top: 7px; font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.unit { color: var(--mut); font-weight: 400; font-size: .78rem; }

/* ---------- product page ---------- */
.product { display: grid; gap: 28px; grid-template-columns: 1fr; min-width: 0; }
.p-info { min-width: 0; }
@media (min-width: 780px) { .product { grid-template-columns: 400px 1fr; align-items: start; } }
.p-images { position: sticky; top: 86px; }
@media (max-width: 779px) { .p-images { position: static; } }
.p-images img {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; width: 100%; object-fit: contain; max-height: 400px; box-shadow: var(--shadow);
}
.p-images .kibble { max-height: 110px; width: auto; margin-top: 10px; padding: 12px; }
.p-size { font-size: 1.2rem; margin: 8px 0 4px; }
.p-size b { font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.p-sizes { margin: 10px 0 16px; }
.p-sizes-label {
  display: block; margin-bottom: 6px; font-size: .72rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; color: var(--mut);
}
.size-pill {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 16px; margin: 3px 6px 3px 0; font-size: .88rem; font-weight: 600; color: var(--ink);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
a.size-pill:hover { border-color: var(--brand); background: var(--brand-light); box-shadow: var(--shadow); }
.size-pill.current {
  background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 800;
  box-shadow: 0 4px 14px -4px rgba(229,141,180,.55);
  cursor: default;
}
.size-pill.current svg { width: 12px; height: 12px; color: var(--brand); flex: none; }

button, .add {
  background: var(--brand); color: var(--ink); border: 0; border-radius: 999px;
  padding: 13px 26px; font-size: 1rem; font-weight: 800; font-family: inherit; cursor: pointer;
  box-shadow: 0 4px 14px -4px rgba(229,141,180,.55);
  transition: background .15s, color .15s, transform .1s, box-shadow .15s;
  touch-action: manipulation;
}
button:hover, .add:hover { background: var(--brand2); color: #fff; box-shadow: 0 6px 18px -4px rgba(169,95,128,.5); }
button:active, .add:active { transform: scale(.97); }
.add:disabled { background: var(--ok); color: #fff; }

.pickup {
  background: var(--brand-light); border: 1px dashed var(--brand);
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: .9rem; margin: 14px 0;
}
.pickup::before { content: "📍 "; }
.svnote { font-size: .85rem; color: var(--mut); font-style: italic; }

details {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 16px; margin: 12px 0; box-shadow: var(--shadow);
}
details summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details summary::before { content: "＋"; color: var(--brand-deep); font-weight: 800; transition: transform .2s; }
details[open] summary::before { transform: rotate(45deg); }
details summary::-webkit-details-marker { display: none; }
details > *:not(summary) { margin-top: 10px; }
details { overflow: hidden; }
details table { border-collapse: collapse; font-size: .82rem; max-width: 100%; overflow-x: auto; display: block; white-space: nowrap; -webkit-overflow-scrolling: touch; }
details td, details th { border: 1px solid var(--line); padding: 5px 9px; }
details th { background: var(--brand-light); }

.askvet textarea, .askvet input {
  width: 100%; margin: 8px 0 0; padding: 10px 12px; font: inherit;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--cream);
}
.askvet textarea:focus, .askvet input:focus { outline: none; border-color: var(--brand); background: #fff; }
.askvet textarea { min-height: 84px; }
.askvet button { margin-top: 10px; }

/* ---------- mobile buy bar (product page) ---------- */
.buybar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); box-shadow: 0 -6px 20px -10px rgba(26,26,46,.15);
}
.buybar-price { display: flex; flex-direction: column; line-height: 1.2; }
.buybar-price b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.buybar-price span { font-size: .78rem; color: var(--mut); }
.buybar .add { flex: 0 1 auto; padding: 13px 30px; }
@media (max-width: 779px) {
  .buybar { display: flex; }
  .product { margin-bottom: 84px; }         /* room for the fixed bar */
  .p-info > .add { display: none; }         /* bar replaces inline button */
  .p-images img { max-height: 240px; padding: 14px; }
  .p-images .kibble { display: none; }      /* secondary image is noise on phones */
  .hero::before { font-size: 6rem; right: -20px; }
  main { padding: 14px 14px 32px; }
  h1 { font-size: 1.5rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { padding: 11px; } .card img { height: 108px; }
  .top { padding: 8px 12px; gap: 8px 10px; }
  .brand img { height: 32px; }
  .brand .shopword { font-size: 1.05rem; }
  .top nav { font-size: .88rem; gap: 2px; } .top nav a { padding: 7px 9px; }
  .search { order: 5; flex-basis: 100%; }   /* search drops to its own row */
  .phone-bar { font-size: .78rem; }
  .tiles { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .tile { padding: 12px 6px 10px; } .tile img { height: 72px; } .tile span { font-size: .88rem; }
  #cart-items td { padding: 10px 6px; font-size: .92rem; }
  .checkout { padding: 16px; }
}
@media (min-width: 780px) and (max-width: 1023px) {  /* tablet */
  .product { grid-template-columns: 320px 1fr; gap: 22px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ---------- cart & checkout ---------- */
#cart-items table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow); overflow: hidden; }
#cart-items td { padding: 12px 10px; border-bottom: 1px solid var(--line); }
#cart-items tr:last-child td { border-bottom: 0; background: var(--brand-light); }
#cart-items input[type=number] { width: 64px; padding: 8px; border: 1.5px solid var(--line); border-radius: 8px; font: inherit; text-align: center; }
#cart-items .rm { background: transparent; color: var(--mut); box-shadow: none; padding: 6px 10px; font-size: .82rem; font-weight: 600; }
#cart-items .rm:hover { color: #b00020; background: #fdecec; }
.checkout { max-width: 460px; display: flex; flex-direction: column; gap: 12px; margin-top: 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.checkout h2 { margin-top: 0; }
.checkout input {
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; background: var(--cream);
}
.checkout input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(229,141,180,.2); }
.err { color: #b00020; font-weight: 600; }

/* ---------- mission page ---------- */
.mission { max-width: 760px; margin: 0 auto; }
.m-hero { text-align: left; }
.m-hero h1 { max-width: none; }
.m-sub { font-family: var(--display); font-size: 1.25rem; opacity: 1 !important; }
.m-lead { font-size: 1.12rem; line-height: 1.7; margin: 26px 4px; }
.m-lead::first-letter { font-family: var(--display); font-size: 3.2em; float: left;
  line-height: .82; padding: 4px 10px 0 0; color: var(--brand-deep); }
.m-warn { display: flex; gap: 16px; background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--brand-deep); border-radius: var(--radius-sm);
  padding: 18px 20px; margin: 24px 0; box-shadow: var(--shadow); }
.m-warn-icon { font-size: 1.8rem; line-height: 1; }
.m-warn h2 { margin: 0 0 6px; font-size: 1.05rem; }
.m-warn h2::after { display: none; }
.m-warn p { font-size: .96rem; }
.m-quote { margin: 34px 0; text-align: center; font-family: var(--display);
  font-size: clamp(1.5rem, 4vw, 2rem); color: var(--brand-deep); }
.m-quote span { display: block; margin-top: 12px; font-family: inherit;
  font-family: 'Inter', -apple-system, sans-serif; font-size: .95rem; color: var(--mut); max-width: 46ch; margin-left: auto; margin-right: auto; }
.m-contrast { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 26px 0; }
@media (min-width: 640px) { .m-contrast { grid-template-columns: 1fr 1fr; } }
.m-card { border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.m-card h3 { font-family: var(--display); font-size: .95rem; text-transform: uppercase;
  letter-spacing: .08em; margin-bottom: 8px; }
.m-before { background: var(--bg-alt, #f5f2f4); border: 1px solid var(--line); color: var(--mut); }
.m-before h3 { color: var(--mut); }
.m-now { background: var(--brand-light); border: 1.5px solid var(--brand); }
.m-now h3 { color: var(--brand-deep); }
.m-band { background: linear-gradient(130deg, var(--ink) 0%, #35304e 55%, var(--brand-deep) 130%);
  color: #fff; border-radius: var(--radius); padding: 34px 28px; text-align: center;
  margin: 30px 0; box-shadow: var(--shadow); }
.m-band-big { font-family: var(--display); font-size: clamp(1.4rem, 3.5vw, 1.9rem); line-height: 1.3; }
.m-band-sub { margin-top: 10px; opacity: .85; max-width: 48ch; margin-left: auto; margin-right: auto; }
.m-help { text-align: center; margin: 30px 0 10px; }
.m-help p { max-width: 54ch; margin: 0 auto; }
.m-ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.btn { display: inline-block; background: var(--brand); color: var(--ink); border-radius: 999px;
  padding: 12px 24px; font-weight: 800; box-shadow: 0 4px 14px -4px rgba(229,141,180,.55); }
.btn:hover { background: var(--brand2); color: #fff; }
.m-sig { text-align: center; font-style: italic; color: var(--mut); margin: 24px 0 8px; }

/* ---------- legal / static ---------- */
.legal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; max-width: 780px; box-shadow: var(--shadow); }
.legal h1 { margin-top: 0; }

/* ---------- footer ---------- */
footer {
  margin-top: 48px; padding: 30px 18px 34px; text-align: center;
  background: var(--ink); color: rgba(255,255,255,.75); font-size: .87rem;
}
footer div { margin: 5px 0; }
footer a { color: var(--brand); }
footer a:hover { color: #fff; }

/* ---------- admin ---------- */
.admin { background: var(--cream); }
.admin table { width: 100%; border-collapse: collapse; background: #fff; font-size: .9rem; box-shadow: var(--shadow); }
.admin td, .admin th { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.admin .warn { background: #fdecec; }
.admin form { display: inline; } .admin button { padding: 7px 14px; font-size: .85rem; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 700; background: #eee; }
.badge.paid { background: #fff3cd; } .badge.ordered_from_rc { background: #cfe2ff; }
.badge.ready_for_pickup { background: #d1e7dd; } .badge.picked_up { background: #e2e3e5; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
.printbtn { display:inline-block; margin-top:6px; font-size:.8rem; font-weight:600; color:var(--mut); border:1px solid var(--line); border-radius:6px; padding:3px 8px; white-space:nowrap; }
.printbtn:hover { color:var(--ink); border-color:var(--brand); }

/* ---------- clinic restock list ---------- */
.rno { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; font-size: .95rem; }
.admin .copybtn { padding: 2px 9px; font-size: .95rem; line-height: 1.5; }
.admin tr.done td { opacity: .55; }
.admin h3 { margin: 18px 0 6px; font-size: .95rem; }
#rtoast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(12px);
  background: #1a1a2e; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-weight: 700; font-size: .95rem; opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s; z-index: 99; }
#rtoast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* size under the product name in the H1 (SEO: every size page has its own heading) */
.product h1 .h1-size { display: block; font-family: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: .55em; font-weight: 500; letter-spacing: 0; opacity: .7; margin-top: .25em; }

/* vet note on product pages (signed) */
.vetnote { margin: 18px 0; padding: 16px 18px; background: var(--brand-light); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.vetnote h2 { font-size: 1.05rem; margin: 0 0 .4em; }
.vetnote p { margin: 0; }
.vetnote .vetnote-by { margin-top: .6em; font-size: .92rem; color: var(--mut); }
.vetnote .vetnote-by a { color: inherit; }
