/* ── CSS Custom Properties ── */
:root {
  --red:        #E3000F;
  --red-rgb:    227, 0, 15;
  --red-light:  #ff6b6b;
  --red-dim:    rgba(227,0,15,.15);
  --red-glow-md: rgba(227,0,15,.4);
  --red-glow-lg: rgba(227,0,15,.6);
  --dev-bg:      #f59e0b;
  --dev-text:    #000000;
  --preview-banner-bg: #f59e0b;
  --preview-banner-fg: #000;
  --preview-banner-h:  36px;
  --bg:         #111111;
  --bg-alt:     #0d0d0d;
  --bg-card:    #161616;
  --bg-inset:   #0a0a0a;
  --border:     #1e1e1e;
  --text:       #ffffff;
  --text-dim:   #888888;
  --text-muted: #555555;
  --nav-bg:     rgba(14,14,14,.96);
  --nav-h:      60px;
  --max-w:      1200px;
  --pad-x:      60px;
  --font:       'Helvetica Neue', Helvetica, Arial, sans-serif;
  --accent:     #E3000F;
  --surface:    #161616;
  /* Callout block colours */
  --callout-tip:       #27ae60;
  --callout-warning:   #f39c12;
  --callout-important: #e74c3c;
}
html.light {
  --dev-bg:     #f59e0b;
  --dev-text:   #000000;
  --preview-banner-bg: #f59e0b;
  --preview-banner-fg: #000;
  --preview-banner-h:  36px;
  --bg:         #ffffff;
  --bg-alt:     #f8f8f8;
  --bg-card:    #f2f2f2;
  --bg-inset:   #eeeeee;
  --border:     #e0e0e0;
  --text:       #111111;
  --text-dim:   #666666;
  --text-muted: #999999;
  --nav-bg:     rgba(255,255,255,.96);
  --accent:     #E3000F;
  --surface:    #f2f2f2;
  --mm-node-fill: #d0e4f7;
}

/* ── Reset + Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button { font-family: var(--font); cursor: pointer; }
main { flex: 1; }

/* ── Shared Typography ── */
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--red);
  margin-bottom: 14px;
}
h1 { font-size: 52px; font-weight: 900; line-height: 1.06; letter-spacing: -2px; color: var(--text); }
h2 { font-size: 40px; font-weight: 900; line-height: 1.08; letter-spacing: -1.5px; color: var(--text); }
h3 { font-size: 22px; font-weight: 800; line-height: 1.25; color: var(--text); }
.accent { color: var(--red); }

.btn-primary {
  display: inline-block;
  background: var(--red);
  color: #fff;
  border: none;
  padding: 14px 32px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  cursor: pointer;
  transition: opacity .2s;
}
.btn-primary:hover { opacity: .86; }
.btn-outline {
  display: inline-block;
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 12px 30px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  cursor: pointer;
  transition: border-color .2s;
}
.btn-outline:hover { border-color: var(--text-dim); }

/* ── Nav ── */
#nav {
  position: sticky;
  top: 0;
  height: var(--nav-h);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--pad-x);
  z-index: 200;
}
.nav-logo {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -.5px;
  color: var(--text);
  flex-shrink: 0;
}
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
  transition: color .2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--red); }
.nav-login {
  font-size: 11px;
  border: 1px solid var(--border);
  padding: 6px 14px;
  transition: border-color .2s, color .2s;
  background: none;
  color: inherit;
  cursor: pointer;
  font-family: var(--font);
  text-decoration: none;
}
.nav-login:hover { border-color: var(--text-muted); color: var(--text-dim); }
.nav-hire {
  display: inline-block;
  background: var(--red);
  color: #fff;
  border: none;
  padding: 9px 22px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: opacity .2s;
}
.nav-hire:hover { opacity: .86; }
.nav-theme {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  padding: 4px;
  transition: color .2s;
}
.nav-theme:hover { color: var(--text); }
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 4px;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); }

/* ── Dev site badge ── */
#dev-badge {
  position: fixed;
  top: 10px; left: 10px;
  z-index: 500;
  background: var(--dev-bg);
  color: var(--dev-text);
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── Hero (index.html) ── */
.hero {
  display: grid;
  grid-template-columns: 1fr 380px;
  min-height: calc(100vh - var(--nav-h));
  align-items: stretch;
}
.hero-text {
  padding: 80px var(--pad-x);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero-text h1 { margin-bottom: 20px; }
.hero-sub {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.72;
  margin-bottom: 36px;
  max-width: 440px;
}
.hero-btns { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-photo {
  border-left: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* ── About (about.html) ── */
.about {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: calc(100vh - var(--nav-h));
  align-items: stretch;
}
.about-photo {
  border-right: 1px solid var(--border);
  background: var(--bg-alt);
  overflow: hidden;
  position: relative;
}
.about-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.about-text {
  padding: 80px var(--pad-x);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.about-text h2 { margin-bottom: 22px; }
.about-text p {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.75;
  margin-bottom: 16px;
  max-width: 520px;
}
.about-stats { display: flex; gap: 36px; margin: 24px 0; flex-wrap: wrap; }
.stat-n { font-size: 34px; font-weight: 900; color: var(--red); line-height: 1; }
.stat-l { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .09em; margin-top: 4px; }
.about-skills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.skill-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  transition: all .2s;
}
.skill-tag:hover { border-color: var(--red); color: var(--red); }

/* ── Services (services.html) ── */
.services-hero { padding: 80px var(--pad-x) 60px; border-bottom: 1px solid var(--border); }
.services-hero h1 { margin-bottom: 14px; }
.services-hero .sub { font-size: 16px; color: var(--text-dim); max-width: 560px; line-height: 1.7; }
.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.service-card {
  padding: 44px 40px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.service-card:nth-child(3n) { border-right: none; }
.service-card h3 { font-size: 28px; font-weight: 900; letter-spacing: -1px; margin-bottom: 8px; }
.sk-sub {
  font-size: 12px;
  color: var(--red);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 18px;
}
.service-card p { font-size: 14px; color: var(--text-dim); line-height: 1.75; margin-bottom: 20px; }
.service-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.service-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 5px 12px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* ── Blog index (blog_index.html) ── */
.blog-hero { padding: 60px var(--pad-x) 32px; border-bottom: 2px solid var(--border); max-width: var(--max-w); margin: 0 auto; }
.blog-hero h1 { margin-bottom: 10px; }
.blog-hero .sub { font-size: 15px; color: var(--text-dim); line-height: 1.65; max-width: 600px; margin-top: 8px; }
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); max-width: var(--max-w); margin: 0 auto; }
.blog-card {
  padding: 36px 40px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: background .18s;
}
.blog-card:nth-child(3n) { border-right: none; }
.blog-card:hover { background: var(--bg-card); }
.blog-cat {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--red);
  margin-bottom: 10px;
}
.blog-card h2 { font-size: 20px; font-weight: 900; line-height: 1.25; letter-spacing: -.3px; margin-bottom: 12px; }
.blog-card .exc { font-size: 13px; color: var(--text-dim); line-height: 1.65; flex: 1; }
.blog-meta { font-size: 11px; color: var(--text-muted); margin-top: 18px; text-transform: uppercase; letter-spacing: .08em; }
.blog-read { font-size: 11px; font-weight: 700; color: var(--red); margin-top: 8px; text-transform: uppercase; letter-spacing: .08em; }
.blog-empty { padding: 60px var(--pad-x); color: var(--text-dim); }

/* ── Blog post (blog_post.html) ── */
.post-wrap {
  display: grid;
  grid-template-columns: 1fr 280px;
  min-height: calc(100vh - var(--nav-h));
  align-items: start;
  max-width: 1060px;
  margin: 0 auto;
}
.post-main { padding: 56px var(--pad-x); border-right: 1px solid var(--border); }
.post-main .blog-cat { margin-bottom: 12px; }
.post-main h1 { font-size: 32px; letter-spacing: -1px; line-height: 1.15; margin-bottom: 10px; }
.post-meta {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.post-sidebar {
  padding: 40px 28px;
  background: var(--bg-alt);
  position: sticky;
  top: var(--nav-h);
}
.post-sidebar h4 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.post-rel {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  transition: color .2s;
}
.post-rel:hover { color: var(--red); }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.post-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.post-nav a {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  border: 1.5px solid var(--border);
  padding: 9px 18px;
  color: var(--text-dim);
  transition: all .2s;
}
.post-nav a:hover { border-color: var(--text); color: var(--text); }

/* Prose (rendered markdown) */
.prose { color: var(--text-dim); font-size: 16px; line-height: 1.8; }
.prose h2 { font-size: 22px; font-weight: 800; letter-spacing: -.5px; color: var(--text); margin: 32px 0 14px; }
.prose h3 { font-size: 18px; font-weight: 700; color: var(--text); margin: 24px 0 10px; }
.prose p { margin-bottom: 18px; }
.prose ul, .prose ol { padding-left: 24px; margin-bottom: 18px; }
.prose li { margin-bottom: 6px; }
.prose code {
  font-size: 13px;
  background: var(--bg-card);
  padding: 2px 6px;
  color: var(--red);
  font-family: 'Courier New', monospace;
}
.prose pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 20px 24px;
  margin-bottom: 20px;
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; color: var(--text-dim); }
.prose blockquote { border-left: 3px solid var(--red); padding-left: 18px; color: var(--text-muted); font-style: italic; margin-bottom: 18px; }
.prose a { color: var(--red); text-decoration: underline; }
.prose strong { color: var(--text); font-weight: 700; }
/* CKEditor image figures — keep images responsive regardless of HTML width/height attrs */
.prose figure.image,
.prose figure.image_resized { max-width: 100%; }
.prose figure.image img,
.prose figure.image_resized img { width: 100%; height: auto; }
/* CKEditor float alignment */
.prose figure.image-style-align-right { float: right; margin-left: 1.5em; margin-bottom: 1em; }
.prose figure.image-style-align-left  { float: left;  margin-right: 1.5em; margin-bottom: 1em; }
.prose figure.image-style-block-align-right { margin-left: auto; }
.prose figure.image-style-block-align-left  { margin-right: auto; }

/* ── Contact (contact.html) ── */
.contact-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - var(--nav-h));
  align-items: stretch;
}
.contact-left {
  padding: 80px var(--pad-x);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border);
}
.contact-left h1 { margin-bottom: 20px; }
.contact-desc { font-size: 15px; color: var(--text-dim); line-height: 1.7; margin-bottom: 28px; }
.contact-email { font-size: 22px; font-weight: 700; color: var(--red); margin-bottom: 6px; }
.contact-loc { font-size: 13px; color: var(--text-muted); margin-bottom: 32px; }
.contact-avail { display: flex; gap: 28px; flex-wrap: wrap; }
.avail-l { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .09em; margin-bottom: 4px; }
.avail-v { font-size: 13px; color: var(--text-dim); }
.contact-right {
  padding: 80px 56px;
  background: var(--bg-alt);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.contact-right h2 { font-size: 28px; letter-spacing: -.5px; margin-bottom: 24px; }
.contact-success {
  background: var(--bg-card);
  border-left: 3px solid var(--red);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text-dim);
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  background: var(--bg);
  padding: 11px 16px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  display: block;
  margin-bottom: 14px;
  outline: none;
  transition: border-color .2s;
}
.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--red); }
.contact-form textarea { height: 120px; resize: vertical; }

/* ── Privacy (privacy.html) ── */
.privacy-wrap { max-width: 740px; margin: 0 auto; padding: 80px var(--pad-x); }
.privacy-wrap h1 { margin-bottom: 32px; }
.privacy-wrap h2 { font-size: 20px; margin: 32px 0 12px; }
.privacy-wrap p { font-size: 15px; color: var(--text-dim); line-height: 1.8; margin-bottom: 14px; }

/* ── Footer ── */
footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 48px var(--pad-x);
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-brand { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.footer-tagline { font-size: 13px; color: var(--text-dim); line-height: 1.6; }
.footer-tagline a { color: var(--red); }
.footer-links { display: flex; gap: 20px; align-items: flex-start; }
.footer-links a { font-size: 12px; color: var(--text-dim); transition: color .2s; }
.footer-links a:hover { color: var(--text); }
.footer-copy {
  max-width: var(--max-w);
  margin: 24px auto 0;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-copy a { color: var(--text-muted); transition: color .2s; }
.footer-copy a:hover { color: var(--text-dim); }

/* ── Chatbot Bubble ── */
#chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 300;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--red);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--red-glow-md);
  transition: transform .2s, box-shadow .2s;
}
#chat-bubble:hover { transform: scale(1.08); box-shadow: 0 6px 28px var(--red-glow-lg); }
#chat-bubble svg { width: 24px; height: 24px; fill: #fff; }
.chat-tip {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  padding: 6px 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .18s, transform .18s;
}
#chat-bubble:hover .chat-tip { opacity: 1; transform: translateY(0); }

/* ── Cookie Banner ── */
#cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 400;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 16px var(--pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
#cookie-banner p { font-size: 13px; color: var(--text-dim); }
#cookie-banner a { color: var(--red); }
.cookie-btns { display: flex; gap: 12px; }
.cookie-btns button {
  font-size: 12px;
  font-weight: 600;
  border: none;
  padding: 8px 18px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-family: var(--font);
}
.btn-essential { background: var(--bg-card); color: var(--text-dim); }
.btn-accept-all { background: var(--red); color: #fff; }

/* ── Mobile ── */
@media (max-width: 1023px) {
  :root { --pad-x: 40px; }
  h1 { font-size: 42px; }
  h2 { font-size: 34px; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-photo { height: 50vw; border-left: none; border-top: 1px solid var(--border); order: -1; }
  .about { grid-template-columns: 1fr; }
  .about-photo { height: 55vw; border-right: none; border-bottom: 1px solid var(--border); }
  .contact-wrap { grid-template-columns: 1fr; }
  .contact-left { border-right: none; border-bottom: 1px solid var(--border); }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .service-card:nth-child(3n) { border-right: 1px solid var(--border); }
  .service-card:nth-child(2n) { border-right: none; }
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
  .blog-card:nth-child(3n) { border-right: 1px solid var(--border); }
  .blog-card:nth-child(2n) { border-right: none; }
}
@media (max-width: 767px) {
  :root { --pad-x: 20px; }
  h1 { font-size: 32px; letter-spacing: -1px; }
  h2 { font-size: 26px; letter-spacing: -.5px; }

  /* Nav */
  #nav { padding: 0 20px; }
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 20px 20px;
    gap: 0;
  }
  .nav-links.open { display: flex; }
  .nav-links a { width: 100%; padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
  .nav-login { border: none; padding: 14px 0; }
  .nav-hire { width: 100%; text-align: center; margin-top: 14px; display: block; }
  .nav-theme { padding: 14px 0; }

  /* Hero */
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-photo { height: 65vw; border-left: none; border-top: 1px solid var(--border); order: -1; }
  .hero-text { padding: 44px 20px; }
  .hero-sub { max-width: 100%; }

  /* About */
  .about { grid-template-columns: 1fr; }
  .about-photo { height: 70vw; border-right: none; border-bottom: 1px solid var(--border); }
  .about-text { padding: 44px 20px; }

  /* Services */
  .services-hero { padding: 44px 20px 32px; }
  .services-grid { grid-template-columns: 1fr; }
  .service-card { padding: 32px 20px; border-right: none !important; }

  /* Blog */
  .blog-hero { padding: 44px 20px 24px; }
  .blog-grid { grid-template-columns: 1fr; }
  .blog-card { border-right: none !important; }

  /* Blog post */
  .post-wrap { grid-template-columns: 1fr; }
  .post-main { padding: 40px 20px; border-right: none; }
  .post-sidebar { position: static; padding: 28px 20px; border-top: 1px solid var(--border); }

  /* Contact */
  .contact-wrap { grid-template-columns: 1fr; }
  .contact-left { padding: 44px 20px; border-right: none; border-bottom: 1px solid var(--border); }
  .contact-right { padding: 44px 20px; }

  /* Footer */
  footer { padding: 36px 20px; }
  .footer-inner { flex-direction: column; }
  .footer-copy { flex-direction: column; }

  /* Privacy */
  .privacy-wrap { padding: 44px 20px; }

  /* Cookie */
  #cookie-banner { padding: 14px 20px; }

  /* Chatbot */
  #chat-bubble { bottom: 16px; right: 16px; width: 46px; height: 46px; }
  #chat-bubble svg { width: 20px; height: 20px; }
}

/* ── Spine-flip (home page only) ── */
body.flip-body {
  height: 100dvh;
  overflow: hidden;
}
body.flip-body main {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
body.flip-body footer { display: none; }

/* Slide deck */
.flip-slide {
  position: absolute;
  inset: 0;
  overflow: hidden;
  perspective: 2200px;
  perspective-origin: 50% 50%;
}
.flip-slide.above   { z-index: 1; }
.flip-slide.current { z-index: 3; }
.flip-slide.below   { z-index: 2; }

/* Half panels */
.flip-half {
  position: absolute;
  top: 0;
  height: 100%;
  overflow: hidden;
  backface-visibility: hidden;
  will-change: transform;
  transition: transform .8s cubic-bezier(.77,0,.175,1);
}
.flip-half.lf { left: 0;  width: 50%; transform-origin: right center; }
.flip-half.rf { right: 0; width: 50%; transform-origin: left center; }

/* Inner content — full-width, anchored to correct edge */
.flip-hi {
  position: absolute;
  top: 0;
  height: 100%;
  width: 100vw;
  overflow: hidden;
}
.flip-half.lf .flip-hi { left: 0; }
.flip-half.rf .flip-hi { right: 0; }

/* Folded states */
.flip-slide.above .flip-half.lf,
.flip-slide.below  .flip-half.lf { transform: rotateY(90deg);  }
.flip-slide.above .flip-half.rf,
.flip-slide.below  .flip-half.rf { transform: rotateY(-90deg); }
.flip-slide.current .flip-half   { transform: rotateY(0deg);   }

/* Nav dots */
#flip-dots {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.flip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.35);
  cursor: pointer;
  transition: all .25s;
  background: transparent;
  padding: 0;
}
.flip-dot:hover { border-color: rgba(255,255,255,.7); }
.flip-dot.active { background: #fff; border-color: #fff; transform: scale(1.4); }

/* Progress bar */
#flip-pbar {
  position: fixed;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--red);
  z-index: 600;
  transition: width .8s cubic-bezier(.65,0,.35,1);
}

/* Scroll hint on slide 1 */
#flip-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,.35);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  animation: flip-bob 2.2s ease-in-out infinite;
  pointer-events: none;
  z-index: 10;
}
@keyframes flip-bob {
  0%,100% { transform: translateX(-50%) translateY(0); }
  55%      { transform: translateX(-50%) translateY(9px); }
}

/* Slide content — each slide has padding-top for the fixed nav */
.flip-inner {
  width: 100%;
  height: 100%;
  padding-top: var(--nav-h);
  overflow: hidden;
  display: flex;
  align-items: stretch;
}

/* Slide 1: Hero */
.flip-hero {
  display: grid;
  grid-template-columns: 1fr 400px;
  width: 100%;
  align-items: stretch;
}
.flip-hero-text {
  padding: 60px var(--pad-x);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.flip-hero-text .eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--red);
  margin-bottom: 18px;
}
.flip-hero-text h1 {
  font-size: 52px;
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: -2px;
  color: var(--text);
  margin-bottom: 20px;
}
.flip-hero-text p {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.72;
  margin-bottom: 36px;
  max-width: 420px;
}
.flip-hero-btns { display: flex; gap: 14px; }
.flip-hero-photo {
  border-left: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.flip-hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

/* Slide 2: About */
.flip-about {
  display: grid;
  grid-template-columns: 360px 1fr;
  width: 100%;
  align-items: stretch;
}
.flip-about-photo {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.flip-about-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.flip-about-text {
  padding: 60px var(--pad-x);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.flip-about-text .eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--red);
  margin-bottom: 14px;
}
.flip-about-text h2 {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -1.5px;
  margin-bottom: 22px;
  line-height: 1.08;
}
.flip-about-text p {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.75;
  margin-bottom: 24px;
  max-width: 500px;
}

/* Slide 3: Services */
.flip-services {
  width: 100%;
  padding: 60px var(--pad-x);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.flip-services .eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--red);
  margin-bottom: 14px;
}
.flip-services h2 {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -1.5px;
  margin-bottom: 28px;
  line-height: 1.08;
}
.flip-svc-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 32px;
  border-top: 1px solid var(--border);
}
.flip-svc-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: color .18s;
}
.flip-svc-item:hover { color: var(--red); }
.flip-svc-n {
  font-size: 11px;
  font-weight: 700;
  color: var(--red);
  min-width: 28px;
}
.flip-svc-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
}
.flip-svc-arrow {
  font-size: 14px;
  color: var(--text-dim);
}

/* Slides 3–7: Individual service detail */
.flip-svc-detail {
  max-width: 760px;
  width: 100%;
  padding: 0 var(--pad-x);
  display: flex;
  flex-direction: column;
  margin: auto;
}
.flip-svc-detail-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.flip-svc-detail-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--red);
}
.flip-svc-detail h2 {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1.08;
  margin-bottom: 10px;
}
.flip-svc-sub {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: .04em;
  margin-bottom: 18px;
}
.flip-svc-body {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.75;
  margin-bottom: 20px;
  max-width: 600px;
}
.flip-svc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 28px;
}
.flip-tag {
  display: inline-block;
  padding: 4px 11px;
  font-size: 11px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  letter-spacing: .04em;
}

/* Slides 8–12: Blog post preview */
.flip-blog-prev {
  max-width: 720px;
  width: 100%;
  padding: 0 var(--pad-x);
  display: flex;
  flex-direction: column;
  margin: auto;
}
.flip-blog-prev .eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--red);
  margin-bottom: 18px;
}
.flip-blog-prev h2 {
  font-size: clamp(26px, 3.5vw, 44px);
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 20px;
}
.flip-blog-prev p {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.75;
  margin-bottom: 18px;
  max-width: 580px;
}
.flip-blog-meta {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 28px;
}

/* Slide 4: Contact CTA */
.flip-contact {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 60px var(--pad-x);
  text-align: center;
}
.flip-contact .eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--red);
  margin-bottom: 14px;
}
.flip-contact h2 {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1.05;
  margin-bottom: 20px;
}
.flip-contact p {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.7;
  max-width: 480px;
  margin-bottom: 32px;
}
.flip-contact-btns {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 48px;
}
.flip-mini-footer {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.flip-mini-footer-links {
  display: flex;
  gap: 20px;
}
.flip-mini-footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  transition: color .18s;
}
.flip-mini-footer-links a:hover { color: var(--text); }

/* Mobile: disable flip, use normal scroll */
@media (max-width: 767px) {
  body.flip-body { height: auto; overflow: auto; }
  body.flip-body main { position: static; overflow: visible; }
  body.flip-body footer { display: block; }
  .flip-slide { position: static; perspective: none; }
  .flip-slide.above, .flip-slide.below, .flip-slide.current { z-index: auto; }
  .flip-half.lf { position: static; width: 100%; left: auto; transform: none !important; transition: none; }
  .flip-half.rf { display: none; }
  .flip-hi { position: static; width: 100%; overflow: visible; }
  #flip-dots, #flip-pbar, #flip-hint { display: none; }
  .flip-inner { padding-top: 0; height: auto; flex-direction: column; }
  .flip-hero { grid-template-columns: 1fr; }
  .flip-hero-photo { height: 65vw; width: 100%; border-left: none; border-top: 1px solid var(--border); order: -1; }
  .flip-hero-text { padding: 44px 20px; }
  .flip-hero-text h1 { font-size: 34px; letter-spacing: -1px; }
  .flip-hero-btns { flex-wrap: wrap; }
  .flip-about { grid-template-columns: 1fr; }
  .flip-about-photo { height: 70vw; width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .flip-about-text { padding: 44px 20px; }
  .flip-about-text h2 { font-size: 28px; }
  .flip-services { padding: 44px 20px; }
  .flip-svc-detail { padding: 44px 20px; }
  .flip-blog-prev { padding: 44px 20px; }
  .flip-contact { padding: 44px 20px; text-align: left; align-items: flex-start; }
  .flip-contact-btns { justify-content: flex-start; }
}

/* ── Admin auth forms ── */
.admin-auth-wrap {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.admin-auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.admin-auth-logo {
  font-size: 22px;
  font-weight: 900;
  color: var(--red);
  letter-spacing: -1px;
  margin-bottom: 16px;
}
.admin-auth-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 24px;
}
.admin-auth-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
  line-height: 1.6;
}
.admin-auth-error {
  background: rgba(var(--red-rgb), .12);
  border: 1px solid rgba(var(--red-rgb), .3);
  color: var(--red-light);
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 20px;
  border-radius: 2px;
}
.admin-auth-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.admin-auth-form label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  margin-bottom: 6px;
  margin-top: 16px;
}
.admin-auth-form label:first-of-type { margin-top: 0; }
.admin-auth-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color .18s;
}
.admin-auth-form input:focus { border-color: var(--red); }
.admin-auth-submit { margin-top: 28px; width: 100%; text-align: center; }
.admin-auth-back {
  display: block;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  text-align: center;
  transition: color .18s;
}
.admin-auth-back:hover { color: var(--text); }

/* ── Admin dashboard ── */
.admin-dash-wrap {
  padding: calc(var(--nav-h) + 48px) var(--pad-x) 80px;
}
.admin-dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.admin-dash-user {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
}
.admin-dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
}
.admin-dash-card {
  background: var(--bg);
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-dash-card h2 { font-size: 22px; font-weight: 900; letter-spacing: -.5px; }
.admin-dash-card p { font-size: 14px; color: var(--text-dim); line-height: 1.6; flex: 1; }
.admin-dash-card .btn-primary { align-self: flex-start; margin-top: 8px; }

@media (max-width: 767px) {
  .admin-auth-card { padding: 32px 24px; }
  .admin-dash-wrap { padding: calc(var(--nav-h) + 32px) 20px 60px; }
  .admin-dash-header { flex-direction: column; gap: 20px; }
  .admin-dash-grid { grid-template-columns: 1fr; }
}

/* ── About page — section tabs ─────────────────────────────── */
.about-hero { display: flex; gap: 48px; align-items: flex-start; max-width: var(--max-w); margin: 0 auto; padding: 60px var(--pad-x) 40px; }
.about-tabs-wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--pad-x) 80px; }
.about-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 40px; }
.about-tab { background: none; border: none; padding: 12px 20px; font-size: 15px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: color 0.2s, border-color 0.2s; }
.about-tab:hover { color: var(--text); }
.about-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.about-tab-panel { display: none; }
.about-tab-panel.active { display: block; }

/* Experience list */
.experience-list { display: flex; flex-direction: column; gap: 32px; }
.experience-entry { display: grid; grid-template-columns: 160px 1fr; gap: 24px; padding: 24px 0; border-bottom: 1px solid var(--border); }
.experience-entry:last-child { border-bottom: none; }
.exp-period { font-size: 13px; font-weight: 600; color: var(--accent); letter-spacing: .04em; text-transform: uppercase; padding-top: 4px; }
.exp-company { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.exp-role { font-size: 14px; font-weight: 600; color: var(--text-muted); margin-bottom: 12px; letter-spacing: .03em; text-transform: uppercase; }
.exp-desc { font-size: 15px; color: var(--text-muted); line-height: 1.65; margin: 0; }

/* Projects grid */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.project-name { font-size: 18px; font-weight: 700; color: var(--text); }
.project-desc { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin: 0; flex: 1; }
.project-tech { display: flex; flex-wrap: wrap; gap: 6px; }
.project-link { align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; padding: 4px 0; }
.project-link:hover { text-decoration: underline; }

/* Journey narrative */
.journey-prose { max-width: 720px; }
.journey-prose p { font-size: 16px; line-height: 1.75; color: var(--text-muted); margin-bottom: 20px; }

.about-empty { color: var(--text-muted); font-size: 14px; }

/* Mobile */
@media (max-width: 767px) {
  .about-hero { flex-direction: column; padding-top: 32px; }
  .experience-entry { grid-template-columns: 1fr; gap: 8px; }
  .projects-grid { grid-template-columns: 1fr; }
  .about-tabs { overflow-x: auto; }
}

/* ── Blog embed types ─────────────────────────────────────── */

/* Callout blocks */
.callout {
  border-left: 4px solid var(--accent);
  background: var(--bg-card);
  padding: 16px 20px;
  margin: 1.5em 0;
  border-radius: 0 6px 6px 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-dim);
}
.callout-info  { border-left-color: var(--accent); }
.callout-tip   { border-left-color: var(--callout-tip); }
.callout-warning   { border-left-color: var(--callout-warning); }
.callout-important { border-left-color: var(--callout-important); }

/* Chart embed wrapper */
.chart-embed {
  width: 100%;
  max-width: 720px;
  margin: 1.5em auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}
.chart-embed canvas { display: block; width: 100% !important; }

/* Mermaid diagram wrapper */
.mermaid-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1.5em 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

/* Pull quote */
.pull-quote {
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  border-left: none;
  border-right: none;
  padding: 20px 0;
  margin: 2em 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
  font-style: normal;
}

/* Code blocks */
.prose pre {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px;
  overflow-x: auto;
  margin: 1.5em 0;
  font-size: 13px;
  line-height: 1.6;
}
.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* ── Public Chat Panel ── */
.pub-chat-panel {
  position: fixed;
  bottom: 88px;
  right: 28px;
  width: 360px;
  height: 480px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  z-index: 900;
  background: var(--bg);
  border: 1px solid var(--border);
}
.pub-chat-header {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 13px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.pub-chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  opacity: .8;
  transition: opacity .15s;
}
.pub-chat-close:hover { opacity: 1; }
.pub-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg-alt);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.pub-chat-messages::-webkit-scrollbar { width: 5px; }
.pub-chat-messages::-webkit-scrollbar-track { background: transparent; }
.pub-chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.pub-chat-msg {
  max-width: 80%;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}
.pub-chat-msg-user {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.pub-chat-msg-assistant {
  margin-right: auto;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
/* Typing indicator */
.pub-chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}
.pub-chat-typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: pubChatDot 1.2s infinite ease-in-out;
}
.pub-chat-typing span:nth-child(2) { animation-delay: .2s; }
.pub-chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes pubChatDot {
  0%, 60%, 100% { opacity: .3; transform: scale(.8); }
  30% { opacity: 1; transform: scale(1); }
}
/* Input row */
.pub-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.pub-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 12px;
  resize: none;
  outline: none;
  line-height: 1.4;
  max-height: 80px;
}
.pub-chat-input::placeholder { color: var(--text-muted); }
.pub-chat-send {
  background: var(--accent);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  margin: 6px 8px 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity .15s;
}
.pub-chat-send:hover { opacity: .85; }

/* Mobile chat panel */
@media (max-width: 480px) {
  .pub-chat-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 60vh;
    border-radius: 12px 12px 0 0;
  }
}
