/* ============================================================
   Koperasi SMKSBS: layout layer (loaded after style/koop/motion).
   1) Desktop: one fluid container that actually uses wide screens.
   2) Mobile: app-style layout (bottom tab bar, compact grids, swipe rows).
   ============================================================ */
:root { --wrap: 1600px; --gut: clamp(16px, 3.4vw, 56px); --tab-h: 68px; }

/* ---------- 1. fluid container ---------- */
.topstrip-inner, .header-inner, .nav-inner, .hero, .context-strip, .footer-inner, .breadcrumb, .page-hero,
.content-wrap, .shop-banner-inner, .shop-cat-pills, .shop-tools, .home-hero-inner {
  max-width: var(--wrap); padding-left: var(--gut); padding-right: var(--gut);
}
.content-wrap { padding-bottom: 80px; }

/* home hero: bigger type, info card gets real width */
.home-hero-inner { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 72px); padding-top: clamp(48px, 6vw, 96px); padding-bottom: clamp(44px, 5vw, 80px); }
.home-hero-text h1 { font-size: clamp(2.3rem, 4.1vw, 4.4rem); line-height: 1.04; letter-spacing: -.02em; }
.home-hero-text p { font-size: clamp(1rem, 1.15vw, 1.25rem); max-width: 56ch; }
.home-search { max-width: 640px; }
.home-info { padding: clamp(22px, 2.2vw, 36px); }

/* grids fill the width instead of leaving gutters */
.quick-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: clamp(14px, 1.4vw, 24px); }
.act-grid { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: clamp(16px, 1.6vw, 28px); }
.product-grid { grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: clamp(14px, 1.4vw, 24px); }
.context-strip { padding-top: clamp(40px, 4.5vw, 72px); }
.footer-inner { padding-top: 6px; }

@media (min-width: 1500px) {
  .home-info { max-width: 560px; justify-self: end; width: 100%; }
}

/* ---------- 2. mobile ---------- */
.tabbar { display: none; }

@media (max-width: 820px) {
  :root { --gut: 16px; }
  body { padding-bottom: 0; }
  footer { padding-bottom: calc(var(--tab-h) + 20px + env(safe-area-inset-bottom)); }

  /* slim top strip: just the phone number */
  .topstrip-item:nth-child(n+2) { display: none; }
  .topstrip-inner { padding-top: 7px; padding-bottom: 7px; }

  /* compact header, nav lives in the tab bar */
  .header-inner { padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .school-name .sub { display: none; }
  .school-name .full { font-size: 15px; line-height: 1.2; }
  .crest img { width: 40px; height: 40px; }
  .header-cta { display: none; }
  .menu-toggle { display: none; }
  nav.mainnav { display: none !important; }

  /* hero */
  .home-hero-inner { grid-template-columns: 1fr; padding-top: 28px; padding-bottom: 28px; gap: 22px; }
  .home-hero-text h1 { font-size: clamp(2rem, 9vw, 2.6rem); }
  .home-info { padding: 18px; }

  /* categories: 2 up, compact */
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .quick-card { padding: 16px 14px; }
  .quick-icon { width: 38px; height: 38px; margin-bottom: 10px; }
  .quick-title { font-size: 15px; }
  .quick-desc { font-size: 12px; }
  .quick-arrow { display: none; }
  .quick-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; }
  .quick-grid > :last-child:nth-child(odd) .quick-icon { margin-bottom: 0; flex: none; }

  /* activities: swipe row with snap */
  .context-strip .act-grid { display: flex; overflow-x: auto; gap: 14px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
    margin-left: calc(var(--gut) * -1); margin-right: calc(var(--gut) * -1); padding: 4px var(--gut) 14px; scrollbar-width: none; }
  .context-strip .act-grid::-webkit-scrollbar { display: none; }
  .context-strip .act-grid > * { flex: 0 0 82%; scroll-snap-align: center; }
  .content-wrap .act-grid { grid-template-columns: 1fr; }
  .act-img { height: 180px; aspect-ratio: auto; }

  /* shop */
  .shop-tools { gap: 10px; }
  .shop-cat-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px !important; margin-right: calc(var(--gut) * -1); padding-right: var(--gut) !important; }
  .shop-cat-pills::-webkit-scrollbar { display: none; }
  .shop-cat-pill { flex: 0 0 auto; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .content-wrap { padding-top: 16px; padding-bottom: 40px; }

  /* floating buttons clear the tab bar */
  .cart-fab, .wa-fab { bottom: calc(var(--tab-h) + 14px + env(safe-area-inset-bottom)) !important; }
  .wa-fab span { display: none; }

  /* footer */
  .footer-inner { flex-direction: column; gap: 10px; font-size: 13px; }

  /* ---- bottom tab bar ---- */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 6px 6px env(safe-area-inset-bottom);
    background: rgba(255,255,255,.88); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
    border-top: 1px solid var(--line); box-shadow: 0 -10px 30px -18px rgba(8,27,54,.35); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-soft);
    font-size: 11px; font-weight: 600; letter-spacing: .01em; border-radius: 14px; position: relative; -webkit-tap-highlight-color: transparent; }
  .tabbar svg { width: 22px; height: 22px; stroke-width: 1.9; }
  .tabbar a.current { color: var(--azure-dark); }
  .tabbar a.current::before { content: ""; position: absolute; top: 2px; width: 28px; height: 3px; border-radius: 3px; background: var(--azure); }
  .tabbar a:active { transform: scale(.94); background: var(--line-soft); }
}

@media (max-width: 380px) {
  .product-grid { gap: 10px; }
  .quick-card { padding: 14px 12px; }
}

@media (prefers-reduced-motion: no-preference) {
  @media (max-width: 820px) {
    .tabbar { view-transition-name: tabbar; }
    .tabbar a { transition: transform 160ms var(--ease-spring), background-color 160ms, color 160ms; }
  }
  ::view-transition-group(tabbar) { animation-duration: 0s; }
}
@media (min-width: 821px) { .act-grid > * { max-width: 640px; width: 100%; } }

@media (max-width: 820px) {
  /* shop: cards use the full width, nothing wraps awkwardly */
  .content-wrap > .content-card { padding: 0; background: transparent; border: 0; box-shadow: none; border-radius: 0; }
  .shop-banner { padding: 18px var(--gut) 16px; border-radius: 0 0 24px 24px; }
  .shop-banner-inner { flex-wrap: nowrap; gap: 14px; text-align: left; }
  .shop-banner-icon { width: 48px; height: 48px; border-radius: 15px; }
  .shop-banner-icon svg { width: 22px; height: 22px; }
  .sp-body { padding: 12px 12px 14px; gap: 9px; }
  .sp-price-row { flex-wrap: wrap; gap: 4px 8px; }
  .sp-price { font-size: 15px; }
  .stk { font-size: 10.5px; padding: 2px 8px; }
  .sp-add-btn { padding: 10px 6px; font-size: 12.5px; }
  .sp-add-btn svg { display: none; }
  .sp-qty button { width: 32px; height: 32px; }
  .cart-fab, .wa-fab { transform-origin: center; }
  .cart-fab { width: 52px; height: 52px; }
  .wa-fab { width: 48px; height: 48px; padding: 0; justify-content: center; }
}

@media (max-width: 820px) {
  .donate-card { padding: 16px; gap: 16px; }
  .donate-card > * { min-width: 0; max-width: 100%; }
  .donate-card img, .qr-box img, .qr-box canvas { max-width: 100%; height: auto; }
  .content-wrap { overflow-x: clip; }
}

/* ============================================================
   Carta organisasi: leadership cards + a real tree
   ============================================================ */
.org-wrap { position: relative; overflow: hidden; padding: clamp(28px, 4vw, 56px) clamp(14px, 3vw, 40px);
  background: radial-gradient(700px 320px at 50% -10%, rgba(232,135,58,.12), transparent 70%), var(--surface); }
.org-wrap::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(8,27,54,.07) 1px, transparent 1.2px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%); mask-image: linear-gradient(180deg, #000, transparent 85%); }
.org-chart { position: relative; padding: 0; }

.org-node { position: relative; border-radius: 20px; padding: 22px 22px 20px; gap: 6px; min-width: 190px; max-width: 250px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--line-soft); }
/* role first as a pill, then name */
.org-node small { order: 1; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--azure-dark);
  background: rgba(232,135,58,.12); border-radius: 999px; padding: 4px 11px; margin-top: 2px; }
.org-node b { order: 2; margin-top: 4px; font-size: 14.5px; }
.org-av { width: 76px; height: 76px; box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px rgba(232,135,58,.45), var(--shadow-md); font-size: 22px; }

/* leaders: bigger, gold */
.org-lead { min-width: min(340px, 100%); max-width: 380px; padding: 26px 28px 24px; }
.org-lead .org-av { width: 104px; height: 104px; font-size: 30px; box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--gold), var(--shadow-md); }
.org-lead b { font-size: 17px; }
.org-top { border-top: 0; background: linear-gradient(180deg, rgba(198,162,71,.14), transparent 55%), var(--paper); border-color: rgba(198,162,71,.45); }
.org-top small { background: rgba(198,162,71,.2); color: #8A6A1B; }
.org-top::after { content: ""; position: absolute; left: 24px; right: 24px; top: 0; height: 3px; border-radius: 0 0 4px 4px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

/* connectors */
.org-vl { width: 2px; height: 34px; background: rgba(232,135,58,.55); position: relative; flex: none; }
.org-vl::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; box-sizing: border-box; transform: translateX(-50%); z-index: 2;
  border-radius: 50%; background: var(--azure); box-shadow: 0 0 0 4px rgba(232,135,58,.18); }
.org-kids { display: flex; flex-wrap: nowrap; justify-content: center; gap: 18px; padding-top: 34px; width: 100%; }
.org-kids::before { display: none; }
.org-kids > .org-node { flex: 0 1 220px; min-width: 0; max-width: 230px; padding: 18px 14px 16px; }
.org-kids > .org-node::before { content: ""; position: absolute; top: -34px; left: 50%; width: 2px; height: 34px; margin-left: -1px; background: rgba(232,135,58,.55); }
.org-kids > .org-node::after { content: ""; position: absolute; top: -34px; left: -10px; right: -10px; height: 2px; background: rgba(232,135,58,.55); }
.org-kids > .org-node:first-child::after { left: 50%; }
.org-kids > .org-node:last-child::after { right: 50%; }
.org-kids > .org-node:only-child::after { display: none; }
.org-kids .org-av { width: 64px; height: 64px; font-size: 19px; }
/* big committees: tidy grid, no connectors */
.org-kids.many { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.org-kids.many > .org-node { max-width: none; flex: none; }
.org-kids.many > .org-node::before, .org-kids.many > .org-node::after { display: none; }

@media (prefers-reduced-motion: no-preference) {
  /* No lift: the connector lines belong to the card, so it must stay put. Highlight in place instead. */
  .org-node, .org-node:hover { transform: none !important; }
  .org-node { transition: box-shadow 300ms var(--ease-out), border-color 200ms, background-color 200ms; }
  .org-node:hover { box-shadow: 0 0 0 3px rgba(232,135,58,.16), var(--shadow-md); border-color: rgba(232,135,58,.6); }
  .org-av { transition: transform 420ms var(--ease-spring), box-shadow 300ms; }
  .org-node:hover .org-av { transform: scale(1.07); }
  .org-kids > .org-node:hover::before, .org-kids > .org-node:hover::after { background: var(--azure); }
}

@media (max-width: 820px) {
  .org-wrap { padding: 24px 12px 20px; }
  .org-lead { min-width: 0; width: 100%; max-width: 340px; padding: 20px 18px; }
  .org-lead .org-av { width: 88px; height: 88px; }
  .org-vl { height: 26px; }
  .org-kids, .org-kids.many { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 0; margin-top: 0; position: relative; }
  .org-kids::before { display: none; }
  .org-vl { height: 28px; }
  .org-vl:last-of-type::after { bottom: -5px; }
  .org-kids > .org-node { max-width: none; padding: 16px 10px 14px; }
  .org-kids > .org-node::before, .org-kids > .org-node::after { display: none; }
  .org-kids .org-av { width: 58px; height: 58px; }
  .org-node b { font-size: 13.5px; }
  .org-kids > .org-node:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 6px); }
}

/* ---------- sticky footer: short pages (nametag, 404...) must still end at the bottom of the screen ---------- */
html { background: var(--navy); }
body:has(> footer) { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body:has(> footer) > .shop-theme { flex: 1 0 auto; }
