/* ============================================================
   QubiOps v4 — "Sessiz Yüzey" (Quiet Surface)
   Dark, minimal, single typeface (Inter). One accent = the photon blue.
   Living photon surface behind everything. Az metin, çok boşluk.
   ============================================================ */

:root {
  --bg:         #0A0B0D;
  --surface:    #101216;
  --surface-2:  #15181E;
  --ink:        #E7E9EE;
  --ink-muted:  #8A8F9A;
  --ink-faint:  #84888F;
  --hairline:   #1C1F26;
  --accent:     #84B2FF;
  --accent-soft: rgba(132, 178, 255, 0.10);
  --accent-hover: #6E9BF0;
  --scrollbar-thumb: #2A2E37;
  --scrollbar-thumb-hover: #3A4150;
  --maxw: 1080px;
  --pad: clamp(20px, 5vw, 40px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* thin, theme-matched scrollbar (replaces the chunky OS default) */
html { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); background-clip: padding-box; }
.chat-log, .lang-menu { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) transparent; }
body {
  margin: 0; background: transparent; color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 17px; line-height: 1.62; font-weight: 400;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.022em; line-height: 1.08; }
.hero h1, .contact h2 { font-weight: 700; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--bg); }
.tnum { font-variant-numeric: tabular-nums; }
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* living photon surface */
#photons { position: fixed; top: 0; left: 0; right: 0; bottom: 0; inset: 0; z-index: -1; pointer-events: none; }

.skip-link { position: fixed; top: 8px; left: 50%; transform: translate(-50%, -160%); z-index: 100; background: var(--ink); color: var(--bg); font-size: 13px; padding: 9px 16px; border-radius: 6px; transition: transform .2s; }
.skip-link:focus { transform: translate(-50%, 0); outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a:focus-visible { border-radius: 4px; }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }

/* ---------- NAV ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px var(--pad);
  background: rgba(10, 11, 13, 0.72);
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .4s;
}
.nav.scrolled { border-bottom-color: var(--hairline); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.brand img { height: 21px; width: auto; }
.nav-cta { font-size: 15px; color: var(--ink-muted); position: relative; transition: color .2s; }
.nav-cta::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .22s cubic-bezier(.2,.7,.2,1); }
.nav-cta:hover { color: var(--ink); }
.nav-cta:hover::after, .nav-cta:focus-visible::after { transform: scaleX(1); }

/* ---------- HERO ---------- */
.hero { min-height: 88vh; display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(28px, 5vw, 64px); align-items: center; padding-block: clamp(88px, 16vh, 168px) clamp(60px, 10vh, 110px); }
.hero-text { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.kicker { font-size: 12.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 24px; }
.hero h1 { font-size: clamp(2.3rem, 5.4vw, 4.1rem); letter-spacing: -0.03em; line-height: 1.06; max-width: 17ch; }
.hero .sub { margin-top: 22px; font-size: clamp(1.0rem, 1.5vw, 1.15rem); line-height: 1.5; color: var(--ink-muted); max-width: 42ch; text-wrap: pretty; }
.hero-mark { display: flex; justify-content: center; align-items: center; position: relative; }
.hero-mark::before { content: ""; position: absolute; left: 50%; top: 50%; width: 125%; aspect-ratio: 1; transform: translate(-50%, -50%); background: radial-gradient(circle, rgba(132,178,255,0.14) 0%, rgba(132,178,255,0.05) 40%, transparent 66%); filter: blur(8px); z-index: 0; pointer-events: none; }
.hero-mark img { position: relative; z-index: 1; width: clamp(170px, 23vw, 290px); height: auto; opacity: 0.14; }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; justify-items: center; gap: 30px; min-height: auto; padding-top: clamp(86px, 13vh, 120px); }
  .hero-text { align-items: center; text-align: center; }
  .hero-mark { order: -1; }
  .hero-mark img { width: clamp(118px, 32vw, 168px); }
}
.cta {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 38px;
  font-size: 15.5px; font-weight: 500; color: var(--ink); padding: 13px 22px;
  border: 1px solid var(--hairline); border-radius: 999px; background: transparent;
  transition: border-color .25s, background .25s, gap .25s, transform .12s;
}
.cta:hover { border-color: color-mix(in oklab, var(--accent) 50%, var(--hairline)); background: var(--accent-soft); gap: 12px; }
.cta .arr { color: var(--accent); transition: transform .25s; }
.cta:hover .arr { transform: translateX(3px); }
.cta:disabled { opacity: .6; cursor: default; pointer-events: none; }
/* primary action — anchored above the quiet ghost .cta (hero "Let's talk" + form "Send") */
.cta-primary { border-color: color-mix(in oklab, var(--accent) 58%, var(--hairline)); background: var(--accent-soft); }
.cta-primary:hover { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 16%, transparent); }
.cta:active:not(:disabled) { transform: scale(.985); }

/* ---------- SECTION SCAFFOLD ---------- */
.section { padding-block: clamp(56px, 9vw, 104px); }
.sec-kicker { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: clamp(24px, 3vw, 36px); display: block; }
.sec-lead { font-size: clamp(1.1rem, 2vw, 1.5rem); font-weight: 600; letter-spacing: -0.02em; color: var(--ink); margin: -14px 0 clamp(30px, 4vw, 46px); }

/* ---------- SOLUTIONS GRID ---------- */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); border-radius: 14px; overflow: hidden; }
.cell { background: var(--surface); padding: clamp(24px, 2.6vw, 32px); display: flex; flex-direction: column; gap: 10px; min-height: 168px; transition: background .25s; }
.cell:hover { background: var(--surface-2); }
.cell .cn { font-size: 11.5px; letter-spacing: 0.1em; color: color-mix(in oklab, var(--accent) 50%, var(--ink-faint)); font-variant-numeric: tabular-nums; }
.cell h3 { font-size: clamp(1.05rem, 1.6vw, 1.24rem); font-weight: 600; }
.cell p { font-size: 0.95rem; line-height: 1.5; color: var(--ink-muted); margin-top: auto; }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr); } .cell { min-height: 150px; } }
@media (max-width: 540px) { .grid { grid-template-columns: 1fr; } .cell { min-height: 0; } }

/* ---------- PROOF STRIP ---------- */
.proof { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; padding: clamp(22px, 3vw, 30px) clamp(24px, 3vw, 34px); border: 1px solid var(--hairline); border-radius: 14px; background: rgba(16, 18, 22, 0.6); background: color-mix(in oklab, var(--surface) 60%, transparent); }
.proof .pf { display: inline-flex; align-items: baseline; gap: 9px; font-size: 0.98rem; color: var(--ink); }
.proof .pf b { font-weight: 600; font-variant-numeric: tabular-nums; }
.proof .pf span { color: var(--ink-muted); }
.proof .dot { color: var(--accent); }
@media (max-width: 640px) { .proof { flex-direction: column; align-items: flex-start; gap: 14px; } .proof .dot { display: none; } }

/* ---------- CHIPS ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: clamp(28px, 4vw, 44px); }
.chip { font-size: 13px; color: var(--ink-muted); border: 1px solid var(--hairline); border-radius: 999px; padding: 7px 14px; transition: color .2s, border-color .2s; }
.chip:hover { color: var(--ink); border-color: color-mix(in oklab, var(--ink-faint) 60%, var(--hairline)); }

/* ---------- TEAM ---------- */
.team-lead { font-size: clamp(1.2rem, 2.4vw, 1.7rem); font-weight: 600; letter-spacing: -0.02em; }
.founders { margin-top: 28px; display: grid; gap: 14px; }
.founder { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--hairline); }
.founder .fn { font-weight: 600; font-size: 1.02rem; }
.founder .fr { color: var(--ink-muted); font-size: 0.95rem; }

/* ---------- CONTACT ---------- */
.contact { text-align: center; }
.contact h2 { font-size: clamp(1.7rem, 4vw, 2.8rem); letter-spacing: -0.022em; max-width: 18ch; margin-inline: auto; }
.contact-form { margin: 36px auto 0; max-width: 480px; display: grid; gap: 18px; text-align: left; position: relative; }
.cf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 520px) { .cf-row { grid-template-columns: 1fr; } }
.contact-form input, .contact-form textarea {
  font-family: inherit; font-size: 15px; color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--hairline); padding: 10px 2px; width: 100%; resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}
.contact-form input::placeholder, .contact-form textarea::placeholder { color: var(--ink-faint); }
.contact-form input:hover, .contact-form textarea:hover { border-bottom-color: color-mix(in oklab, var(--ink-faint) 45%, var(--hairline)); }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 1px 0 0 var(--accent); }
.cf-hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); opacity: 0; pointer-events: none; }
.cf-foot { display: flex; align-items: center; gap: 16px; margin-top: 6px; }
.cf-status { font-size: 13px; color: var(--ink-muted); }
.cf-status.is-ok { color: var(--accent); }
.cf-status.is-err { color: #E0796B; }
:root[data-theme="light"] .cf-status.is-err { color: #C0392B; }

/* ---------- FOOTER ---------- */
.footer { border-top: 1px solid var(--hairline); padding-block: 32px; margin-top: clamp(40px, 7vw, 90px); }
.footer .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer .fbrand { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; }
.footer .fbrand img { height: 16px; width: auto; opacity: .85; }
.footer .fmeta { font-size: 13px; color: var(--ink-faint); }
.footer .fright { display: inline-flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.footer .fprivacy { font-size: 13px; color: var(--ink-muted); transition: color .2s; }
.footer .fprivacy:hover { color: var(--ink); }

/* ---------- REVEAL (very subtle) ---------- */
.reveal { opacity: 0; transform: translateY(9px); transition: opacity .5s ease, transform .5s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .05s; } .reveal.d2 { transition-delay: .1s; } .reveal.d3 { transition-delay: .15s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* v5 content — chip row label */
.chips-label { display: block; font-size: 12px; color: var(--ink-faint); letter-spacing: 0.04em; margin: clamp(28px, 4vw, 44px) 0 13px; }
.chips-label + .chips { margin-top: 0; }
/* tech stack strip — quiet, but more present than its label (content, not a label) */
.tech-stack { margin-top: 0; max-width: 62ch; font-size: 13.5px; line-height: 1.7; color: color-mix(in oklab, var(--ink) 40%, var(--ink-muted)); letter-spacing: .01em; }

/* v5 — hero H1 line-break rhythm tweak */
.hero h1 { max-width: 20ch; text-wrap: balance; }

/* v5 — hero balance: widen text column so H1 breaks cleanly, logo recedes a touch
   (desktop only — must NOT override the mobile single-column collapse) */
@media (min-width: 821px) { .hero { grid-template-columns: 1.3fr 0.7fr; } }

/* ============================================================
   v5 — THEME (dark default + light) · 14-LANGUAGE i18n · RTL
   ============================================================ */

/* photon tint tokens (read by photons.js) */
:root { --photon-base: 150,172,214; --photon-accent: 132,178,255; }

/* ---------- LIGHT THEME — "Soft Greige" (kremsi-grimsi, göz yormayan) ---------- */
:root[data-theme="light"] {
  --bg:         #F6F7F9;   /* faintly blue off-white — the dark hero at daylight exposure, never pure white */
  --surface:    #FFFFFF;   /* pure-white cards float cleanly above the bg */
  --surface-2:  #EDEFF2;   /* recessed / hover surface */
  --ink:        #16181D;   /* graphite with a faint blue undertone, not pure black */
  --ink-muted:  #565B66;
  --ink-faint:  #666B76;   /* tertiary / labels — clears WCAG AA on bg, surface AND surface-2 */
  --hairline:   #D7DBE2;   /* perceptible but quiet, locked to the photon-blue hue band */
  --accent:     #2B55CC;   /* photon blue (#84B2FF) walked down to daylight — same hue family, darker for contrast */
  --accent-soft: rgba(43, 85, 204, 0.12);
  --accent-hover: #1E45B5;
  --scrollbar-thumb: #C5CAD3;
  --scrollbar-thumb-hover: #ABB2BD;
  --photon-base: 154,160,171;
  --photon-accent: 43,85,204;
  color-scheme: light;
}
:root[data-theme="light"] .nav { background: rgba(246, 247, 249, 0.82); background: color-mix(in oklab, var(--bg) 78%, transparent); }
/* white power-Q logo → invert to dark on light bg */
:root[data-theme="light"] .brand img,
:root[data-theme="light"] .footer .fbrand img { filter: invert(1); }
:root[data-theme="light"] .hero-mark img { filter: invert(1); opacity: 0.12; }
:root[data-theme="light"] .hero-mark::before { background: radial-gradient(circle, rgba(43,85,204,0.14) 0%, rgba(43,85,204,0.06) 40%, transparent 72%); }

/* light: lift content panels off the off-white bg (consistent with the elevated lang-menu / chat surfaces) */
:root[data-theme="light"] .grid,
:root[data-theme="light"] .proof {
  box-shadow: 0 1px 2px rgba(20,30,60,0.05), 0 10px 26px -12px rgba(20,30,60,0.13);
}

/* smooth cross-fade between themes — active only during a manual toggle (class added/removed by i18n.js) */
@media (prefers-reduced-motion: no-preference) {
  :root.theme-anim,
  :root.theme-anim *,
  :root.theme-anim *::before,
  :root.theme-anim *::after {
    transition: background-color .26s ease, color .26s ease,
                border-color .26s ease, fill .26s ease, box-shadow .26s ease !important;
  }
}

/* sec-kicker "//" prefix (was literal in HTML, now decorative) */
.sec-kicker::before { content: "// "; color: var(--ink-faint); }

/* ---------- NAV CONTROLS (language + theme) ---------- */
.nav-right { display: inline-flex; align-items: center; gap: 12px; }
.lang { position: relative; }
.lang-btn, .theme-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 11px; box-sizing: border-box;
  border: 1px solid var(--hairline); border-radius: 999px;
  background: transparent; color: var(--ink-muted);
  font-family: inherit; font-size: 13px; line-height: 1; cursor: pointer;
  transition: color .2s, border-color .2s, background .2s, transform .12s;
}
.theme-btn { width: 34px; padding: 0; justify-content: center; }
.lang-btn:hover, .theme-btn:hover { color: var(--ink); border-color: color-mix(in oklab, var(--ink-faint) 55%, var(--hairline)); }
.lang-btn:active, .theme-btn:active { transform: scale(.96); }
.lang-btn svg, .theme-btn svg { opacity: .9; flex: none; }
#langCur { font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.theme-btn .ic-sun { display: none; }
:root[data-theme="light"] .theme-btn .ic-sun { display: block; }
:root[data-theme="light"] .theme-btn .ic-moon { display: none; }

.lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 168px; max-height: 64vh; overflow-y: auto;
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 12px; box-shadow: 0 18px 44px rgba(0,0,0,0.38);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  z-index: 40;
}
:root[data-theme="light"] .lang-menu { box-shadow: 0 18px 44px rgba(20,30,60,0.14); }
.lang.open .lang-menu { opacity: 1; visibility: visible; transform: none; }
.lang-menu li {
  padding: 9px 12px; border-radius: 8px; font-size: 14px;
  color: var(--ink-muted); cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.lang-menu li:hover { background: var(--surface-2); color: var(--ink); }
.lang-menu li[aria-current="true"] { color: var(--accent); font-weight: 500; background: var(--accent-soft); }
@media (max-width: 560px) { .nav-cta { display: none; } .nav-right { gap: 9px; } }
/* coarse-pointer (touch) ≥44px hit targets — desktop look unchanged */
@media (pointer: coarse) {
  .lang-btn, .theme-btn { height: 44px; }
  .theme-btn { width: 44px; }
  .lang-menu li { padding-top: 12px; padding-bottom: 12px; }
  .chat-send { width: 44px; height: 44px; }
  .chat-close { width: 40px; height: 40px; }
  .founder-links .flink { padding: 12px; margin: -12px; }
  .chat-input textarea { padding-top: 12px; padding-bottom: 12px; }   /* match the 44px send button -> aligned row */
}

/* ---------- FOUNDER NAME LINKS (site · LinkedIn · GitHub) ---------- */
.founder-links { display: inline-flex; align-items: center; gap: 11px; margin-inline-start: auto; align-self: center; }
.founder-links .flink { display: inline-flex; color: var(--ink-faint); transition: color .18s; }
.founder-links .flink:hover { color: var(--accent); }
.founder-links svg { display: block; }
.founder { flex-direction: column; align-items: stretch; gap: 6px; }
.founder:last-child { border-bottom: 0; padding-bottom: 0; }
.founder-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.founder-skills { font-size: 12px; color: var(--ink-faint); letter-spacing: .03em; }
[dir="rtl"] .founder-skills { text-align: right; }

/* ---------- RTL (Arabic) ---------- */
[dir="rtl"] .hero-text { align-items: flex-end; text-align: right; }
[dir="rtl"] .sec-lead, [dir="rtl"] .team-lead, [dir="rtl"] .contact h2 { margin-inline: 0; }
[dir="rtl"] .lang-menu { right: auto; left: 0; }
[dir="rtl"] .sec-kicker::before { content: ""; }
[dir="rtl"] .cta .arr, [dir="rtl"] .nav-right .arr { display: inline-block; transform: scaleX(-1); }
[dir="rtl"] .cta:hover .arr { transform: scaleX(-1) translateX(3px); }
[dir="rtl"] .contact h2 { margin-inline: auto; }

/* ============================================================
   AI ASSISTANT (chat widget) — same-origin /api/chat proxy
   ============================================================ */
.chat-fab {
  position: fixed; z-index: 60; bottom: 22px; inset-inline-end: 22px;
  display: inline-flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 18px 0 16px;
  border: 1px solid color-mix(in oklab, var(--accent) 45%, var(--hairline));
  border-radius: 999px; cursor: pointer;
  background: color-mix(in oklab, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--ink); font-family: inherit; font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,.32), 0 0 0 4px var(--accent-soft);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.chat-fab:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 14px 38px rgba(0,0,0,.4), 0 0 0 5px var(--accent-soft); }
.chat-fab:active { transform: translateY(0); }
.chat-fab svg { color: var(--accent); flex: none; }
:root[data-theme="light"] .chat-fab { box-shadow: 0 10px 30px rgba(20,30,60,.14), 0 0 0 4px var(--accent-soft); }

.chat-panel {
  position: fixed; z-index: 61; bottom: 22px; inset-inline-end: 22px;
  width: 370px; max-width: calc(100vw - 32px); height: min(560px, 72vh);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(14px) scale(.98); transform-origin: bottom right;
  transition: opacity .2s ease, transform .2s ease;
}
/* The [hidden] attribute MUST win over display:flex. Otherwise the closed panel stays
   laid out (opacity:0 but display:flex, z-index 61) on top of the FAB and swallows its
   click — so the chat never opens. chat.js toggles panel.hidden, so honour it here. */
.chat-panel[hidden] { display: none; }
[dir="rtl"] .chat-panel { transform-origin: bottom left; }
.chat-panel.open { opacity: 1; transform: none; }
:root[data-theme="light"] .chat-panel { box-shadow: 0 24px 60px rgba(20,30,60,.18); }

.chat-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 12px; border-bottom: 1px solid var(--hairline); }
.chat-head .ct { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.chat-head .cd { font-size: 11px; color: var(--ink-faint); border: 1px solid var(--hairline); border-radius: 999px; padding: 2px 7px; }
.chat-close { margin-inline-start: auto; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--ink-muted); font-size: 20px; line-height: 1; cursor: pointer; border-radius: 8px; transition: background .15s, color .15s; }
.chat-close:hover { background: var(--surface-2); color: var(--ink); }

.chat-log { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.ai { align-self: flex-start; background: var(--surface-2); color: var(--ink); border-bottom-left-radius: 5px; }
.chat-msg.me { align-self: flex-end; background: var(--accent-soft); color: var(--ink); border: 1px solid color-mix(in oklab, var(--accent) 28%, transparent); border-bottom-right-radius: 5px; }
[dir="rtl"] .chat-msg.ai { border-bottom-left-radius: 14px; border-bottom-right-radius: 5px; }
[dir="rtl"] .chat-msg.me { border-bottom-right-radius: 14px; border-bottom-left-radius: 5px; }
.chat-typing { display: inline-flex; gap: 4px; align-items: center; }
.chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); animation: chatdot 1s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: .15s; } .chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chatdot { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-input { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--hairline); }
.chat-input textarea { flex: 1; resize: none; border: 0; background: transparent; color: var(--ink); font-family: inherit; font-size: 14px; line-height: 1.45; max-height: 120px; padding: 8px 2px; outline: none; }
.chat-input textarea::placeholder { color: var(--ink-faint); }
.chat-send { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; background: var(--accent); color: var(--bg); font-size: 17px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; transition: opacity .2s, transform .15s; }
.chat-send:hover { transform: translateY(-1px); background: var(--accent-hover); }
.chat-send:active:not(:disabled) { transform: translateY(0) scale(.96); }
.chat-send:disabled { opacity: .5; cursor: default; }

@media (max-width: 560px) {
  .chat-fab { bottom: 16px; inset-inline-end: 16px; height: 48px; padding: 0 15px 0 13px; }
  .chat-panel { inset-inline: 0; bottom: 0; width: 100%; max-width: 100%; height: 82dvh; border-radius: 18px 18px 0 0; transform-origin: bottom center; }
}
@media (prefers-reduced-motion: reduce) { .chat-panel { transition: opacity .01ms; transform: none; } .chat-typing span { animation: none; } }

/* On touch (iOS Safari), focusing a <16px input auto-zooms the page and breaks
   full-width. >=16px stops it. MUST come after the 14/15px base rules to win. */
@media (pointer: coarse) {
  .chat-input textarea,
  .contact-form input,
  .contact-form textarea { font-size: 16px; }
}
