/* ============================================================
   DITRO INFOTECH — site-wide dark theme
   Flips the brand tokens from theme.css to dark and restyles shared
   components. Applied to every page except the admin console
   (config.php render() adds body.theme-dark). Loaded after interactive.css.
   ============================================================ */

/* ---------- Theme: flip the brand tokens to dark ---------- */
body.theme-dark {
  --ink: #f3efe4; --ink-soft: #c9c2b4; --muted: #8f877a;
  --paper: #0b0a09; --paper-2: #121010; --surface: #171513; --line: rgba(255,255,255,.09);
  --charcoal: #070606;
  --bs-body-bg: #0b0a09; --bs-body-color: #e6e0d4; --bs-emphasis-color: #fff; --bs-heading-color: #f6f2e7;
  --bs-secondary-color: rgba(230,224,212,.6); --bs-tertiary-bg: #121010; --bs-border-color: rgba(255,255,255,.09);
  --serif: 'Instrument Serif', Georgia, serif;
  background: var(--paper); color: var(--bs-body-color);
}

/* Type: sentence case, tight, with serif-italic accents */
.theme-dark .h-section { text-transform: none; font-weight: 700; letter-spacing: -.045em; line-height: 1; font-size: clamp(2.2rem, 5vw, 4.2rem); }
.theme-dark .h-display { text-transform: none; }
.theme-dark h3, .theme-dark .h3, .theme-dark .h4, .theme-dark .h5 { letter-spacing: -.03em; font-weight: 700; }
.theme-dark .card-title-up { text-transform: none; }
.x-serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; color: var(--red); }
.theme-dark .lead { color: #a39b8d; }
.theme-dark .text-muted { color: var(--muted) !important; }
.theme-dark .section-light { background: var(--paper-2); }
.theme-dark .card { --bs-card-bg: var(--surface); --bs-card-border-color: var(--line); --bs-card-color: var(--bs-body-color); }
.theme-dark a.card:hover { border-color: rgba(255,255,255,.25); box-shadow: 0 40px 80px -40px rgba(0,0,0,.8); }
.theme-dark .btn-dark { --bs-btn-bg: #f3efe4; --bs-btn-color: #0b0a09; --bs-btn-border-color: #f3efe4; --bs-btn-hover-bg: #fff; --bs-btn-hover-color: #0b0a09; --bs-btn-hover-border-color: #fff; }
.theme-dark .btn-outline-dark { --bs-btn-color: #ece6da; --bs-btn-border-color: rgba(255,255,255,.18); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: rgba(255,255,255,.04); --bs-btn-hover-border-color: var(--red); }
.theme-dark .btn { border-radius: 999px; padding-inline: 1.6rem; }
.theme-dark .btn span { position: relative; display: inline-block; }
.theme-dark .tag { border-color: rgba(255,255,255,.14); }
.theme-dark .accordion-button::after { filter: invert(1) brightness(1.4); }
.theme-dark .accordion { --bs-accordion-bg: transparent; --bs-accordion-active-bg: transparent; --bs-accordion-border-color: var(--line); --bs-accordion-btn-color: #f3efe4; }
.theme-dark .accordion-button { font-size: 1.05rem; padding-block: 1.3rem; }
.theme-dark .form-control, .theme-dark .form-select { color: #f3efe4; }
.theme-dark .footer-logo { background: #faf7f1; }
.theme-dark .chatbot__messages p { background: #211e1a; border-color: var(--line); color: #ece6da; }
.theme-dark .chatbot__messages p[data-role="user"] { background: var(--red); border-color: var(--red); color: #fff; }
.theme-dark .chatbot__nudge { background: #1b1916; }
.theme-dark .est-type input:checked + .est-type__box { background: rgba(215,26,33,.1); }
.theme-dark .est-summary { border: 1px solid var(--line); background-color: #0f0d0c; }
.theme-dark .industry-stuck { background: #15100f; border: 1px solid rgba(215,26,33,.25); }
.theme-dark .industry-tab[aria-selected="true"] svg { color: var(--red); }
.theme-dark .avatar-initials { background: linear-gradient(135deg, var(--red), #ff7a5c); }

/* Nav: dark glass */
.theme-dark .site-nav { background: rgba(11,10,9,.62); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); border-bottom-color: rgba(255,255,255,.06); }
.theme-dark .site-nav .logo-dark { display: none; }
.theme-dark .site-nav .logo-light { display: block; }
.theme-dark .site-nav .nav-link { color: #a39b8d; }
.theme-dark .site-nav .nav-link:hover, .theme-dark .site-nav .nav-link.active { color: #fff; }
.theme-dark .navbar-toggler { color: #f3efe4; }
.theme-dark .site-nav .dropdown-menu { --bs-dropdown-bg: #151311; --bs-dropdown-link-color: #c9c2b4; }
.theme-dark .site-nav .dropdown-item:hover { background: rgba(255,255,255,.05); }
.theme-dark .offcanvas { --bs-offcanvas-bg: #0f0d0c; --bs-offcanvas-color: #ece6da; }
.theme-dark .btn-close { filter: invert(1); }
.theme-dark .nav-search { background: rgba(255,255,255,.04); }
.theme-dark .nav-search kbd { background: rgba(255,255,255,.06); }

/* ---------- Cursor ---------- */
.x-cursor { display: none; }
.has-cursor .x-cursor { display: block; }
.has-cursor, .has-cursor a, .has-cursor button, .has-cursor label { cursor: none; }
.has-cursor input, .has-cursor textarea { cursor: text; }
.x-cursor__dot, .x-cursor__ring { position: fixed; left: 0; top: 0; z-index: 2500; pointer-events: none; border-radius: 50%; }
.x-cursor__dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--red); }
.x-cursor__ring { width: 38px; height: 38px; margin: -19px 0 0 -19px; border: 1px solid rgba(255,255,255,.35); display: grid; place-items: center; transition: width .35s cubic-bezier(.22,1,.36,1), height .35s cubic-bezier(.22,1,.36,1), margin .35s cubic-bezier(.22,1,.36,1), background .3s, border-color .3s; }
.x-cursor__ring span { font-family: 'JetBrains Mono', monospace; font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: #fff; opacity: 0; transition: opacity .2s; }
.x-cursor.is-link .x-cursor__ring { width: 56px; height: 56px; margin: -28px 0 0 -28px; border-color: var(--red); background: rgba(215,26,33,.12); }
.x-cursor.is-label .x-cursor__ring { width: 92px; height: 92px; margin: -46px 0 0 -46px; background: var(--red); border-color: var(--red); }
.x-cursor.is-label .x-cursor__ring span { opacity: 1; }
.x-cursor.is-label .x-cursor__dot, .x-cursor.is-text .x-cursor__dot { opacity: 0; }
.x-cursor.is-text .x-cursor__ring { width: 4px; height: 30px; margin: -15px 0 0 -2px; border-radius: 2px; background: var(--red); border-color: var(--red); }

/* ---------- Grain + curtain ---------- */
.x-grain { position: fixed; inset: -50%; z-index: 2400; pointer-events: none; opacity: .07; 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='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); animation: grain 1s steps(6) infinite; }
@keyframes grain { 0% { transform: translate(0, 0); } 20% { transform: translate(-4%, 3%); } 40% { transform: translate(3%, -5%); } 60% { transform: translate(-6%, -2%); } 80% { transform: translate(5%, 4%); } 100% { transform: translate(0, 0); } }
.x-curtain { position: fixed; inset: 0; z-index: 2900; background: var(--red); transform: scaleY(0); transform-origin: 50% 100%; pointer-events: none; }


.theme-dark .link-arrow { color: #ece6da; }
.theme-dark .site-footer { background: #070606; border-top: 1px solid var(--line); }

/* ---------- Giant CTA (homepage + partials/cta.php) ---------- */
.x-cta { position: relative; overflow: hidden; padding: clamp(6rem, 14vw, 11rem) 0 0; background: radial-gradient(ellipse at 20% 100%, rgba(215,26,33,.28), transparent 55%), #070606; }
.x-cta__title { font-weight: 700; font-size: clamp(3.4rem, 11vw, 11rem); line-height: .9; letter-spacing: -.065em; color: #f6f2e7; margin: 1.5rem 0 0; }
.x-cta__title > span { display: block; }
.x-cta__title .x-serif { letter-spacing: -.03em; }
.x-cta__row { display: flex; justify-content: space-between; align-items: center; gap: 2rem; margin-top: 2.5rem; flex-wrap: wrap; }
.x-cta__row .lead { max-width: 42ch; }
.x-cta__row .lead a { color: #fff; }
.x-badge { position: relative; width: 170px; height: 170px; display: grid; place-items: center; flex: none; color: #f3efe4; text-decoration: none; }
.x-badge > svg { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 14s linear infinite; }
.x-badge text { font-family: 'JetBrains Mono', monospace; font-size: 13.4px; letter-spacing: 3.1px; fill: currentColor; }
.x-badge__core { width: 86px; height: 86px; border-radius: 50%; background: var(--red); display: grid; place-items: center; color: #fff; transition: transform .4s cubic-bezier(.22,1,.36,1); box-shadow: 0 20px 50px -10px rgba(215,26,33,.7); }
.x-badge__core svg { width: 30px; height: 30px; }
.x-badge:hover .x-badge__core { transform: scale(1.12) rotate(45deg); }
@keyframes spin { to { transform: rotate(360deg); } }
.x-cta__marquee { margin-top: clamp(4rem, 8vw, 6rem); border-top: 1px solid var(--line); overflow: hidden; padding: 1.2rem 0; }
.x-cta__marquee > div { display: flex; gap: 3rem; width: max-content; animation: quotes 40s linear infinite; }
.x-cta__marquee span { font-weight: 700; font-size: clamp(2rem, 5vw, 4rem); letter-spacing: -.05em; color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.22); }
.x-cta__marquee span:nth-child(3n) { color: var(--red); -webkit-text-stroke: 0; font-family: var(--serif); font-style: italic; font-weight: 400; }

@media (max-width: 991.98px) {
  .x-badge { width: 130px; height: 130px; }
  .x-badge__core { width: 66px; height: 66px; }
}

/* ---------- Inner-page hero ---------- */
.theme-dark .page-hero { position: relative; overflow: hidden; isolation: isolate; background: #070606; padding-top: clamp(4.5rem, 10vw, 8rem); padding-bottom: clamp(3.5rem, 7vw, 6rem); border-bottom: 1px solid var(--line); }
.theme-dark .page-hero::before { content: ""; position: absolute; inset: -30%; z-index: -2; pointer-events: none; background: radial-gradient(40% 45% at 78% 30%, rgba(215,26,33,.32), transparent 70%), radial-gradient(30% 35% at 15% 110%, rgba(215,26,33,.18), transparent 70%); animation: heroDrift 18s ease-in-out infinite alternate; }
.theme-dark .page-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .55; background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px); background-size: 64px 64px; -webkit-mask-image: radial-gradient(ellipse at 70% 30%, #000 10%, transparent 70%); mask-image: radial-gradient(ellipse at 70% 30%, #000 10%, transparent 70%); }
@keyframes heroDrift { to { transform: translate(-6%, 4%) scale(1.08); } }
.theme-dark .h-display { text-transform: none; font-weight: 700; letter-spacing: -.055em; line-height: .95; color: #f6f2e7; }
.theme-dark .page-hero .h-display { font-size: clamp(2.8rem, 6.4vw, 6.2rem); max-width: 18ch; }
.theme-dark .page-hero .lead { color: #b7afa0; font-size: clamp(1.02rem, 1.4vw, 1.22rem); max-width: 56ch; }
.theme-dark .page-hero .stat b { color: #f6f2e7; }

/* Word-by-word reveal (assets/js/site.js and story.js wrap words in .x-w) */
.x-w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .1em; margin-bottom: -.1em; }
.x-w > span { display: inline-block; transform-origin: 0 100%; }
.js-words .x-w > span { transform: translateY(110%) rotate(4deg); transition: transform 1.1s cubic-bezier(.16,1,.3,1) calc(var(--i, 0) * 55ms); }
.js-words.is-in .x-w > span { transform: none; }

/* ---------- Shared components on dark ---------- */
.theme-dark .section-dark { background: radial-gradient(ellipse at 85% 0%, rgba(215,26,33,.18), transparent 55%), #070606; }
.theme-dark .section-dark .card { background: #141210; border-color: var(--line); }
.theme-dark .compare__cell--us { background: rgba(215,26,33,.08); }
.theme-dark .compare__cell--us p { color: #fff; }
.theme-dark .pill-tab[aria-selected="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.theme-dark .filter-btn { background: rgba(255,255,255,.03); }
.theme-dark .card { border-radius: 1.1rem; }
.theme-dark a.card { position: relative; overflow: hidden; }
.theme-dark .work-thumb { border-bottom-color: var(--line); }
.theme-dark .terminal, .theme-dark .dashboard { border-color: rgba(255,255,255,.1); background: #0f0d0b; }
.theme-dark .timeline__row { background: var(--surface); }
.theme-dark .article p, .theme-dark .article ul { color: #c9c2b4; }
.theme-dark .article h2 { text-transform: none; letter-spacing: -.035em; }
.theme-dark .form-control::placeholder { color: #6f685a; }
.theme-dark .form-select { --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23c9c2b4' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
.theme-dark .form-select option { background: #171513; color: #f3efe4; }
.theme-dark .quote-mark { font-family: var(--serif); font-style: italic; }
.theme-dark .blockquote-lg { color: #ece6da; }
.theme-dark .eyebrow { color: #ff4d53; }
.theme-dark .dropdown-divider { border-color: var(--line); }
.theme-dark .card-metric small { color: var(--muted); }
.theme-dark .x-grain { opacity: .06; }

/* Hero "Ask Ditro AI" send button: keep it a 40px circle (overrides the wide pill padding above) */
.theme-dark .ask-card__field .btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.theme-dark .ask-card__field .btn svg { display: block; }
