/* ==========================================================
   TaskTide global styles (all pages + admin)
   Palette: navy #0f172a, card #1e293b, white text, accent #38bdf8
   Type: Bricolage Grotesque (headings) + IBM Plex Sans (body)
   ========================================================== */

:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-border: #334155;
  --text: #ffffff;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-dark: #0c4a6e;
  --danger: #f87171;
  --radius: 16px;
  --font-display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 1rem/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  animation: page-in 0.5s ease both;
}
@keyframes page-in { from { opacity: 0; } }
[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 0.5em; }
h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.container { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* ---------- Icons (injected by script.js from [data-icon]) ---------- */
.icon { display: inline-flex; width: 1.2em; height: 1.2em; vertical-align: -0.22em; flex: none; }
.icon svg { width: 100%; height: 100%; }
.icon-tile {
  width: 52px; height: 52px; border-radius: 14px; margin-bottom: 1.1rem;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
}
.icon-tile .icon { width: 26px; height: 26px; }

/* ---------- Header / navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 23, 42, 0.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent; transition: border-color 0.25s, box-shadow 0.25s;
}
.site-header.scrolled { border-color: var(--card-border); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; font: 800 1.4rem var(--font-display); letter-spacing: -0.03em; color: var(--text); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; color: var(--accent); }

.nav { display: flex; align-items: center; gap: 0.4rem; }
.nav a:not(.btn) { color: var(--muted); text-decoration: none; font-weight: 500; padding: 0.5rem 0.9rem; border-radius: 8px; transition: color 0.2s, background 0.2s; }
.nav a:not(.btn):hover { color: var(--text); background: var(--accent-soft); }
.nav a[aria-current="page"] { color: var(--accent); }
.nav .btn { margin-left: 0.6rem; }
.nav-toggle { display: none; background: none; border: 1px solid var(--card-border); color: var(--text); border-radius: 10px; width: 44px; height: 44px; font-size: 1.3rem; cursor: pointer; place-items: center; }

@media (max-width: 820px) {
  .nav-toggle { display: grid; }
  .nav {
    position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--bg); border-bottom: 1px solid var(--card-border); padding: 0.75rem 1.25rem 1.25rem;
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  }
  .site-header.open .nav { transform: none; opacity: 1; pointer-events: auto; }
  .nav .btn { margin: 0.5rem 0 0; text-align: center; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: var(--accent); color: var(--bg); border: 2px solid var(--accent); border-radius: 10px;
  padding: 0.8rem 1.4rem; font: 600 1rem var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}
.btn:hover { background: #7dd3fc; border-color: #7dd3fc; box-shadow: 0 8px 24px rgba(56, 189, 248, 0.25); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn-outline { background: transparent; color: var(--accent); }
.btn-outline:hover { background: var(--accent-soft); border-color: var(--accent); box-shadow: none; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(248, 113, 113, 0.12); color: var(--danger); border-color: transparent; box-shadow: none; }
.btn-small { padding: 0.45rem 1rem; font-size: 0.9rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 5.5rem 0 9rem; }
.hero-grid { position: relative; z-index: 1; display: grid; gap: 3.5rem; align-items: center; }
@media (min-width: 940px) { .hero-grid { grid-template-columns: 1.1fr 0.9fr; } }
.hero h1 { font-size: clamp(2.5rem, 6.5vw, 4.6rem); font-weight: 800; max-width: 14ch; margin-bottom: 0.4em; }
.hero-lead { max-width: 54ch; color: var(--muted); font-size: 1.15rem; margin-bottom: 2rem; }
.hero-points { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 0.6rem; color: var(--muted); }
.hero-points .icon { color: var(--accent); margin-right: 0.5rem; }

/* Live "automation run" card: nodes light up in sequence while a packet travels down the line */
.flow-card { background: var(--card); border: 1px solid var(--card-border); border-radius: 20px; padding: 1.5rem; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35); }
.flow-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; font: 600 1.05rem var(--font-display); }
.live { display: inline-flex; align-items: center; gap: 0.45rem; font: 500 0.85rem var(--font-body); color: var(--accent); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; transform: scale(0.8); } }
.flow { list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: 0.9rem; }
.flow::before { content: ""; position: absolute; left: 29px; top: 24px; bottom: 24px; width: 2px; background: var(--card-border); }
.flow::after {
  content: ""; position: absolute; left: 25px; top: 20px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 14px var(--accent); animation: packet 8s linear infinite;
}
@keyframes packet { 0% { top: 20px; opacity: 0; } 6% { opacity: 1; } 92% { opacity: 1; } 100% { top: calc(100% - 30px); opacity: 0; } }
.flow-node { position: relative; z-index: 1; display: flex; align-items: center; gap: 0.9rem; background: var(--bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 0.7rem 0.9rem; animation: lit 8s infinite; }
.flow-node:nth-child(2) { animation-delay: 2s; }
.flow-node:nth-child(3) { animation-delay: 4s; }
.flow-node:nth-child(4) { animation-delay: 6s; }
@keyframes lit { 0%, 22% { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); } 30%, 100% { border-color: var(--card-border); box-shadow: none; } }
.flow-node .icon-tile { width: 40px; height: 40px; margin: 0; border-radius: 10px; }
.flow-node .icon-tile .icon { width: 20px; height: 20px; }
.flow-node strong { display: block; font-weight: 600; line-height: 1.2; }
.flow-node span { font-size: 0.85rem; color: var(--muted); }

/* Drifting tide at the bottom of the hero */
.tide { position: absolute; left: 0; right: 0; bottom: 0; height: 110px; }
.tide svg { position: absolute; bottom: 0; left: 0; width: 200%; height: 100%; animation: drift 14s linear infinite; }
.tide svg:first-child { animation-duration: 22s; opacity: 0.6; }
.tide-back { fill: var(--accent-dark); }
.tide-front { fill: var(--card); }
@keyframes drift { to { transform: translateX(-50%); } }

/* ---------- Marquee ---------- */
.marquee { background: var(--card); padding: 0 0 1.4rem; overflow: hidden; }
.marquee-track { display: flex; width: max-content; animation: scroll 36s linear infinite; }
.marquee-track span { padding-right: 3.5rem; white-space: nowrap; color: var(--muted); font: 600 1.15rem var(--font-display); }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { padding: 5.5rem 0; }
.section-alt { background: var(--card); }
.section-head { max-width: 60ch; margin-bottom: 2.5rem; }
.section-lead { color: var(--muted); font-size: 1.1rem; }
.page-hero { padding: 4.5rem 0 3.5rem; border-bottom: 1px solid var(--card-border); }
.page-hero h1 { font-size: clamp(2.3rem, 5.5vw, 3.6rem); font-weight: 800; }
.page-hero p { color: var(--muted); font-size: 1.15rem; max-width: 56ch; margin: 0; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 1.75rem; transition: transform 0.25s, border-color 0.25s;
}
.section-alt .card { background: var(--bg); }
.card > * { position: relative; }
.card::before {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.3s; pointer-events: none;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(56, 189, 248, 0.16), transparent 70%);
}
.card:hover::before { opacity: 1; }
.card p { color: var(--muted); margin: 0; }
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover { transform: translateY(-5px); border-color: rgba(56, 189, 248, 0.55); }
.card-more { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 1rem; color: var(--accent); font-weight: 600; }
.card-link:hover .card-more .icon { transform: translateX(4px); }
.card-more .icon { transition: transform 0.2s; }

.service-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); }
.checks { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: 0.55rem; }
.checks li { display: flex; gap: 0.6rem; color: var(--text); }
.checks .icon { color: var(--accent); margin-top: 0.2em; }

/* ---------- Process timeline (a real sequence, so it is numbered) ---------- */
.timeline { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.timeline li { counter-increment: step; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1.5rem; }
.timeline li::before {
  content: counter(step); display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: var(--bg); font: 800 1.1rem var(--font-display); margin-bottom: 1rem;
}
.timeline p { color: var(--muted); margin: 0; }

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 0.75rem; max-width: 820px; }
.faq details { background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 0 1.25rem; transition: border-color 0.2s; }
.faq details[open] { border-color: rgba(56, 189, 248, 0.5); }
.faq summary { cursor: pointer; list-style: none; padding: 1.1rem 0; font-weight: 600; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { color: var(--accent); transition: transform 0.25s; }
.faq details[open] summary .icon { transform: rotate(45deg); }
.faq details p { color: var(--muted); padding-bottom: 1.1rem; margin: 0; }

/* ---------- CTA band ---------- */
.cta { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; justify-content: space-between; background: var(--card); border: 1px solid var(--card-border); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 2.25rem; }
.cta h2 { margin: 0 0 0.3em; font-size: clamp(1.5rem, 3vw, 2rem); }
.cta p { margin: 0; color: var(--muted); }

/* ---------- About (dynamic content) ---------- */
.portrait { position: relative; width: min(320px, 78vw); aspect-ratio: 1; border-radius: 50%; border: 4px solid var(--accent); padding: 8px; flex: none; }
.portrait::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--accent); animation: ring 3.2s ease-out infinite; pointer-events: none; }
@keyframes ring { from { transform: scale(1); opacity: 0.7; } to { transform: scale(1.16); opacity: 0; } }
.portrait-inner { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: var(--card); display: grid; place-items: center; }
.portrait-inner img { width: 100%; height: 100%; object-fit: cover; }
.initials { font: 800 4.5rem var(--font-display); color: var(--accent); }
.portrait-sm { width: 190px; }
.portrait-sm .initials { font-size: 3rem; }

.about-grid, .teaser { display: grid; gap: 3rem; align-items: center; justify-items: center; }
@media (min-width: 820px) { .about-grid { grid-template-columns: auto 1fr; justify-items: start; } .teaser { grid-template-columns: auto 1fr; justify-items: start; } }
.about-copy h1 { font-size: clamp(2.3rem, 5vw, 3.4rem); font-weight: 800; margin-bottom: 0.15em; }
.role { color: var(--accent); font: 600 1.25rem var(--font-display); margin-bottom: 1.25rem; }
.bio p { color: #cbd5e1; max-width: 62ch; }

.stats { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1.5rem; text-align: center; }
.stat strong { display: block; font: 800 clamp(2.2rem, 5vw, 3rem) var(--font-display); color: var(--accent); line-height: 1.1; }
.stat span { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.chip { background: var(--accent-soft); border: 1px solid rgba(56, 189, 248, 0.35); color: var(--accent); border-radius: 999px; padding: 0.4rem 1rem; font-weight: 500; }

.skeleton { display: block; height: 1em; border-radius: 6px; margin-bottom: 0.8em; background: linear-gradient(90deg, var(--card) 25%, #2a3a52 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Contact ---------- */
.contact-wrap { display: grid; gap: 3rem; }
@media (min-width: 920px) { .contact-wrap { grid-template-columns: 1fr 1.15fr; align-items: start; } }
.next-steps { list-style: none; padding: 0; margin: 0 0 2rem; display: grid; gap: 1rem; }
.next-steps li { display: flex; gap: 0.9rem; align-items: flex-start; }
.next-steps .icon-tile { width: 42px; height: 42px; margin: 0; border-radius: 11px; }
.next-steps .icon-tile .icon { width: 20px; height: 20px; }
.next-steps strong { display: block; }
.next-steps span { color: var(--muted); }

.vip-panel { background: var(--card); border: 1px solid var(--card-border); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 1.25rem; }
.vip-panel label { display: block; font-weight: 500; margin-bottom: 0.75rem; }
.vip-row { display: flex; gap: 0.6rem; }
.vip-row input { flex: 1; min-width: 0; }
.form-card { background: var(--card); border: 1px solid var(--card-border); border-radius: 20px; padding: 2rem; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 1.1rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label { font-weight: 500; }
input, textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--card-border);
  border-radius: 10px; padding: 0.8rem 1rem; font: 400 1rem var(--font-body);
}
input::placeholder, textarea::placeholder { color: #64748b; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25); }
textarea { resize: vertical; min-height: 130px; }
.form .btn { align-self: flex-start; }

.message { margin: 0.75rem 0 0; min-height: 1.4em; font-weight: 500; }
.message.success { color: var(--accent); }
.message.error { color: var(--danger); }
.message.neutral { color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--card-border); padding: 3.5rem 0 2rem; margin-top: 0; }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr; } }
.site-footer h3 { font-size: 1rem; margin-bottom: 0.8rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.footer-note { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--card-border); color: var(--muted); font-size: 0.9rem; }

/* ---------- Scroll reveal (animation, not transition, so hover effects still work) ---------- */
.js .reveal { opacity: 0; }
.js .reveal.in { opacity: 1; animation: rise 0.7s ease backwards; animation-delay: var(--d, 0s); }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } }

/* ---------- Admin ---------- */
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.login-card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--card-border); border-radius: 20px; padding: 2.25rem; }
.login-title { font-size: 1.6rem; margin: 0.75rem 0 0; }
.admin-main { padding: 2.5rem 0 4rem; }
.admin-title { font-size: 2rem; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--card-border); margin-bottom: 1.75rem; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 0.5rem; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 0.85rem 1rem; font: 500 1rem var(--font-body); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.stats-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.5rem; }
.stat-card { background: var(--card); border: 1px solid var(--card-border); border-radius: 14px; padding: 1.1rem 1.25rem; }
.stat-card span { color: var(--muted); font-size: 0.9rem; }
.stat-card strong { display: block; font: 800 2rem var(--font-display); color: var(--accent); line-height: 1.2; }

.toolbar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.toolbar input { max-width: 320px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); }
.leads-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.leads-table th, .leads-table td { text-align: left; vertical-align: top; padding: 0.9rem 1rem; border-bottom: 1px solid var(--card-border); }
.leads-table th { color: var(--muted); font-weight: 500; font-size: 0.9rem; white-space: nowrap; }
.leads-table tbody tr:last-child td { border-bottom: none; }
.leads-table td.details { max-width: 340px; white-space: pre-wrap; overflow-wrap: anywhere; }
.leads-table td.date { white-space: nowrap; color: var(--muted); }
.leads-table tr.is-vip { background: rgba(56, 189, 248, 0.08); }
.leads-table tr.is-vip td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.badge { display: inline-block; padding: 0.15rem 0.65rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600; background: var(--accent); color: var(--bg); }
.badge-no { background: transparent; color: var(--muted); border: 1px solid var(--card-border); font-weight: 500; }

.editor-grid { display: grid; gap: 1.5rem; }
@media (min-width: 900px) { .editor-grid { grid-template-columns: 300px 1fr; align-items: start; } }
.panel { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 1.5rem; }
.photo-drop { position: relative; aspect-ratio: 1; border-radius: 50%; border: 2px dashed var(--card-border); overflow: hidden; display: grid; place-items: center; margin: 0 auto 1.1rem; max-width: 220px; transition: border-color 0.2s, background 0.2s; text-align: center; color: var(--muted); }
.photo-drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.photo-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-empty { padding: 1rem; font-size: 0.9rem; }
.photo-empty .icon { width: 34px; height: 34px; display: block; margin: 0 auto 0.4rem; color: var(--accent); }
.stat-rows { display: grid; gap: 0.6rem; }
.stat-rows .pair { display: grid; grid-template-columns: 1fr 120px; gap: 0.6rem; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0.25rem 0 0; }
.editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 1.25rem; }
.editor-actions .message { margin: 0; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .tide svg, .marquee-track { animation: none !important; }
}

@media (max-width: 560px) {
  .hero { padding: 3.5rem 0 7rem; }
  .section { padding: 4rem 0; }
  .vip-row { flex-direction: column; }
  .form-card { padding: 1.4rem; }
  .cta { padding: 1.5rem; }
}
