/* Portfolio foundation and atmospheric background. Keep responsive overrides below. */
:root { color-scheme: dark; }
body { margin: 0; background: #02050e; color: #e2e8f0; font-family: "Times New Roman", Georgia, serif; }
h1 { font-size: clamp(2.25rem, 4.3vw, 3.6rem); line-height: 1.12; margin-bottom: 1.5rem; }
h2 { font-size: clamp(1.65rem, 3vw, 2.1rem); line-height: 1.25; }
#webgl-container { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; background: radial-gradient(ellipse at 75% 20%, #194c68 0, transparent 60%), radial-gradient(ellipse at 15% 70%, #123452 0, #040b19 80%); }
#webgl-container canvas { display: block; width: 100%; height: 100%; }
.background-vignette { background: radial-gradient(ellipse 80% 80% at 50% -20%, rgba(56,189,248,.10), rgba(2,5,14,.42)); }
.cyber-grid-bg { background-image: linear-gradient(rgba(56,189,248,.22) 1px, transparent 1px), linear-gradient(90deg, rgba(56,189,248,.22) 1px, transparent 1px); background-size: 64px 64px; mask-image: linear-gradient(to bottom, transparent, black 25%, transparent); }
.feature-card, .metric-box { background: linear-gradient(135deg, rgba(12,25,44,.9), rgba(3,9,22,.88)); border: 1px solid rgba(56,189,248,.2); border-radius: 18px; box-shadow: 0 18px 48px rgba(0,3,12,.25); }
.metric-box { border-radius: 12px; }
.nav-item { padding: .5rem .75rem; font-size: .8rem; color: #cbd5e1; border-radius: 999px; transition: background .2s, color .2s; }
.nav-item:hover { background: rgba(56,189,248,.12); color: #7dd3fc; }
.badge-pill { display: inline-flex; padding: .3rem .6rem; border: 1px solid rgba(56,189,248,.25); border-radius: 999px; background: rgba(56,189,248,.07); color: #7dd3fc; font-size: .7rem; }
/* Keep the introduction and portrait aligned independently of CDN utilities. */
.hero-layout { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 2.5rem; width: 100%; }
.hero-copy { min-width: 0; text-align: left; }
.hero-introduction { text-align: justify; text-justify: inter-word; hyphens: auto; }
.hero-portrait { min-width: 0; display: flex; justify-content: center; }
@media (min-width: 768px) {
  .hero-layout { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); }
  #hero h1 { font-size: clamp(2rem, 3.6vw, 3rem); }
  .hero-copy > .grid { margin-left: 0; }
  .hero-copy > .flex { justify-content: flex-start; }
}
.portrait-seamless-wrap { position: relative; isolation: isolate; width: min(100%, 390px); min-height: 380px; display: flex; align-items: flex-end; justify-content: center; }
.portrait-glow-halo { position: absolute; inset: 12% -5% 0; z-index: -1; background: radial-gradient(ellipse, rgba(56,189,248,.23), transparent 68%); }
.portrait-img-layer { position: relative; width: 100%; max-height: 510px; object-fit: contain; object-position: bottom; filter: drop-shadow(0 12px 28px rgba(2,5,14,.5)); }
.preset-btn { padding: 1rem; border: 1px solid rgba(56,189,248,.2); border-radius: 10px; text-align: left; background: rgba(3,9,22,.8); }
.preset-btn:hover, .preset-btn.active { border-color: #38bdf8; background: rgba(56,189,248,.08); }
.brand-contact-card { display: flex; align-items: center; gap: 1rem; min-width: 0; padding: 1rem; border: 1px solid rgba(56,189,248,.2); border-radius: 12px; background: rgba(3,9,22,.8); }
#companion-robot-station { position: fixed; right: 12px; bottom: 22px; z-index: 40; width: 110px; }
.robot-canvas-container { position: relative; display: flex; justify-content: center; }
.bot-hover-pill { font-size: 12px; text-align: center; color: #7dd3fc; }
.floating-ui-card { position: absolute; width: 28px; top: 20px; }
.left-card { left: -8px; } .right-card { right: -8px; }
#bot-dialogue-window { position: fixed; right: 24px; bottom: 165px; width: min(380px, calc(100% - 24px)); z-index: 60; border: 1px solid #1e4561; border-radius: 16px; background: #060c1c; overflow: hidden; }
.bot-chat-header, .bot-chat-input-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px; border-bottom: 1px solid #1e293b; }
.bot-chat-messages { padding: 16px; max-height: 300px; overflow-y: auto; }
.chat-bubble { padding: 12px; background: #102035; border-radius: 12px; font-size: 14px; }
.bot-quick-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; }
.chip-tag, .bot-chat-send { padding: 6px 10px; background: #102c42; border-radius: 8px; color: #7dd3fc; }
#bot-text-input { min-width: 0; flex: 1; background: #030712; padding: 8px; }
@media (max-width: 767px) { .portrait-seamless-wrap { min-height: 300px; width: min(100%, 320px); } }

/* Fluid content must shrink inside flex and grid tracks. */
body { font-size: 16px; }
img, video, canvas, iframe, embed, object { max-width: 100%; }
img, video { height: auto; }
iframe, embed, object { width: 100%; }
main .grid > *, main .flex > *, #resume-modal .flex > * { min-width: 0; }
section[id], #experience { scroll-margin-top: 5rem; }

/* The full header needs room for both navigation and utility actions. */
@media (max-width: 1199px) {
  #desktop-nav { display: none; }
  #mobile-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  #mobile-menu:not(.hidden) { display: block; }
  #mobile-menu { max-height: calc(100dvh - 4rem); overflow-y: auto; }
  #mobile-menu a { display: flex; align-items: center; min-height: 44px; }
}

@media (max-width: 767px) {
  body { overflow-x: visible; overflow-wrap: anywhere; }
  body :is(.text-xs, .text-sm, .text-\[9px\], .text-\[10px\], .text-\[11px\]) {
    font-size: 16px;
    line-height: 1.5;
  }
  :is(a, button, input, textarea, [role="button"]) {
    min-width: 44px;
    min-height: 44px;
  }
  a { display: inline-flex; align-items: center; }
  button, input, textarea { font-size: 16px; }
  :is(button, a) { white-space: normal; }
  :is(button, a) > svg { flex-shrink: 0; }
  header > div:first-child > a { min-width: 0; }
  header > div:first-child > a > div:last-child { min-width: 0; }
  header > div:first-child > a span.font-bold { font-size: 16px; }
  /* Contact remains available in the menu without crowding the brand. */
  header a[href="#contact"]:not(.mobile-nav-link) { display: none; }
  header > div:first-child > div:last-child { flex-shrink: 0; }
  #sound-toggle, #mobile-menu-btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px; }
  .mode-pill { min-width: 44px; padding: 6px; }
  #hero > .grid { width: 100%; }
  .portrait-seamless-wrap { position: relative; max-width: 100%; }
  #hero .portrait-seamless-wrap > .absolute { position: relative; flex-wrap: wrap; }
  main :is(.flex.items-center.justify-between, .flex.items-center.gap-2.text-xs) { flex-wrap: wrap; gap: 8px; }
  #hero .grid.grid-cols-3 { grid-template-columns: 1fr; }
  #sandbox .grid.grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preset-btn { text-align: left; width: 100%; }
  #sql-output { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
  #sandbox .overflow-x-auto { max-width: 100%; overscroll-behavior-x: contain; }
  #sandbox table { min-width: 520px; }
  footer > div, footer > div > div { max-width: 100%; flex-wrap: wrap; }
  footer a { justify-content: center; }
  #resume-modal > div { max-height: calc(100dvh - 2rem); }
  #resume-modal > div > :first-child { gap: 8px; flex-shrink: 0; }
  #resume-modal > div > :last-child { min-height: 0; }
  #resume-modal .flex.justify-between { flex-wrap: wrap; gap: 8px; }
  #close-resume-btn, #close-bot-btn { flex-shrink: 0; }
  #bot-dialogue-window:not(.hidden) {
    position: fixed; z-index: 60; inset: auto 12px 12px;
    width: auto; max-width: calc(100% - 24px);
    max-height: calc(100dvh - 88px); overflow-y: auto;
    background: #060c1c;
  }
  #bot-input-form { display: flex; flex-wrap: wrap; gap: 8px; }
  #bot-text-input { flex: 1; min-width: 0; width: 100%; }
  .bot-chat-header, .bot-quick-chips { display: flex; flex-wrap: wrap; gap: 8px; }
  #companion-robot-station { max-width: 100%; }
}

@media (min-width: 768px) and (pointer: coarse) {
  :is(a, button, input, textarea, [role="button"]) { min-width: 44px; min-height: 44px; }
  a { align-content: center; }
}

:where(a, button, input, textarea, [role="button"]):focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 3px;
}
#companion-robot-station { cursor: pointer; }
#companion-robot-station:focus-visible { outline: 2px solid #7dd3fc; outline-offset: 4px; border-radius: 12px; }
.chat-bubble + .chat-bubble { margin-top: 10px; }
.chat-bubble.user { margin-left: 24px; background: #163b51; }
button:disabled { opacity: .6; cursor: wait; }

/* Byte: a floating companion with a quiet, instrument-panel chat. */
#companion-robot-station { right: 24px; bottom: 20px; width: 112px; --eye-x: 0px; --eye-y: 0px; }
.robot-canvas-container { padding: 8px 0; }
.svg-robot-hover { width: 104px; height: 140px; overflow: visible; animation: byte-float 4.5s ease-in-out infinite; }
.floating-ui-card, .bot-thruster-flame { display: none; }
#pedestal { opacity: .45; }
#body { transform-origin: 50px 70px; animation: byte-breathe 3s ease-in-out infinite; }
#head, #antenna { transform-origin: 50px 62px; animation: byte-tilt 7s ease-in-out infinite; }
.robot-eyes { transform: translate(var(--eye-x), var(--eye-y)); transition: transform .16s ease-out; }
.svg-eye-blink { transform-box: fill-box; transform-origin: center; animation: byte-blink 5.6s infinite; }
.robot-waving-arm { transform-origin: 32px 70px; animation: byte-arm 4.5s ease-in-out infinite; }
#companion-robot-station:hover .robot-waving-arm,
#companion-robot-station.is-waving .robot-waving-arm { animation: byte-wave .55s ease-in-out 4; }
#companion-robot-station.is-speaking #head { animation: byte-nod .4s ease-in-out 3; }
#companion-robot-station.is-awake #body { animation-duration: 1.8s; }
#bot-dialogue-window { width: min(390px, calc(100% - 32px)); right: 28px; bottom: 180px; border-color: #2a485b; border-radius: 22px; background: linear-gradient(155deg, #101f30, #080f1c 65%); box-shadow: 0 24px 70px #02050e99; font-family: 'Trebuchet MS', sans-serif; }
#bot-dialogue-window:not(.hidden) { display: flex; flex-direction: column; max-height: calc(100dvh - 205px); animation: byte-panel .22s ease-out; }
.bot-chat-header { padding: 18px; border-color: #aacbdf1a; flex-shrink: 0; }
.byte-avatar { display: flex; align-items: center; justify-content: center; gap: 5px; width: 38px; height: 36px; border: 1px solid #7196ac; border-radius: 13px; background: #0a1524; }
.byte-avatar span { width: 5px; height: 9px; border-radius: 3px; background: #7dd3fc; }
.bot-chat-messages { min-height: 80px; max-height: 280px; padding: 20px 18px; overflow-y: auto; overscroll-behavior: contain; }
.chat-bubble { width: fit-content; max-width: 94%; padding: 13px 15px; border: 1px solid #a6c7d80f; border-radius: 4px 16px 16px; background: #162839; color: #d4e3ed; line-height: 1.65; font-size: 13px; overflow-wrap: anywhere; }
.chat-bubble.user { margin-left: auto; border-radius: 16px 4px 16px 16px; background: #224356; color: #f0f8fc; }
.bot-quick-chips { gap: 7px; padding: 4px 18px 16px; flex-shrink: 0; }
.chip-tag { background: transparent; border: 1px solid #385265; border-radius: 999px; padding: 8px 11px; color: #b7d2e2; font-size: 11px; transition: background .2s, border-color .2s; }
.chip-tag:hover { background: #233c4d; border-color: #7dd3fc; }
.bot-chat-input-bar { padding: 12px; border-top: 1px solid #aacbdf1a; border-bottom: 0; background: #07111d; flex-shrink: 0; }
#bot-text-input { border: 0; border-radius: 9px; background: transparent; color: #e2e8f0; padding: 10px 6px; font-size: 13px; }
.bot-chat-send { background: #9cd6ec; color: #102535; padding: 11px 15px; border-radius: 10px; font-size: 12px; font-weight: bold; }
.bot-chat-send:hover { background: #c5ebf8; }
#pet-bot-btn, #close-bot-btn { min-width: 40px; min-height: 40px; }
@keyframes byte-float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }
@keyframes byte-breathe { 50% { transform: scale(1.025, .975); } }
@keyframes byte-tilt { 0%, 65%, 100% { transform: rotate(0); } 75%, 88% { transform: rotate(-7deg); } }
@keyframes byte-blink { 0%, 42%, 46%, 71%, 75%, 100% { transform: scaleY(1); } 44%, 73% { transform: scaleY(.12); } }
@keyframes byte-arm { 50% { transform: rotate(12deg); } }
@keyframes byte-wave { 0%, 100% { transform: rotate(110deg); } 50% { transform: rotate(145deg); } }
@keyframes byte-nod { 50% { transform: rotate(6deg); } }
@keyframes byte-panel { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 767px) {
  #companion-robot-station { right: 12px; bottom: 12px; width: 96px; }
  .svg-robot-hover { width: 90px; height: 122px; }
  #bot-dialogue-window:not(.hidden) { max-height: calc(100dvh - 96px); }
  #bot-text-input { font-size: 16px; }
  .bot-chat-messages { max-height: 35dvh; }
  .bot-chat-header .text-\[10px\], .bot-chat-header .text-\[9px\] { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  #companion-robot-station *, #bot-dialogue-window { animation: none !important; transition: none !important; }
}

.stage-item { border: 1px solid rgba(56,189,248,.18); border-radius: 8px; padding: 12px 4px; background: rgba(3,9,22,.7); }
.stage-item[data-state="running"] { border-color: #7dd3fc; background: rgba(56,189,248,.12); }
.stage-item[data-state="complete"] .stage-status { color: #6ee7b7; }
.pipeline-empty { padding: 24px 12px; text-align: center; color: #94a3b8; }
#pipeline-summary { min-height: 3em; }
#sql-output { white-space: pre; min-height: 96px; }
button:focus-visible, [role="button"]:focus-visible, a:focus-visible { outline: 2px solid #7dd3fc; outline-offset: 4px; }
section[id] { scroll-margin-top: 88px; }
