/* ==========================================================================
   SCGLMS - Public Site Stylesheet
   Design tokens:
   - Base   #F4F6F1 (susu di padang rumput - warm-white bercorak sage)
   - Ink    #1E2A20 (hijau gelap, bukan hitam pekat)
   - Brand  #2F4A3C (hijau hutan/pasture - identitas utama)
   - Cold   #2E6E8E (biru baja - dipakai KHUSUS utk elemen cold-chain/data suhu)
   - Warm   #C97A33 (amber peternakan - CTA & aksen hangat)
   - Line   #DCD9C9 (border netral)
   Type: "Fraunces" (display, hangat & organik) + "Karla" (UI/body, bersih)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Karla:wght@400;500;600;700&display=swap');

:root {
    --base: #F4F6F1;
    --surface: #FFFFFF;
    --ink: #1E2A20;
    --ink-soft: #4B5A4F;
    --brand: #2F4A3C;
    --brand-dark: #1F3128;
    --cold: #2E6E8E;
    --cold-dark: #204E64;
    --warm: #C97A33;
    --warm-dark: #A5621F;
    --line: #DCD9C9;
    --amber-bg: #FBF0DD; --amber-fg: #8A5A16;
    --green-bg: #E4EFE2; --green-fg: #2C5E3E;
    --blue-bg: #E2ECF2;  --blue-fg: #23566F;
    --teal-bg: #DEEFEC;  --teal-fg: #1E6F63;
    --red-bg: #F6E4E2;   --red-fg: #96331F;
    --grey-bg: #ECEAE3;  --grey-fg: #5A5748;
    --radius-s: 4px;
    --radius-m: 8px;
    --shadow-card: 0 1px 2px rgba(30,42,32,.06), 0 4px 14px rgba(30,42,32,.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--base);
    color: var(--ink);
    font-family: 'Karla', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
    font-family: 'Fraunces', Georgia, serif;
    color: var(--brand-dark);
    line-height: 1.15;
    margin: 0 0 .5em;
    font-weight: 600;
}
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; max-width: 66ch; }
a { color: var(--cold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul { padding-left: 1.2em; }

:focus-visible {
    outline: 3px solid var(--cold);
    outline-offset: 2px;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}
.container-narrow {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5em;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius-s);
    padding: .7em 1.3em;
    font-family: 'Karla', sans-serif;
    font-weight: 600;
    font-size: .95rem;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--warm); color: #fff; }
.btn-primary:hover { background: var(--warm-dark); }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); }
.btn-outline { background: transparent; border-color: var(--brand); color: var(--brand-dark); }
.btn-outline:hover { background: var(--brand); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: var(--red-fg); color: #fff; }
.btn-sm { padding: .45em .9em; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Top navigation ---------- */
.topbar {
    background: var(--brand-dark);
    color: #EDEFE7;
    font-size: .85rem;
    padding: 6px 0;
}
.topbar .container { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.topbar a { color: #EDEFE7; }

.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 40;
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; gap: 1.5rem; }
.brand-mark { display: flex; align-items: center; gap: .6em; font-family: 'Fraunces', serif; font-weight: 700; font-size: 1.25rem; color: var(--brand-dark); }
.brand-mark .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cold); display: inline-block; }
.nav-links { display: flex; gap: 1.6rem; align-items: center; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--ink); font-weight: 600; font-size: .95rem; }
.nav-links a:hover { color: var(--brand-dark); text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: .8rem; }
.cart-badge { position: relative; }
.cart-count { position: absolute; top: -8px; right: -10px; background: var(--warm); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 1px 6px; }
.nav-toggle { display: none; }

/* ---------- Hero ---------- */
.hero {
    padding: 64px 0 72px;
    background: linear-gradient(180deg, #EFF3EA 0%, var(--base) 100%);
    border-bottom: 1px solid var(--line);
}
.hero .container { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.hero-eyebrow { color: var(--cold-dark); font-weight: 700; font-size: .9rem; margin-bottom: .6em; }
.hero p.lead { font-size: 1.15rem; color: var(--ink-soft); }
.hero-actions { display: flex; gap: .9rem; margin-top: 1.6rem; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 1.8rem; margin-top: 2.2rem; flex-wrap: wrap; }
.hero-stats div strong { display: block; font-family: 'Fraunces', serif; font-size: 1.6rem; color: var(--brand-dark); }
.hero-stats div span { font-size: .85rem; color: var(--ink-soft); }

/* Cold-chain tracker mockup card in hero */
.tracker-card {
    background: var(--brand-dark);
    color: #fff;
    border-radius: 14px;
    padding: 26px;
    box-shadow: 0 20px 50px rgba(31,49,40,.28);
    position: relative;
}
.tracker-card::before {
    content: "";
    position: absolute; inset: 0;
    border-radius: 14px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,.25), transparent 40%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    pointer-events: none;
}
.tracker-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.1rem; }
.tracker-head span.label { font-size: .78rem; text-transform: none; color: #B9C9BE; letter-spacing: .02em; }
.tracker-head strong { font-family: 'Fraunces', serif; font-size: 1.05rem; }
.live-dot { display: inline-flex; align-items: center; gap: .4em; font-size: .75rem; color: #9FE3C4; }
.live-dot i { width: 8px; height: 8px; border-radius: 50%; background: #4CD08A; box-shadow: 0 0 0 4px rgba(76,208,138,.2); }
.tracker-temp { display: flex; align-items: baseline; gap: .4rem; margin: .6rem 0 1rem; font-family: 'JetBrains Mono', 'Courier New', monospace; }
.tracker-temp .val { font-size: 2.6rem; font-weight: 700; }
.tracker-temp .unit { font-size: 1.1rem; color: #B9C9BE; }
.tracker-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; margin-bottom: .35rem; }
.tracker-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #4CD08A, #9FE3C4); }
.tracker-row { display: flex; justify-content: space-between; font-size: .82rem; color: #CBD8CF; margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px dashed rgba(255,255,255,.18); }
.tracker-route { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: #CBD8CF; margin-top: .8rem; }
.tracker-route .step { width: 8px; height: 8px; border-radius: 50%; background: #6F8778; }
.tracker-route .step.done { background: #4CD08A; }
.tracker-route .line { flex: 1; height: 2px; background: rgba(255,255,255,.18); }

/* ---------- Sections ---------- */
.section { padding: 60px 0; }
.section-head { max-width: 620px; margin-bottom: 2.2rem; }
.section-head p { color: var(--ink-soft); }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.pillar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.pillar-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px; }
.pillar-card .num { font-family: 'Fraunces', serif; font-size: 1.6rem; color: var(--cold); margin-bottom: .3rem; }
.pillar-card h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.pillar-card p { font-size: .9rem; color: var(--ink-soft); margin: 0; }

/* ---------- Product grid & cards ---------- */
.toolbar {
    display: flex; gap: 12px; align-items: center; justify-content: space-between;
    flex-wrap: wrap; margin-bottom: 1.6rem;
}
.search-form { display: flex; gap: 8px; flex: 1; min-width: 260px; max-width: 460px; }
.search-form input[type=search] {
    flex: 1; padding: .65em .9em; border: 1px solid var(--line); border-radius: var(--radius-s);
    font-family: 'Karla', sans-serif; font-size: .95rem; background: var(--surface);
}
.picker-trigger {
    display: inline-flex; align-items: center; gap: .5em;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s);
    padding: .62em 1em; font-family: 'Karla', sans-serif; font-size: .9rem; color: var(--ink);
    cursor: pointer;
}
.picker-trigger:hover { border-color: var(--brand); }
.picker-trigger .chev { opacity: .55; font-size: .75em; }
.picker-trigger .picked-value { font-weight: 700; color: var(--brand-dark); }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.product-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s ease, transform .15s ease; }
.product-card:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }
.product-thumb { aspect-ratio: 4/3; background: linear-gradient(135deg, #EAF0E6, #DCE7DD); display: flex; align-items: center; justify-content: center; color: var(--brand); font-family: 'Fraunces', serif; font-size: .9rem; text-align: center; padding: 10px; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-body { padding: 16px; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.product-tag { font-size: .72rem; font-weight: 700; color: var(--cold-dark); }
.product-body h3 { font-size: 1.02rem; margin: 0; }
.product-body h3 a { color: var(--ink); }
.product-price { font-family: 'Fraunces', serif; font-weight: 700; color: var(--brand-dark); font-size: 1.15rem; margin-top: auto; }
.product-meta { font-size: .78rem; color: var(--ink-soft); }
.product-foot { padding: 0 16px 16px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); }

/* ---------- Pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2rem; }
.page-link { padding: .5em .85em; border: 1px solid var(--line); border-radius: var(--radius-s); font-size: .88rem; background: var(--surface); color: var(--ink); }
.page-link:hover { border-color: var(--brand); text-decoration: none; }
.page-link.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-link.is-disabled { opacity: .4; pointer-events: none; }
.page-ellipsis { padding: .5em .3em; color: var(--ink-soft); }

/* ---------- Status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: .35em; padding: .28em .8em; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.pill-amber { background: var(--amber-bg); color: var(--amber-fg); }
.pill-green { background: var(--green-bg); color: var(--green-fg); }
.pill-blue  { background: var(--blue-bg);  color: var(--blue-fg); }
.pill-teal  { background: var(--teal-bg);  color: var(--teal-fg); }
.pill-red   { background: var(--red-bg);   color: var(--red-fg); }
.pill-grey  { background: var(--grey-bg);  color: var(--grey-fg); }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: .4em; color: var(--brand-dark); }
.field .hint { font-size: .78rem; color: var(--ink-soft); margin-top: .3em; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=search], textarea, select {
    width: 100%; padding: .7em .9em; border: 1px solid var(--line); border-radius: var(--radius-s);
    font-family: 'Karla', sans-serif; font-size: .95rem; background: var(--surface); color: var(--ink);
}
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--cold); border-color: var(--cold); }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 28px; box-shadow: var(--shadow-card); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.alert { padding: .9em 1.1em; border-radius: var(--radius-s); font-size: .92rem; margin-bottom: 1.2rem; border: 1px solid transparent; }
.alert-success { background: var(--green-bg); color: var(--green-fg); border-color: #BEDCC2; }
.alert-error { background: var(--red-bg); color: var(--red-fg); border-color: #EBC3BC; }
.alert-info { background: var(--blue-bg); color: var(--blue-fg); border-color: #C6DAE5; }

/* ---------- Cart / checkout table ---------- */
.table-simple { width: 100%; border-collapse: collapse; }
.table-simple th, .table-simple td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.table-simple th { font-size: .78rem; text-transform: none; color: var(--ink-soft); font-weight: 700; }
.qty-control { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.qty-control button { background: var(--base); border: none; width: 30px; height: 30px; cursor: pointer; font-size: 1rem; color: var(--brand-dark); }
.qty-control input { width: 42px; border: none; text-align: center; padding: 0; }

.summary-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px; }
.summary-row { display: flex; justify-content: space-between; padding: .5em 0; font-size: .93rem; }
.summary-row.total { border-top: 1px solid var(--line); margin-top: .4rem; padding-top: .9rem; font-weight: 700; font-family: 'Fraunces', serif; font-size: 1.2rem; color: var(--brand-dark); }

/* ---------- Traceability / shelf-life block on product detail ---------- */
.trace-block { background: var(--brand-dark); color: #fff; border-radius: var(--radius-m); padding: 22px; margin-top: 1.4rem; }
.trace-block h4 { color: #fff; font-size: 1rem; margin-bottom: .2rem; }
.trace-block p { color: #C9D6CD; font-size: .88rem; }
.trace-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 1rem; }
.trace-stat { background: rgba(255,255,255,.07); border-radius: var(--radius-s); padding: 12px; }
.trace-stat .v { font-family: 'JetBrains Mono', monospace; font-size: 1.3rem; font-weight: 700; }
.trace-stat .l { font-size: .74rem; color: #B9C9BE; margin-top: .2rem; }

/* ---------- Timeline (order tracking) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding-left: 30px; padding-bottom: 26px; border-left: 2px solid var(--line); margin-left: 8px; }
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--line); border: 3px solid var(--base); }
.timeline li.active::before { background: var(--cold); }
.timeline li.done::before { background: var(--brand); }
.timeline .t-title { font-weight: 700; color: var(--brand-dark); }
.timeline .t-time { font-size: .78rem; color: var(--ink-soft); }

/* ---------- Footer ---------- */
.site-footer { background: var(--brand-dark); color: #C9D6CD; padding: 48px 0 22px; margin-top: 60px; }
.site-footer .container { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.site-footer h4 { color: #fff; font-size: .95rem; margin-bottom: .8rem; }
.site-footer a { color: #C9D6CD; font-size: .88rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 30px; padding-top: 18px; font-size: .8rem; color: #9AAB9F; text-align: center; }

/* ---------- Modal (generic + picker) ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(20,26,20,.55);
    display: none; align-items: center; justify-content: center;
    z-index: 200; padding: 20px;
}
.modal-overlay.is-open { display: flex; }
.modal-box {
    background: var(--surface); border-radius: 12px; width: 100%; max-width: 480px;
    max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.modal-box.modal-wide { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--ink-soft); line-height: 1; padding: 4px; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.picker-search { margin-bottom: 12px; }
.picker-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 340px; overflow-y: auto; }
.picker-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: .7em .9em; border-radius: var(--radius-s); cursor: pointer; border: 1px solid transparent; }
.picker-item:hover { background: var(--base); }
.picker-item.is-selected { background: var(--green-bg); border-color: #BEDCC2; }
.picker-item .title { font-weight: 600; font-size: .92rem; }
.picker-item .sub { font-size: .78rem; color: var(--ink-soft); }
.picker-empty { text-align: center; color: var(--ink-soft); padding: 30px 10px; font-size: .9rem; }

@media (max-width: 900px) {
    .hero .container { grid-template-columns: 1fr; }
    .pillar-grid { grid-template-columns: repeat(2, 1fr); }
    .site-footer .container { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .nav-links { display: none; }
    .pillar-grid { grid-template-columns: 1fr; }
    .site-footer .container { grid-template-columns: 1fr; }
    .trace-grid { grid-template-columns: 1fr; }
}
