/* =========================================================
   SHEREBOY TECH LTD — Design tokens
   Palette:
     --ink        #0B1220  (primary dark background)
     --ink-2      #121B2E  (raised dark surface)
     --paper      #F6F4EF  (light section background)
     --paper-2    #FFFFFF  (light raised surface)
     --signal     #4C6FFF  (primary accent — indigo)
     --amber      #FFB648  (secondary accent — used sparingly)
     --text-onDark    #E7EAF2
     --text-onDark-mute #93A0B8
     --text-onLight   #12172B
     --text-onLight-mute #5B6478
   Type:
     Display: 'Space Grotesk' — headlines
     Body: 'Inter' — paragraphs, UI
     Mono: 'JetBrains Mono' — eyebrows, code, badges (signature element)
   ========================================================= */

:root {
  --ink: #0B1220;
  --ink-2: #121B2E;
  --ink-3: #1B2740;
  --paper: #F6F4EF;
  --paper-2: #FFFFFF;
  --signal: #4C6FFF;
  --signal-dim: #3854C9;
  --amber: #FFB648;
  --text-onDark: #E7EAF2;
  --text-onDark-mute: #93A0B8;
  --text-onLight: #12172B;
  --text-onLight-mute: #5B6478;
  --border-onDark: rgba(231, 234, 242, 0.12);
  --border-onLight: rgba(18, 23, 43, 0.10);
  --radius: 10px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text-onDark);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0 0 0.5em; line-height: 1.15; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--amber);
  letter-spacing: 0.02em;
  margin: 0 0 0.75rem;
}
.eyebrow--dark { color: var(--signal-dim); }

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--signal); color: #fff; }
.btn--primary:hover { background: var(--signal-dim); }
.btn--ghost { border-color: var(--border-onDark); color: var(--text-onDark); }
.btn--ghost:hover { border-color: var(--amber); }
.btn--outline { border-color: var(--signal); color: var(--signal); }
.btn--outline:hover { background: var(--signal); color: #fff; }

/* ===== Nav ===== */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-onDark);
}
.nav__inner {
  max-width: 1200px; margin: 0 auto; padding: 1rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
.nav__brand { font-family: var(--font-mono); font-weight: 500; font-size: 1.05rem; color: var(--text-onDark); display: flex; align-items: center; gap: 0.6rem; }
.nav__logo { height: 32px; width: auto; max-width: 160px; object-fit: contain; }
.nav__prompt { color: var(--amber); }
.nav__accent { color: var(--signal); }
.nav__links { display: flex; align-items: center; gap: 1.75rem; }
.nav__links a { font-size: 0.92rem; color: var(--text-onDark-mute); transition: color 0.15s; }
.nav__links a:hover { color: var(--text-onDark); }
.nav__links a.is-active:not(.nav__cta) { color: var(--text-onDark); }
.nav__links a.is-active:not(.nav__cta)::after { width: 100%; }
body.menu-open { overflow: hidden; }
.nav__cta { background: var(--signal); color: #fff !important; padding: 0.55rem 1.1rem; border-radius: 8px; }
.nav__toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.nav__toggle span { width: 22px; height: 2px; background: var(--text-onDark); }

@media (max-width: 860px) {
  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--ink-2); flex-direction: column; align-items: flex-start;
    padding: 1.25rem 1.5rem; gap: 1rem; border-bottom: 1px solid var(--border-onDark);
    display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__cta { width: 100%; text-align: center; }
}

/* ===== Hero ===== */
.hero {
  max-width: 1200px; margin: 0 auto;
  padding: 5rem 1.5rem 6rem;
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 3rem; align-items: center;
}
.hero__headline { font-size: clamp(2.4rem, 5vw, 3.6rem); }
.hl { color: var(--signal); }
.type-cursor::after {
  content: '_'; color: var(--amber); animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.hero__sub { color: var(--text-onDark-mute); max-width: 44ch; font-size: 1.05rem; }
.hero__actions { display: flex; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }

.code-window {
  background: var(--ink-2); border: 1px solid var(--border-onDark);
  border-radius: 12px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.code-window__bar { display: flex; gap: 6px; padding: 0.7rem 0.9rem; background: var(--ink-3); }
.code-window__bar span { width: 10px; height: 10px; border-radius: 50%; background: #4b5670; }
.code-window__bar span:nth-child(1) { background: #ff5f56; }
.code-window__bar span:nth-child(2) { background: #ffbd2e; }
.code-window__bar span:nth-child(3) { background: #27c93f; }
.code-window__body { margin: 0; padding: 1.25rem 1.4rem; font-family: var(--font-mono); font-size: 0.88rem; color: var(--text-onDark-mute); overflow-x: auto; }
.c-key { color: #c792ea; } .c-str { color: #a8e6a3; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 3rem; }
}

/* ===== Sections ===== */
#services, #projects, #blog, #reviews, #about, #contact, #ai-assistant {
  scroll-margin-top: 84px;
}
.section { max-width: 1200px; margin: 0 auto; padding: 5rem 1.5rem; }
.section--light { background: var(--paper); color: var(--text-onLight); max-width: 100%; }
.section--light > * { max-width: 1200px; margin-left: auto; margin-right: auto; }
.section__title { font-size: clamp(1.7rem, 3vw, 2.3rem); margin-bottom: 2.5rem; }
.section__title--onDark { color: var(--text-onDark); }
.section__lede { color: var(--text-onDark-mute); max-width: 55ch; margin-bottom: 2rem; }
.section--light .section__lede { color: var(--text-onLight-mute); }
.section__footer { text-align: center; margin-top: 2.5rem; }
.empty-state { color: var(--text-onDark-mute); font-family: var(--font-mono); font-size: 0.9rem; }
.empty-state--onDark { color: var(--text-onDark-mute); }
.section--light .empty-state { color: var(--text-onLight-mute); }

/* ===== Grids / Cards ===== */
.grid { display: grid; gap: 1.5rem; }
.grid--services { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.grid--projects { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.grid--reviews { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.grid--blog { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }

.card {
  background: var(--paper-2); border: 1px solid var(--border-onLight); border-radius: var(--radius);
  padding: 1.75rem; transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(18,23,43,0.08); }
.card { display: flex; flex-direction: column; height: 100%; }
.card h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }
.card p { color: var(--text-onLight-mute); font-size: 0.94rem; }

/* ===== Service cards ===== */
.service-card__icon {
  width: 46px; height: 46px; border-radius: 10px; background: rgba(76,111,255,0.1); color: var(--signal);
  display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; flex-shrink: 0;
}
.service-card__icon svg { width: 24px; height: 24px; }
.card--service p {
  flex: 1; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}

.project-card {
  background: var(--ink-2); border: 1px solid var(--border-onDark); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; height: 100%; transition: transform 0.2s ease;
}
.project-card:hover { transform: translateY(-4px); }
.project-card__body { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }
.project-card__cat { font-family: var(--font-mono); font-size: 0.78rem; color: var(--amber); margin-bottom: 0.4rem; }
.project-card h3 {
  font-size: 1.1rem; color: var(--text-onDark); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.project-card p {
  color: var(--text-onDark-mute); font-size: 0.92rem; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.project-card__tech { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0; }
.tech-chip { font-family: var(--font-mono); font-size: 0.72rem; background: var(--ink-3); color: var(--text-onDark-mute); padding: 0.2rem 0.55rem; border-radius: 5px; }
.project-card__link {
  color: var(--signal); font-weight: 600; font-size: 0.92rem; margin-top: auto;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.project-card__link svg { width: 15px; height: 15px; flex-shrink: 0; }
.project-card__link:hover { text-decoration: underline; }

.review-card { position: relative; }
.review-card__stars { display: flex; align-items: center; gap: 2px; color: var(--amber); margin-bottom: 0.6rem; }
.review-card__stars svg { width: 16px; height: 16px; }
.review-card__stars svg.is-empty { color: var(--border-onLight); }
.review-card p.review-card__text {
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}
.review-card__name { font-weight: 600; margin-top: 0.75rem; }
.review-card__pos { color: var(--text-onLight-mute); font-size: 0.85rem; }

.blog-card__meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-onLight-mute); margin-bottom: 0.5rem; }
.blog-card h3 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.blog-card p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.blog-card__link { color: var(--signal); font-weight: 600; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 0.35rem; }
.blog-card__link svg { width: 14px; height: 14px; }

/* ===== Media (image loading / fallback system) ===== */
.media { position: relative; overflow: hidden; background: var(--ink-3); }
.media--project { aspect-ratio: 16 / 9; }
.media--blog { aspect-ratio: 16 / 9; border-radius: 8px; margin-bottom: 1rem; }
.media__fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-onDark-mute); background: linear-gradient(135deg, var(--ink-3), var(--ink-2));
}
.section--light .media__fallback { background: linear-gradient(135deg, #ece9e2, #f4f2ec); color: var(--text-onLight-mute); }
.media__fallback svg { width: 32px; height: 32px; opacity: 0.6; }
.media__img {
  position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; object-position: center;
  opacity: 0; transition: opacity 0.45s ease;
}
.media__img.is-loaded { opacity: 1; }
.media__img.is-error { display: none; }

/* ===== Badges (stack) ===== */
.section--stack { text-align: center; }
.badges { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }
.badge {
  font-family: var(--font-mono); font-size: 0.85rem; padding: 0.5rem 1rem;
  border: 1px solid var(--border-onDark); border-radius: 20px; color: var(--text-onDark-mute);
}

/* ===== AI Chat ===== */
.section--ai { text-align: center; }
.ai-chat {
  max-width: 640px; margin: 0 auto; background: var(--ink-2); border: 1px solid var(--border-onDark);
  border-radius: 14px; overflow: hidden; text-align: left;
}
.ai-chat__log { max-height: 380px; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 0.85rem; scroll-behavior: smooth; }
.ai-msg { padding: 0.75rem 1.05rem; border-radius: 12px; font-size: 0.92rem; line-height: 1.55; max-width: 85%; word-wrap: break-word; }
.ai-msg--bot { background: var(--ink-3); color: var(--text-onDark); align-self: flex-start; border-bottom-left-radius: 4px; }
.ai-msg--user { background: var(--signal); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.ai-msg--error { background: #4a1f28; color: #ffb4b4; align-self: flex-start; display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; }
.ai-msg--error .retry-btn { align-self: flex-start; }
.ai-msg--typing { display: flex; align-items: center; gap: 0.5rem; padding-top: 0.85rem; padding-bottom: 0.85rem; }
.typing-dots { display: inline-flex; gap: 4px; align-items: center; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-onDark-mute);
  animation: typing-bounce 1.1s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }
.ai-chat__form { display: flex; align-items: flex-end; border-top: 1px solid var(--border-onDark); }
.ai-chat__form textarea {
  flex: 1; background: transparent; border: none; padding: 1rem 1.25rem; color: var(--text-onDark);
  font-family: var(--font-body); font-size: 0.95rem; resize: none; max-height: 120px; line-height: 1.5;
}
.ai-chat__form textarea:focus { outline: none; }
.ai-chat__form .btn {
  border-radius: 0; flex-shrink: 0; min-width: 92px; text-align: center; align-self: stretch;
  display: flex; align-items: center; justify-content: center;
}

/* ===== About / CEO ===== */
.about-grid { display: grid; grid-template-columns: 1.3fr 0.9fr; gap: 3rem; align-items: start; }
.about-copy__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 1.5rem 0; }
.about-copy__row h3 { font-size: 1rem; }
.about-copy__row p { color: var(--text-onLight-mute); font-size: 0.92rem; }
.about-copy__meta { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-onLight-mute); }
.ceo-card { background: var(--paper-2); border: 1px solid var(--border-onLight); border-radius: var(--radius); padding: 2rem; text-align: center; }
.ceo-card__photo {
  width: 110px; height: 110px; border-radius: 50%; margin: 0 auto 1.25rem;
}
.ceo-card__photo.media .media__fallback { border-radius: 50%; }
.ceo-card__photo.media .media__fallback svg { width: 42px; height: 42px; }
.ceo-card__title { color: var(--signal); font-weight: 600; font-size: 0.9rem; margin-bottom: 1rem; }
@media (max-width: 860px) { .about-grid, .about-copy__row { grid-template-columns: 1fr; } }

/* ===== Contact ===== */
.section--contact { text-align: center; }
.contact-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.75rem; }
.social-links { display: flex; gap: 0.75rem; justify-content: center; }
.social-links a {
  display: flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border-radius: 50%; border: 1px solid var(--border-onDark); color: var(--text-onDark-mute);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.social-links a svg { width: 20px; height: 20px; }
.social-links a:hover { color: var(--amber); border-color: var(--amber); transform: translateY(-2px); }
.social-links a[hidden] { display: none; }
.social-links:empty { display: none; }

.contact-form {
  max-width: 560px; margin: 2.5rem auto 0; text-align: left; background: var(--ink-2);
  border: 1px solid var(--border-onDark); border-radius: 14px; padding: 2rem;
}
.contact-form label { display: block; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-onDark-mute); margin-bottom: 0.45rem; }
.contact-form input, .contact-form textarea {
  width: 100%; background: var(--ink-3); border: 1px solid var(--border-onDark); border-radius: 8px;
  padding: 0.85rem 0.95rem; min-height: 46px; color: var(--text-onDark); font-family: var(--font-body); font-size: 0.95rem; margin-bottom: 1.25rem;
}
.contact-form textarea { min-height: 120px; resize: vertical; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--signal); }
.contact-form input[aria-invalid="true"], .contact-form textarea[aria-invalid="true"] { border-color: #e5534b; }
.contact-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.contact-form button { width: 100%; min-height: 48px; }
.contact-form__status { margin-top: 1rem; font-size: 0.9rem; text-align: center; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.contact-form__status svg { width: 18px; height: 18px; flex-shrink: 0; }
.contact-form__status--success { color: #7fe0a0; }
.contact-form__status--error { color: #ff9b9b; }
@media (max-width: 560px) { .contact-form__row { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .contact-form { padding: 1.5rem; } }

/* ===== Footer ===== */
.footer { background: var(--ink-2); border-top: 1px solid var(--border-onDark); padding: 3.5rem 1.5rem 1.5rem; }
.footer__inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 2rem; }
.footer__brandRow { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.footer__logo { height: 28px; width: auto; max-width: 150px; object-fit: contain; }
.footer__brand { font-family: var(--font-mono); font-size: 1.1rem; margin: 0; }
.footer__desc { color: var(--text-onDark-mute); font-size: 0.9rem; max-width: 32ch; }
.footer__col h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-onDark-mute); margin-bottom: 0.9rem; }
.footer__col a { display: block; color: var(--text-onDark-mute); font-size: 0.9rem; margin-bottom: 0.6rem; }
.footer__col a:hover { color: var(--text-onDark); }
.footer__bottom { text-align: center; color: var(--text-onDark-mute); font-size: 0.8rem; margin-top: 2.5rem; }
@media (max-width: 700px) { .footer__inner { grid-template-columns: 1fr; } }

/* ===== Modal (blog post reader) ===== */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(11,18,32,0.75); backdrop-filter: blur(4px); }
.modal__panel {
  position: relative; background: var(--paper-2); color: var(--text-onLight); max-width: 720px; width: 100%;
  max-height: 85vh; overflow-y: auto; border-radius: 14px; padding: 2.5rem;
}
.modal__close {
  position: absolute; top: 1rem; right: 1.25rem; width: 40px; height: 40px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--border-onLight); cursor: pointer; color: var(--text-onLight);
  display: flex; align-items: center; justify-content: center; transition: background 0.2s ease, transform 0.2s ease; z-index: 2;
}
.modal__close:hover { background: var(--border-onLight); transform: rotate(90deg); }
.modal__close svg { width: 18px; height: 18px; }
.modal__panel img { border-radius: 8px; margin-bottom: 1.5rem; }
.modal__panel .media--blog { margin-bottom: 1.5rem; }
.modal__panel h2 { margin-bottom: 0.5rem; padding-right: 2.5rem; }
.modal__panel .post-meta { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-onLight-mute); margin-bottom: 1.5rem; }

/* ===== Blog post body typography ===== */
.post-body { font-size: 1rem; line-height: 1.75; word-wrap: break-word; }
.post-body h1, .post-body h2, .post-body h3, .post-body h4 { margin: 1.5em 0 0.5em; line-height: 1.3; }
.post-body h1 { font-size: 1.5rem; } .post-body h2 { font-size: 1.3rem; } .post-body h3 { font-size: 1.1rem; }
.post-body p { margin: 0 0 1.1em; }
.post-body ul, .post-body ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.post-body li { margin-bottom: 0.4em; }
.post-body a { color: var(--signal); text-decoration: underline; text-underline-offset: 2px; }
.post-body img { max-width: 100%; height: auto; border-radius: 8px; margin: 1.25em 0; }
.post-body pre {
  background: var(--ink-2); color: var(--text-onDark); padding: 1rem 1.25rem; border-radius: 8px;
  overflow-x: auto; font-family: var(--font-mono); font-size: 0.85rem; margin: 0 0 1.1em;
}
.post-body code { font-family: var(--font-mono); font-size: 0.88em; background: rgba(76,111,255,0.08); padding: 0.15em 0.4em; border-radius: 4px; }
.post-body pre code { background: none; padding: 0; }
.post-body blockquote { border-left: 3px solid var(--signal); margin: 0 0 1.1em; padding-left: 1rem; color: var(--text-onLight-mute); }
.post-body hr { border: none; border-top: 1px solid var(--border-onLight); margin: 2em 0; }

/* ===== Post / error empty states inside modal ===== */
.post-state { text-align: center; padding: 2rem 1rem; }
.post-state svg { width: 40px; height: 40px; color: var(--text-onLight-mute); margin-bottom: 1rem; }
.post-state p { color: var(--text-onLight-mute); margin-bottom: 1.25rem; }
@media (max-width: 480px) { .modal { padding: 0.75rem; } .modal__panel { padding: 1.5rem; border-radius: 12px; } }

/* ===== Toasts ===== */
.toast-stack {
  position: fixed; top: 1.25rem; right: 1.25rem; z-index: 500;
  display: flex; flex-direction: column; gap: 0.6rem; max-width: 360px;
}
.toast {
  background: var(--ink-2); border: 1px solid var(--border-onDark); border-left: 4px solid var(--signal);
  color: var(--text-onDark); padding: 0.9rem 1.1rem; border-radius: 8px; font-size: 0.9rem;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}
.toast--success { border-left-color: #3ec97a; }
.toast--error { border-left-color: #e5534b; }
.toast--info { border-left-color: var(--signal); }
.toast.is-leaving { animation: toast-out 0.2s ease forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ===== Spinners ===== */
.spinner {
  display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: currentColor; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -3px;
}
.spinner--dark { border-color: rgba(18,23,43,0.2); border-top-color: var(--signal); }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-loading { opacity: 0.75; pointer-events: none; display: inline-flex; align-items: center; gap: 0.55rem; }

.loading-row { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-mono); font-size: 0.9rem; color: var(--text-onDark-mute); padding: 1rem 0; }
.section--light .loading-row { color: var(--text-onLight-mute); }
.error-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; color: #ff9b9b; padding: 1rem 0; }
.error-row svg, .contact-form__status svg, .toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.section--light .error-row { color: #b3362f; }
.retry-btn {
  background: none; border: 1px solid currentColor; color: inherit; padding: 0.4rem 0.9rem; border-radius: 6px;
  font-size: 0.8rem; cursor: pointer; min-height: 32px; transition: opacity 0.15s ease;
}
.retry-btn:hover { opacity: 0.8; }

/* ===== Generic icon sizing ===== */
.icon { display: inline-block; width: 1em; height: 1em; vertical-align: -0.125em; flex-shrink: 0; }
.toast { display: flex; align-items: center; gap: 0.6rem; }

/* ===== Skeleton loaders ===== */
.skeleton { background: linear-gradient(90deg, var(--ink-3) 25%, #26314c 37%, var(--ink-3) 63%); background-size: 400% 100%; animation: skeleton-wave 1.4s ease infinite; border-radius: 8px; }
.section--light .skeleton { background: linear-gradient(90deg, #e9e6df 25%, #f1efe9 37%, #e9e6df 63%); background-size: 400% 100%; }
@keyframes skeleton-wave { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skeleton-card { height: 180px; border-radius: 10px; }

/* =========================================================
   PRELOADER — site name as the loading animation (not a spinner)
   ========================================================= */
.preloader {
  position: fixed; inset: 0; z-index: 9999; background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.preloader__inner { text-align: center; }
.preloader__prompt {
  font-family: var(--font-mono); color: var(--amber); font-size: 0.85rem; margin: 0 0 0.9rem;
  opacity: 0; animation: preloader-fade 0.4s ease forwards;
}
.preloader__title {
  font-family: var(--font-display); font-weight: 700; margin: 0; color: #fff;
  font-size: clamp(1.5rem, 6vw, 2.6rem); letter-spacing: 0.01em;
}
.pl { display: inline-block; opacity: 0; transform: translateY(16px); animation: preloader-letter 0.55s cubic-bezier(.2,.8,.2,1) forwards; }
.pl-space { width: 0.4em; }
.pl:nth-child(1) { animation-delay: 0.35s; } .pl:nth-child(2) { animation-delay: 0.39s; }
.pl:nth-child(3) { animation-delay: 0.43s; } .pl:nth-child(4) { animation-delay: 0.47s; }
.pl:nth-child(5) { animation-delay: 0.51s; } .pl:nth-child(6) { animation-delay: 0.55s; }
.pl:nth-child(7) { animation-delay: 0.59s; } .pl:nth-child(8) { animation-delay: 0.63s; }
.pl:nth-child(9) { animation-delay: 0.67s; } .pl:nth-child(10) { animation-delay: 0.71s; }
.pl:nth-child(11) { animation-delay: 0.75s; } .pl:nth-child(12) { animation-delay: 0.79s; }
.pl:nth-child(13) { animation-delay: 0.83s; } .pl:nth-child(14) { animation-delay: 0.87s; }
.pl:nth-child(15) { animation-delay: 0.91s; } .pl:nth-child(16) { animation-delay: 0.95s; }
.pl:nth-child(17) { animation-delay: 0.99s; }
.preloader__bar {
  width: 130px; height: 2px; background: rgba(255,255,255,0.15); margin: 1.6rem auto 0;
  overflow: hidden; border-radius: 2px; opacity: 0; animation: preloader-fade 0.4s ease forwards; animation-delay: 1.25s;
}
.preloader__barFill { width: 0%; height: 100%; background: var(--signal); animation: preloader-bar 0.85s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: 1.3s; }
@keyframes preloader-fade { to { opacity: 1; } }
@keyframes preloader-letter { to { opacity: 1; transform: none; } }
@keyframes preloader-bar { to { width: 100%; } }
.preloader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
body.is-preloading { overflow: hidden; }

/* =========================================================
   SCROLL REVEALS
   ========================================================= */
.reveal {
  opacity: 0; transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(.2,.8,.2,1), transform 0.7s cubic-bezier(.2,.8,.2,1);
}
.reveal.is-visible { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: 0.06s; }
.reveal-d2 { transition-delay: 0.14s; }
.reveal-d3 { transition-delay: 0.22s; }
.reveal-d4 { transition-delay: 0.3s; }

/* =========================================================
   REFINED MICRO-INTERACTIONS
   ========================================================= */

/* Buttons — smoother easing + press feedback */
.btn { transition: transform 0.2s cubic-bezier(.2,.8,.2,1), background 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease; }
.btn:active { transform: translateY(0) scale(0.97); }
.btn--primary:hover { box-shadow: 0 10px 26px rgba(76,111,255,0.32); }
.btn--outline:hover { box-shadow: 0 8px 20px rgba(76,111,255,0.18); }

/* Nav links — underline grow on hover */
.nav__links a:not(.nav__cta) { position: relative; }
.nav__links a:not(.nav__cta)::after {
  content: ''; position: absolute; left: 0; bottom: -5px; width: 0; height: 2px;
  background: var(--amber); transition: width 0.25s cubic-bezier(.2,.8,.2,1);
}
.nav__links a:not(.nav__cta):hover::after { width: 100%; }

/* Mobile nav — smooth open/close instead of instant toggle */
@media (max-width: 860px) {
  .nav__links {
    display: flex !important; opacity: 0; max-height: 0; overflow: hidden; pointer-events: none;
    transition: opacity 0.25s ease, max-height 0.35s cubic-bezier(.2,.8,.2,1);
  }
  .nav__links.is-open { opacity: 1; max-height: min(70vh, 480px); overflow-y: auto; pointer-events: auto; }
}
.nav__toggle span { transition: transform 0.25s ease, opacity 0.2s ease; }
.nav__toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle.is-active span:nth-child(2) { opacity: 0; }
.nav__toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Cards — smoother lift + shadow */
.card { transition: transform 0.3s cubic-bezier(.2,.8,.2,1), box-shadow 0.3s ease; }
.card:hover { transform: translateY(-6px); box-shadow: 0 18px 44px rgba(18,23,43,0.10); }
.project-card { transition: transform 0.3s cubic-bezier(.2,.8,.2,1), box-shadow 0.3s ease, border-color 0.3s ease; }
.project-card:hover { transform: translateY(-6px); box-shadow: 0 18px 44px rgba(0,0,0,0.35); border-color: rgba(76,111,255,0.35); }
.badge { transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease; }
.badge:hover { transform: translateY(-2px); border-color: var(--signal); color: var(--text-onDark); }

/* Links with a subtle nudge on hover */
.project-card__link, .blog-card__link { transition: transform 0.2s ease; display: inline-block; }
.project-card__link:hover, .blog-card__link:hover { transform: translateX(3px); }

/* Form inputs — focus glow */
.ai-chat__form input:focus { box-shadow: inset 0 0 0 1px var(--signal); }
.contact-form input, .contact-form textarea { transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.contact-form input:focus, .contact-form textarea:focus { box-shadow: 0 0 0 3px rgba(76,111,255,0.15); }

/* Shake for form validation errors */
@keyframes shake {
  10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); }
}
.shake { animation: shake 0.5s cubic-bezier(.36,.07,.19,.97); }

/* Success/error message + chat bubble entrance */
@keyframes fade-slide-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.contact-form__status:not([hidden]) { animation: fade-slide-up 0.4s ease; }
.ai-msg { animation: fade-slide-up 0.35s ease; }

/* Images — fade in once loaded (used by dynamically injected <img> tags) */
.img-fade { opacity: 0; transition: opacity 0.5s ease; }
.img-fade.is-loaded { opacity: 1; }

/* Toasts — smoother entrance/exit */
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(0.96); } to { opacity: 1; transform: translateX(0) scale(1); } }
.toast { animation: toast-in 0.35s cubic-bezier(.2,.8,.2,1); }

/* Modal — smoother open */
@keyframes modal-in { from { opacity: 0; transform: scale(0.97) translateY(8px); } to { opacity: 1; transform: none; } }
.modal:not([hidden]) .modal__panel { animation: modal-in 0.3s cubic-bezier(.2,.8,.2,1); }