/* CorTIF light theme + shared UI polish.
   Dark stays the default (style.css). Light is opt-in via the toggle,
   which sets <html data-theme="light">. */

/* ---------- toggle button ---------- */
.theme-toggle {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  transition: background .2s, border-color .2s, transform .2s;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); transform: rotate(-12deg); }
.theme-toggle:not(.in-header) {
  position: fixed; left: 18px; bottom: 18px; z-index: 9999;
  box-shadow: var(--shadow-1);
}
.theme-anim, .theme-anim * { transition: background-color .3s, color .3s, border-color .3s !important; }

/* ---------- UI polish (both themes) ---------- */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- motion layer (js/motion.js) ---------- */
html.motion-ready { opacity: 1; transition: opacity .22s ease; }
html.page-leave { opacity: 0; }

.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 10000;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transform-origin: 0 50%; transform: scaleX(0); pointer-events: none;
}

/* plain fade-up reveals (style.css), no blur */

/* readability: no stretched word gaps */
html.motion-ready :is(p, .card p, [class*="card"] p, [class*="tile"] p, .eco-card p) { text-align: left !important; }

/* inputs: smoother focus */
html.motion-ready :is(.field input, .field select, .field textarea) { transition: border-color .25s, box-shadow .25s, background-color .25s, transform .25s; }
html.motion-ready :is(.field input:focus, .field textarea:focus) { transform: translateY(-1px); }

@media (prefers-reduced-motion: reduce) {
}

/* ---------- light palette ---------- */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f3;
  --bg-soft: #eef1ea;
  --surface: #ffffff;
  --ink: #101410;
  --ink-2: #1f251d;
  --muted: #4f574c;
  --faint: #7b8377;
  --line: rgba(16, 20, 16, .09);
  --line-2: rgba(16, 20, 16, .16);
  --primary: #2f9e0b;
  --primary-2: #268507;
  --primary-soft: rgba(47, 158, 11, .11);
  --green: #2f9e0b;
  --green-soft: rgba(47, 158, 11, .11);
  --navy: #ffffff;
  --navy-2: #eef1ea;
  --red: #d93636;
  --red-soft: rgba(217, 54, 54, .1);
  --amber: #b98a00;
  --shadow-1: 0 1px 2px rgba(16, 20, 16, .06), 0 12px 32px -18px rgba(16, 20, 16, .22);
  --shadow-2: 0 30px 60px -30px rgba(16, 20, 16, .28);
}
html[data-theme="light"] body { color: #2c3329; background: var(--bg); }
html[data-theme="light"] ::selection { color: #fff; }
html[data-theme="light"] ::-webkit-scrollbar-track { background: var(--bg-soft); }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c9cec4; }

html[data-theme="light"] .site-header.scrolled { background: rgba(255, 255, 255, .88) !important; box-shadow: 0 10px 30px -22px rgba(16, 20, 16, .35); backdrop-filter: blur(14px); }
html[data-theme="light"] .main-nav a { color: var(--ink-2); }
html[data-theme="light"] .main-nav a:hover { color: var(--primary); }

/* Forms */
html[data-theme="light"] .field input,
html[data-theme="light"] .field select,
html[data-theme="light"] .field textarea { background-color: #fff; }
html[data-theme="light"] .field input::placeholder,
html[data-theme="light"] .field textarea::placeholder { color: var(--faint); }
html[data-theme="light"] .field select option { background: #fff; color: var(--ink); }
html[data-theme="light"] .auth-msg.error { color: var(--red); }
html[data-theme="light"] .auth-msg.ok { color: var(--primary); }

/* The login/sign-up brand panel stays dark in both themes */
html[data-theme="light"] .auth-side,
html[data-theme="light"] [style*="#122609"],
html[data-theme="light"] .cta-panel,
html[data-theme="light"] .w3-result,
html[data-theme="light"] .arch-master,
html[data-theme="light"] .res-hero,
html[data-theme="light"] .keep-dark {
  color-scheme: dark;
  --ink: #f8f8f8; --ink-2: #e4e4e4; --muted: #a8a8a8; --faint: #6e6e6e;
  --line: rgba(255, 255, 255, .09); --line-2: rgba(255, 255, 255, .16);
  --surface: #202020; --bg: #0f0f0f; --bg-soft: #161616; --primary: #5dd62c;
}

html[data-theme="light"] .mobile-nav { background: rgba(246, 247, 243, .96) !important; }
html[data-theme="light"] .dark-panel { background: var(--bg-soft) !important; }
html[data-theme="light"] .dark-panel p { color: var(--muted) !important; }
html[data-theme="light"] .ww8-tag, html[data-theme="light"] .ww8-tag * { color: var(--primary) !important; }
html[data-theme="light"] .user-menu a { color: var(--ink-2) !important; }
html[data-theme="light"] .eco-n,
html[data-theme="light"] .cf-num { color: rgba(16, 20, 16, .06) !important; }
html[data-theme="light"] .fit-kicker,
html[data-theme="light"] .ww8-tag,
html[data-theme="light"] .w3-result,
html[data-theme="light"] [style*="color:#9df565"] i { color: var(--primary) !important; }

/* Hard-coded dark surfaces (stylesheet + inline styles) */
html[data-theme="light"] .site-header,
html[data-theme="light"] footer,
html[data-theme="light"] .site-footer { background: var(--surface) !important; border-color: var(--line) !important; }
html[data-theme="light"] [style*="background:#0f0f0f"], html[data-theme="light"] [style*="background: #0f0f0f"],
html[data-theme="light"] [style*="background:#0a0a0a"], html[data-theme="light"] [style*="background: #0a0a0a"],
html[data-theme="light"] [style*="background:#121212"], html[data-theme="light"] [style*="background:#141414"] { background: var(--bg) !important; }
html[data-theme="light"] [style*="background:#161616"], html[data-theme="light"] [style*="background: #161616"],
html[data-theme="light"] [style*="background:#1c1c1c"], html[data-theme="light"] [style*="background:#202020"] { background: var(--surface) !important; }
html[data-theme="light"] [style*="color:#fff"], html[data-theme="light"] [style*="color: #fff"],
html[data-theme="light"] [style*="color:#f8f8f8"], html[data-theme="light"] [style*="color:#eaeaea"],
html[data-theme="light"] [style*="color:#e4e4e4"] { color: var(--ink) !important; }
html[data-theme="light"] [style*="color:#cfcfcf"], html[data-theme="light"] [style*="color:#c9c9c9"],
html[data-theme="light"] [style*="color:#a8a8a8"], html[data-theme="light"] [style*="color:#8f8f8f"] { color: var(--muted) !important; }
html[data-theme="light"] [style*="color:#7de64c"], html[data-theme="light"] [style*="color:#9df565"] { color: var(--primary) !important; }
html[data-theme="light"] [style*="border:1px solid rgba(255,255,255"],
html[data-theme="light"] [style*="border: 1px solid rgba(255, 255, 255"] { border-color: var(--line-2) !important; }

/* Keep the lime brand blocks dark-on-lime in both themes */
html[data-theme="light"] .btn-primary,
html[data-theme="light"] [style*="background:#5dd62c"],
html[data-theme="light"] [style*="background: #5dd62c"] { color: #0f0f0f !important; }

/* ---------- Google sign-in ---------- */
.auth-or { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--faint); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-google svg { flex-shrink: 0; }
.btn-google[disabled] { opacity: .6; pointer-events: none; }
