:root {
    --brand: #0d9488;
    --brand-dark: #0f766e;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;

    --c-farmer: #16a34a;
    --c-farmer-dark: #15803d;
    --c-buyer: #2563eb;
    --c-buyer-dark: #1d4ed8;
    --c-pest: #ea580c;
    --c-pest-dark: #c2410c;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.home-pro {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: #f8fafc;
    overflow-x: hidden; /* the decorative hero tiles are offset; never allow sideways scroll */
}

.home-container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ---------- Top bar ---------- */
.home-topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.home-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}
.home-logo-link { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); }
.home-logo {
    width: 42px; height: 42px; border-radius: 11px;
    overflow: hidden; display: inline-flex; flex-shrink: 0;
}
.home-logo img { width: 100%; height: 100%; display: block; }
.home-logo-icon { background: var(--brand); color: #fff; font-size: 1.2rem; align-items: center; justify-content: center; }
.home-logo-text { font-weight: 700; font-size: 1.05rem; }
.home-topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.home-lang { display: inline-flex; gap: 0.2rem; padding: 0.2rem; border: 1px solid var(--line); border-radius: 9px; }
.home-lang-btn { padding: 0.25rem 0.7rem; border-radius: 7px; font-size: 0.82rem; font-weight: 600; text-decoration: none; color: var(--muted); }
.home-lang-btn.active { background: var(--brand); color: #fff; }

/* ---------- Buttons ---------- */
.home-btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 1.1rem; border-radius: 10px;
    font-weight: 600; font-size: 0.95rem; text-decoration: none;
    border: 1.5px solid transparent; cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.home-btn:hover { transform: translateY(-1px); }
.home-btn-lg { padding: 0.85rem 1.5rem; font-size: 1rem; }
.home-btn-primary { background: var(--brand); color: #fff; box-shadow: 0 10px 20px -10px rgba(13,148,136,0.7); }
.home-btn-primary:hover { background: var(--brand-dark); color: #fff; }
.home-btn-outline { background: #fff; color: var(--brand-dark); border-color: var(--line); }
.home-btn-outline:hover { border-color: var(--brand); }
.home-btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.home-btn-ghost:hover { border-color: var(--brand); color: var(--brand-dark); }

/* ---------- Hero ---------- */
.home-hero {
    background:
        radial-gradient(900px 380px at 85% -10%, rgba(13,148,136,0.12), transparent 70%),
        radial-gradient(700px 320px at 0% 120%, rgba(37,99,235,0.10), transparent 70%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 4rem 0 4.5rem;
    border-bottom: 1px solid var(--line);
}
.home-hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2.5rem;
    align-items: center;
}
.home-pill {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.4rem 0.9rem; border-radius: 999px;
    background: rgba(13,148,136,0.1); color: var(--brand-dark);
    font-size: 0.8rem; font-weight: 600; margin-bottom: 1.1rem;
}
.home-title {
    font-size: 3rem; line-height: 1.08; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 1rem;
    background: linear-gradient(120deg, #0f172a 0%, var(--brand-dark) 70%, var(--brand) 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.home-lead { font-size: 1.18rem; color: var(--muted); margin: 0 0 1.8rem; max-width: 30rem; }
.home-cta { display: flex; flex-wrap: wrap; gap: 0.8rem; }

.home-stats { display: flex; gap: 2rem; margin-top: 2.25rem; flex-wrap: wrap; }
.home-stat strong { display: block; font-size: 1.7rem; font-weight: 800; color: var(--ink); line-height: 1; }
.home-stat span { font-size: 0.82rem; color: var(--muted); }
.home-stat + .home-stat { padding-inline-start: 2rem; border-inline-start: 1px solid var(--line); }

/* Hero artwork — the PSB agriculture emblem */
.home-hero-emblem {
    width: 100%; max-width: 320px; height: auto; display: block; margin: 0 auto;
    filter: drop-shadow(0 22px 40px rgba(15, 23, 42, 0.18));
    animation: floatY 6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .home-hero-emblem { animation: none; } }

/* Hero artwork — themed portal tiles */
.home-hero-art { position: relative; min-height: 280px; display: grid; place-items: center; }
.home-art-glow {
    position: absolute; inset: 12% 18%; border-radius: 50%;
    background: radial-gradient(circle, rgba(13,148,136,0.18), transparent 70%);
    filter: blur(30px); z-index: 0;
}
.home-art-tile {
    position: absolute; width: 120px; height: 120px; border-radius: 26px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 3rem; z-index: 1;
    box-shadow: 0 25px 45px -20px rgba(15,23,42,0.45);
}
.home-art-tile.t-farmer { background: linear-gradient(135deg, var(--c-farmer), var(--c-farmer-dark)); transform: translate(-70px,-30px) rotate(-8deg); animation: floatY 5s ease-in-out infinite; }
.home-art-tile.t-buyer  { background: linear-gradient(135deg, var(--c-buyer), var(--c-buyer-dark)); transform: translate(60px,-50px) rotate(7deg); width:130px; height:130px; animation: floatY 6s ease-in-out infinite 0.6s; }
.home-art-tile.t-pest   { background: linear-gradient(135deg, var(--c-pest), var(--c-pest-dark)); transform: translate(10px,70px) rotate(-3deg); animation: floatY 5.5s ease-in-out infinite 1.1s; }

@keyframes floatY {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -14px; }
}
@media (prefers-reduced-motion: reduce) {
    .home-art-tile { animation: none !important; }
}

/* ---------- Portals ---------- */
.home-portals { padding: 4rem 0 4.5rem; scroll-margin-top: 84px; }
/* Standalone portal-select (login) page: center the tiles in the viewport. */
.home-portals-login { min-height: calc(100vh - 69px); display: flex; align-items: center; }
.home-portals-login > .home-container { width: 100%; }
.home-section-head { text-align: center; max-width: 40rem; margin: 0 auto 2.5rem; }
.home-section-head h2 { font-size: 2rem; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 0.5rem; }
.home-section-head p { color: var(--muted); font-size: 1.05rem; margin: 0; }

.home-portal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }

.portal-card {
    display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 18px; overflow: hidden; text-decoration: none; color: var(--ink);
    box-shadow: 0 1px 3px rgba(15,23,42,0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.portal-card:hover { transform: translateY(-6px); box-shadow: 0 28px 50px -28px rgba(15,23,42,0.4); }
.portal-media {
    height: 150px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 3.6rem; position: relative;
}
.portal-media::after {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(120px 80px at 80% 20%, rgba(255,255,255,0.25), transparent 70%);
}
.pc-farmer .portal-media { background: linear-gradient(135deg, var(--c-farmer), var(--c-farmer-dark)); }
.pc-buyer .portal-media  { background: linear-gradient(135deg, var(--c-buyer), var(--c-buyer-dark)); }
.pc-pest .portal-media   { background: linear-gradient(135deg, var(--c-pest), var(--c-pest-dark)); }
.pc-farmer:hover { border-color: var(--c-farmer); }
.pc-buyer:hover  { border-color: var(--c-buyer); }
.pc-pest:hover   { border-color: var(--c-pest); }

.portal-body { padding: 1.4rem 1.5rem 1.6rem; flex: 1; display: flex; flex-direction: column; }
.portal-body h3 { font-size: 1.2rem; font-weight: 700; margin: 0 0 0.5rem; }
.portal-body p { color: var(--muted); font-size: 0.92rem; margin: 0 0 1.3rem; flex: 1; }

.portal-actions { display: flex; gap: 0.6rem; margin-top: auto; }
.portal-btn {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.6rem 0.5rem; border-radius: 10px;
    font-weight: 600; font-size: 0.9rem; text-decoration: none;
    border: 1.5px solid transparent; transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
}
.portal-btn:hover { transform: translateY(-1px); }
.portal-btn-fill { color: #fff; }
.portal-btn-fill:hover { color: #fff; filter: brightness(0.94); }
.portal-btn-outline { background: #fff; border-color: var(--line); }

.pc-farmer .portal-btn-fill { background: linear-gradient(135deg, var(--c-farmer), var(--c-farmer-dark)); }
.pc-buyer  .portal-btn-fill { background: linear-gradient(135deg, var(--c-buyer), var(--c-buyer-dark)); }
.pc-pest   .portal-btn-fill { background: linear-gradient(135deg, var(--c-pest), var(--c-pest-dark)); }
.pc-farmer .portal-btn-outline { color: var(--c-farmer-dark); }
.pc-buyer  .portal-btn-outline { color: var(--c-buyer-dark); }
.pc-pest   .portal-btn-outline { color: var(--c-pest-dark); }
.pc-farmer .portal-btn-outline:hover { border-color: var(--c-farmer); }
.pc-buyer  .portal-btn-outline:hover { border-color: var(--c-buyer); }
.pc-pest   .portal-btn-outline:hover { border-color: var(--c-pest); }

/* ---------- Features band ---------- */
.home-features { background: #fff; border-top: 1px solid var(--line); padding: 2.5rem 0; }
.home-features-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.home-feature { display: flex; align-items: center; gap: 0.85rem; }
.home-feature-ico {
    width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(13,148,136,0.1); color: var(--brand); font-size: 1.3rem;
}
.home-feature strong { display: block; font-size: 0.95rem; }
.home-feature span { font-size: 0.82rem; color: var(--muted); }

/* ---------- Simple content pages (About / Contact) ---------- */
.home-hero-center { max-width: 760px; margin: 0 auto; text-align: center; }
.home-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.25rem; }
.home-info-card {
    display: flex; gap: 0.9rem; align-items: flex-start;
    padding: 1.35rem; background: #fff; border: 1px solid var(--line); border-radius: 14px;
    text-decoration: none; color: var(--ink);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.home-info-card:hover { transform: translateY(-3px); box-shadow: 0 18px 36px -22px rgba(15,23,42,0.4); border-color: var(--brand); }
.home-info-card .ico {
    width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(13,148,136,0.1); color: var(--brand); font-size: 1.3rem;
}
.home-info-card strong { display: block; font-size: 1rem; margin-bottom: 0.15rem; }
.home-info-card span { color: var(--muted); font-size: 0.9rem; word-break: break-word; }

/* Colored tiles (About / Contact) — same look as the home portal tiles. */
.home-tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.home-tile {
    display: flex; flex-direction: column;
    background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
    text-decoration: none; color: var(--ink);
    box-shadow: 0 1px 3px rgba(15,23,42,0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.home-tile:hover { transform: translateY(-6px); box-shadow: 0 28px 50px -28px rgba(15,23,42,0.4); }
.home-tile-media {
    height: 92px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 2.5rem; position: relative;
}
.home-tile-media::after {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(120px 70px at 80% 20%, rgba(255,255,255,0.28), transparent 70%);
}
.home-tile-body { padding: 1.15rem 1.3rem 1.35rem; flex: 1; }
.home-tile-body strong { display: block; font-size: 1.08rem; margin-bottom: 0.25rem; }
.home-tile-body span { color: var(--muted); font-size: 0.92rem; word-break: break-word; }

.ht-1 .home-tile-media { background: linear-gradient(135deg, #0d9488, #0f766e); }
.ht-2 .home-tile-media { background: linear-gradient(135deg, #16a34a, #15803d); }
.ht-3 .home-tile-media { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.ht-4 .home-tile-media { background: linear-gradient(135deg, #ea580c, #c2410c); }
.ht-5 .home-tile-media { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.ht-6 .home-tile-media { background: linear-gradient(135deg, #0891b2, #0e7490); }
.ht-1:hover { border-color: #0d9488; }
.ht-2:hover { border-color: #16a34a; }
.ht-3:hover { border-color: #2563eb; }
.ht-4:hover { border-color: #ea580c; }
.ht-5:hover { border-color: #7c3aed; }
.ht-6:hover { border-color: #0891b2; }

/* ---------- Footer ---------- */
.home-footer-bar {
    border-top: 1px solid var(--line);
    background: #fff; padding: 1.4rem 0;
    color: var(--muted); font-size: 0.85rem;
}
.home-footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; }
.home-footer-links { display: flex; gap: 1.25rem; }
.home-footer-links a { color: var(--muted); text-decoration: none; font-weight: 600; }
.home-footer-links a:hover { color: var(--brand-dark); }

/* ============== Responsive: tablet & mobile ============== */

/* Tablet — tighten vertical rhythm, keep multi-column where it still fits. */
@media (max-width: 992px) {
    .home-hero { padding: 3.25rem 0 3.5rem; }
    .home-portals, .home-features { padding: 3rem 0; }
    .home-title { font-size: 2.6rem; }
}

/* Hero + portals stack; center the copy for a clean stacked look. */
@media (max-width: 900px) {
    .home-hero-grid { grid-template-columns: 1fr; gap: 2rem; text-align: center; }
    .home-hero-copy { display: flex; flex-direction: column; align-items: center; }
    .home-lead { margin-inline: auto; }
    .home-cta { justify-content: center; }
    .home-stats { justify-content: center; }
    .home-hero-art { order: -1; min-height: 210px; }
    .home-title { font-size: 2.3rem; }
    .home-portal-grid { grid-template-columns: 1fr; max-width: 460px; margin-inline: auto; }
}

@media (max-width: 700px) {
    .home-features-grid { grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
    .home-footer-inner { flex-direction: column; }
}

/* Phones — shrink the decorative tiles so they never overflow, trim padding. */
@media (max-width: 600px) {
    .home-hero { padding: 2.25rem 0 2.5rem; }
    .home-portals, .home-features { padding: 2.5rem 0; }
    .home-title { font-size: 2rem; }
    .home-lead { font-size: 1.05rem; }
    .home-section-head { margin-bottom: 2rem; }
    .home-section-head h2 { font-size: 1.6rem; }
    .home-hero-art { min-height: 175px; }
    .home-art-tile { width: 90px; height: 90px; font-size: 2.1rem; border-radius: 20px; }
    .home-art-tile.t-buyer { width: 100px; height: 100px; }
    .home-stats { gap: 1.25rem; }
    .home-stat strong { font-size: 1.45rem; }
    .home-stat + .home-stat { padding-inline-start: 1.25rem; }
}

@media (max-width: 480px) {
    .home-logo-text { display: none; }
    .home-title { font-size: 1.8rem; }
    .home-cta { width: 100%; }
    .home-cta .home-btn { flex: 1; justify-content: center; }
    .home-features-grid { grid-template-columns: 1fr; }
}

/* Very small — pull the offset tiles inward so they stay on screen. */
@media (max-width: 360px) {
    .home-art-tile.t-farmer { transform: translate(-50px,-22px) rotate(-8deg); }
    .home-art-tile.t-buyer  { transform: translate(44px,-38px) rotate(7deg); }
    .home-art-tile.t-pest   { transform: translate(6px,50px) rotate(-3deg); }
}
