/* ==========================================================================
   TerraNile - custom styles that complement Tailwind utilities
   ========================================================================== */

html { scroll-behavior: smooth; }
html.no-scroll, html.no-scroll body { overflow: hidden; }

body {
  background-color: #FAF4E6;
  color: #1B2A21;
  font-family: 'DM Sans', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: 'Outfit', ui-sans-serif, system-ui, sans-serif; }

::selection { background: #F5BD57; color: #06180E; }
:focus-visible { outline: 3px solid #E38B12; outline-offset: 2px; }

/* ---------- Texture helpers ---------- */
.dot-light {
  background-image: radial-gradient(rgba(255,255,255,.9) 1.1px, transparent 1.3px);
  background-size: 20px 20px;
}
.dot-dark {
  background-image: radial-gradient(rgba(23, 80, 46, .16) 1.4px, transparent 1.6px);
  background-size: 18px 18px;
}
.grain {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  opacity: .22;
  pointer-events: none;
}
.blob { position: absolute; border-radius: 9999px; filter: blur(70px); opacity: .55; pointer-events: none; z-index: 0; }
.blob-gold { background: #F5BD57; }
.blob-green { background: #7DB992; }
.blob-rose { background: #F3B6A4; }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s cubic-bezier(.22,1,.36,1); }
.reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }

/* ---------- Header ---------- */
.tn-header { transition: background-color .35s ease, border-color .35s ease, box-shadow .35s ease; border-bottom: 1px solid transparent; }
.tn-header[data-solid="true"] {
  background: rgba(250, 244, 230, .9);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom-color: #E6DCC6;
}
.tn-header[data-open="true"] { background: #06180E; border-bottom-color: rgba(255,255,255,.08); -webkit-backdrop-filter: none; backdrop-filter: none; }

.tn-header .tn-link { color: rgba(255,255,255,.92); }
.tn-header .tn-link:hover { color: #F5BD57; }
.tn-header[data-solid="true"]:not([data-open="true"]) .tn-link { color: #113D24; }
.tn-header[data-solid="true"]:not([data-open="true"]) .tn-link:hover { color: #2F7D4C; }

.tn-header .tn-word { color: #fff; }
.tn-header .tn-tag { color: rgba(245,189,87,.85); }
.tn-header[data-solid="true"]:not([data-open="true"]) .tn-word { color: #0B2E1A; }
.tn-header[data-solid="true"]:not([data-open="true"]) .tn-tag { color: #2F7D4C; }

.tn-iconbtn { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.2); transition: background-color .25s ease, color .25s ease, border-color .25s ease, transform .25s ease; }
.tn-iconbtn:hover { background: rgba(255,255,255,.2); }
.tn-header[data-solid="true"]:not([data-open="true"]) .tn-iconbtn { background: #fff; color: #17502E; border-color: #E6DCC6; }
.tn-header[data-solid="true"]:not([data-open="true"]) .tn-iconbtn:hover { border-color: #2F7D4C; }

.tn-cta { background: #F5BD57; color: #06180E; }
.tn-cta:hover { background: #FAD791; }
.tn-header[data-solid="true"]:not([data-open="true"]) .tn-cta { background: #17502E; color: #fff; }
.tn-header[data-solid="true"]:not([data-open="true"]) .tn-cta:hover { background: #113D24; }

.nav-link { position: relative; }
.nav-link::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: #E38B12;
  transform: scaleX(0); transform-origin: left; transition: transform .25s ease;
}
.nav-link:hover::after, .nav-link[aria-current="page"]::after { transform: scaleX(1); }

.basket-count[hidden] { display: none; }

/* Mobile menu */
.mobile-menu { opacity: 0; transition: opacity .3s ease; }
.mobile-menu.is-open { opacity: 1; }
.mobile-menu .mobile-link { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease, color .2s ease; }
.mobile-menu.is-open .mobile-link { opacity: 1; transform: none; }

/* ---------- Social buttons ---------- */
.social-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: 9999px;
  transition: transform .25s ease, background-color .25s ease, color .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.social-btn:hover { transform: translateY(-3px) scale(1.06); }
.social-btn svg { width: 1.05rem; height: 1.05rem; fill: currentColor; }

.social-dark, .social-auto { background: rgba(255,255,255,.1); color: #FDEBC8; border: 1px solid rgba(255,255,255,.18); }
.tn-header[data-solid="true"]:not([data-open="true"]) .social-auto { background: #fff; color: #17502E; border-color: #E6DCC6; }
.social-dark.fb:hover, .social-auto.fb:hover { background: #1877F2; color: #fff; border-color: #1877F2; box-shadow: 0 8px 18px -6px rgba(24,119,242,.6); }
.social-dark.wa:hover, .social-auto.wa:hover { background: #25D366; color: #fff; border-color: #25D366; box-shadow: 0 8px 18px -6px rgba(37,211,102,.6); }
.social-dark.li:hover, .social-auto.li:hover { background: #0A66C2; color: #fff; border-color: #0A66C2; box-shadow: 0 8px 18px -6px rgba(10,102,194,.6); }

/* ---------- Hero ---------- */
@keyframes tn-kenburns { from { transform: scale(1.04); } to { transform: scale(1.15) translate3d(-1.2%, -.8%, 0); } }
.hero-kb { animation: tn-kenburns 26s ease-in-out infinite alternate; transform-origin: 60% 40%; }

@keyframes tn-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
.scroll-cue span { animation: tn-bob 2s ease-in-out infinite; }

.glass { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }

/* ---------- Marquee ---------- */
@keyframes tn-marquee { to { transform: translateX(-50%); } }
.marquee-track { display: flex; width: max-content; animation: tn-marquee 46s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }

/* ---------- Crop cards + season strip ---------- */
.crop-card { transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease; }
.crop-card:hover { transform: translateY(-6px); box-shadow: 0 28px 44px -24px rgba(11,46,26,.4); border-color: #E38B12; }
.crop-card img.crop-img { transition: transform .7s ease; }
.crop-card:hover img.crop-img { transform: scale(1.07); }
.stretch-link::after { content: ''; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card-action { position: relative; z-index: 2; }

.sea-pill { display: block; flex: 1 1 0; height: 12px; border-radius: 9999px; background: #EFE6D2; }
.sea-pill.is-on { background: #2A6A45; }
.sea-pill.is-now { box-shadow: inset 0 0 0 1.5px #E38B12; }
.sea-pill.is-on.is-now { background: #E38B12; box-shadow: none; }

/* ---------- Harvest calendar ---------- */
.cal { --lab: 112px; }
@media (min-width: 640px) { .cal { --lab: 212px; } }
.cal-head, .cal-row { display: flex; align-items: center; }
.cal-label { flex: 0 0 var(--lab); width: var(--lab); min-width: 0; display: flex; align-items: center; gap: .6rem; padding-right: .5rem; }
.cal-months, .cal-track { flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.cal-month { text-align: center; font-size: .6rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #7DB992; position: relative; padding-bottom: .5rem; }
.cal-month .m-full { display: none; }
@media (min-width: 640px) { .cal-month .m-full { display: inline; } .cal-month .m-short { display: none; } }
.cal-month.is-now { color: #F5BD57; }
.cal-month.is-now::after { content: ''; position: absolute; left: 50%; bottom: 0; width: 4px; height: 4px; margin-left: -2px; border-radius: 9999px; background: #F5BD57; }
.cal-body { position: relative; }
.cal-now {
  position: absolute; top: -8px; bottom: -8px; border-radius: 10px; background: rgba(255,255,255,.07); pointer-events: none;
  left: calc(var(--lab) + (100% - var(--lab)) * var(--m) / 12);
  width: calc((100% - var(--lab)) / 12);
}
.cal-row { height: 44px; position: relative; text-decoration: none; }
.cal-row + .cal-row { margin-top: 2px; }
.cal-thumb { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 9999px; overflow: hidden; background: #17502E; border: 1px solid rgba(255,255,255,.18); }
.cal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cal-name { font-size: .74rem; font-weight: 600; color: #fff; line-height: 1.2; transition: color .2s ease; overflow-wrap: anywhere; }
@media (min-width: 640px) { .cal-name { font-size: .82rem; } .cal-thumb { width: 32px; height: 32px; } }
.cal-row:hover .cal-name, .cal-row:focus-visible .cal-name { color: #F5BD57; }
.cal-track { align-items: center; height: 100%; }
.cal-tick { grid-row: 1; justify-self: center; width: 1.5px; height: 12px; border-radius: 2px; background: rgba(255,255,255,.14); }
.cal-bar {
  grid-row: 1; height: 16px; border-radius: 9999px; z-index: 1;
  background: linear-gradient(90deg, #F5BD57, #EFA52E);
  box-shadow: 0 6px 16px -8px rgba(245,189,87,.8);
  transition: filter .25s ease, transform .25s ease;
  margin-inline: 1px;
}
.cal-bar.flat-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.cal-bar.flat-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.cal-row:hover .cal-bar { filter: brightness(1.1); transform: scaleY(1.15); }
.cal-bar.is-skel { background: rgba(255,255,255,.12); box-shadow: none; }

/* ---------- Export map ---------- */
.map-scroller { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.map-scroller::-webkit-scrollbar { display: none; }
.map-wrap { position: relative; min-width: 760px; aspect-ratio: 1000 / 394.44; }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.map-land { stroke: rgba(125,185,146,.34); stroke-width: 3.1; stroke-linecap: round; fill: none; }
.route { fill: none; stroke: #F5BD57; stroke-width: 1.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; transition: stroke-dashoffset 1.4s cubic-bezier(.22,1,.36,1), opacity .4s ease; }
.route.is-on { stroke-dashoffset: 0; opacity: .85; }
.route-dot { fill: #FDEBC8; }
.pin { position: absolute; width: 36px; height: 36px; margin: -18px 0 0 -18px; display: grid; place-items: center; border-radius: 9999px; background: transparent; border: 0; cursor: pointer; z-index: 2; transition: opacity .35s ease, transform .25s ease; }
.pin::before { content: ''; width: 9px; height: 9px; border-radius: 9999px; background: #F5BD57; box-shadow: 0 0 0 4px rgba(245,189,87,.25); transition: transform .25s ease, background-color .25s ease; }
.pin:hover::before, .pin:focus-visible::before, .pin.is-open::before { transform: scale(1.5); background: #fff; }
.pin.is-dim { opacity: .22; }
.pin.is-origin { z-index: 3; }
.pin.is-origin::before { width: 14px; height: 14px; background: #fff; box-shadow: 0 0 0 5px rgba(245,189,87,.5); }
.pin.is-origin::after { content: ''; position: absolute; width: 14px; height: 14px; border-radius: 9999px; border: 2px solid #F5BD57; animation: tn-pulse 2.4s ease-out infinite; }
@keyframes tn-pulse { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(4.2); opacity: 0; } }
.pin-tip {
  position: absolute; left: 50%; bottom: calc(100% - 4px); transform: translate(-50%, 6px); min-width: 11rem; max-width: 15rem;
  padding: .7rem .85rem; border-radius: .9rem; background: #FAF4E6; color: #0B2E1A; text-align: left; font-size: .78rem; line-height: 1.35;
  box-shadow: 0 18px 40px -16px rgba(0,0,0,.6); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.pin:hover .pin-tip, .pin:focus-visible .pin-tip, .pin.is-open .pin-tip { opacity: 1; transform: translate(-50%, 0); }
.pin.tip-below .pin-tip { bottom: auto; top: calc(100% - 4px); transform: translate(-50%, -6px); }
.pin.tip-below:hover .pin-tip, .pin.tip-below:focus-visible .pin-tip, .pin.tip-below.is-open .pin-tip { transform: translate(-50%, 0); }
.pin.tip-left .pin-tip { left: auto; right: -8px; transform: translate(0, 6px); }
.pin.tip-left:hover .pin-tip, .pin.tip-left:focus-visible .pin-tip, .pin.tip-left.is-open .pin-tip { transform: none; }
.pin.tip-right .pin-tip { left: -8px; transform: translate(0, 6px); }
.pin.tip-right:hover .pin-tip, .pin.tip-right:focus-visible .pin-tip, .pin.tip-right.is-open .pin-tip { transform: none; }

.mkchip { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .5rem 1rem; border-radius: 9999px; font-size: .88rem; font-weight: 600; color: #D6EADD; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16); transition: background-color .2s ease, color .2s ease, border-color .2s ease; }
.mkchip:hover { border-color: rgba(245,189,87,.6); }
.mkchip[aria-pressed="true"] { background: #F5BD57; color: #06180E; border-color: #F5BD57; }

/* ---------- Buttons / chips / forms ---------- */
.is-armed { background: #DC2626 !important; color: #fff !important; border-color: #DC2626 !important; }

.field {
  width: 100%; border-radius: .85rem; border: 1px solid #E6DCC6; background: #fff; padding: .8rem 1rem; font-size: 1rem; color: #1B2A21;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field::placeholder { color: #9AA59E; }
.field:focus { outline: none; border-color: #2F7D4C; box-shadow: 0 0 0 4px rgba(47, 125, 76, .15); }
textarea.field { line-height: 1.5; }

.pchip {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .45rem .95rem; border-radius: 9999px;
  border: 1px solid #E6DCC6; background: #fff; font-size: .88rem; font-weight: 600; color: #113D24; transition: all .2s ease; cursor: pointer;
}
.pchip:hover { border-color: #4F9A6A; }
.pchip[aria-pressed="true"] { background: #17502E; border-color: #17502E; color: #fff; }
.pchip.is-gold[aria-pressed="true"] { background: #E38B12; border-color: #E38B12; }

.skel { background: linear-gradient(90deg, #EFE6D2 0%, #F8F2E4 50%, #EFE6D2 100%); background-size: 200% 100%; animation: tn-shimmer 1.4s linear infinite; }
@keyframes tn-shimmer { to { background-position: -200% 0; } }

/* Toast (bottom-centre so it never collides with the floating buttons) */
.toast {
  position: fixed; left: 50%; right: auto; width: max-content; max-width: calc(100vw - 2rem); z-index: 100;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  padding: .85rem 1.1rem; border-radius: .9rem; background: #0B2E1A; color: #fff; box-shadow: 0 18px 40px -16px rgba(0,0,0,.5);
  transform: translate(-50%, 20px); opacity: 0; transition: all .3s ease; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: #9B1C1C; }

/* ---------- Quote drawer ---------- */
.drawer-backdrop { opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }
.basket-drawer { transform: translateX(100%); visibility: hidden; transition: transform .38s cubic-bezier(.22,1,.36,1), visibility 0s linear .38s; }
.basket-drawer.is-open { transform: none; visibility: visible; transition: transform .38s cubic-bezier(.22,1,.36,1), visibility 0s linear 0s; }

/* ---------- Vision / Mission floating pressable cards ---------- */
@keyframes tn-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.float-card { animation: tn-float 6s ease-in-out infinite; animation-delay: var(--float-delay, 0s); }
.float-card:hover, .float-card.is-open { animation-play-state: paused; }
.flip-card { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .2s ease, box-shadow .3s ease, border-color .3s ease; }
.flip-card:hover { transform: translateY(-4px); box-shadow: 0 26px 44px -22px rgba(11, 46, 26, .4); border-color: #E38B12; }
.flip-card:active { transform: scale(.97); }
.flip-card[aria-expanded="true"] { border-color: #E38B12; }
.flip-plus { transition: transform .3s ease, background-color .3s ease, color .3s ease; }
.flip-card[aria-expanded="true"] .flip-plus { transform: rotate(45deg); background: #E38B12; color: #fff; }
.flip-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s ease; }
.flip-more-inner { display: block; min-height: 0; overflow: hidden; }
.flip-card[aria-expanded="true"] .flip-more { grid-template-rows: 1fr; }

/* ---------- Floating footer cards + action buttons ---------- */
@keyframes tn-float-soft { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
/* Footer contact cards stay still so the email / phone links are easy to click */
.float-soft { animation: none; }
.float-soft:hover { animation-play-state: paused; }
.icon-fill svg { fill: currentColor; }

.fab-top { opacity: 0; pointer-events: none; transform: translateY(10px) scale(.9); transition: opacity .3s ease, transform .3s ease, background-color .2s ease; }
.fab-top.is-on { opacity: 1; pointer-events: auto; transform: none; }
.fab-wa::before { content: ''; position: absolute; inset: 0; border-radius: 9999px; background: #25D366; opacity: .5; z-index: -1; animation: tn-ping 2.4s cubic-bezier(0, 0, .2, 1) infinite; }
@keyframes tn-ping { 0% { transform: scale(1); opacity: .5; } 80%, 100% { transform: scale(1.7); opacity: 0; } }

/* Touch screens: comfortable 44px targets */
@media (pointer: coarse) {
  .social-btn { width: 2.75rem; height: 2.75rem; }
  .social-btn svg { width: 1.2rem; height: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-kb, .marquee-track, .float-card, .float-soft, .fab-wa::before, .scroll-cue span, .pin.is-origin::after, .skel { animation: none; }
  .flip-more, .flip-plus, .flip-card, .fab-top, .route { transition: none; }
}

/* Add-to-quote toggle (pressed state) */
.qbtn[aria-pressed="true"] { background: #17502E; color: #fff; border-color: #17502E; }

/* Outfit has no italic: keep emphasised words upright, coloured only */
h1 em, h2 em, h3 em, .font-display.italic { font-style: normal !important; }

/* Nav underline follows the hovered link (current page's line hides while another is hovered) */
.nav-link[aria-current="page"]::after { transition: transform .25s ease; }
nav:hover .nav-link[aria-current="page"]:not(:hover)::after { transform: scaleX(0); }
nav:hover .nav-link[aria-current="page"]:not(:hover) { opacity: .8; }

/* Quote basket button: always solid and visible */
.tn-header .tn-basket, .tn-header[data-solid="true"]:not([data-open="true"]) .tn-basket { background: #fff; color: #17502E; border: 1px solid #fff; box-shadow: 0 4px 14px -4px rgba(0,0,0,.35); }
.tn-header .tn-basket:hover { background: #FDEBC8; }
