/* ==========================================================================
   Andy King — portfolio theme
   Desktop-first with mobile fallback (<= 768px)
   ========================================================================== */

:root {
  --bg: #f4f4f4;
  --ink: #1a1a1a;
  --accent: #7B68C8;
  --pill: #4a4458;
  --pill-text: #cbc6d8;
  --bubble: #1982FC;
  --scroll-track: #9888c4;
  --scroll-face: #c0c0c0;
  --scroll-bar-bg: #b8aed8;
  --col-w: 240px;          /* text column width (13px body) */
  --col-gap: 16px;
  --box-pad: 16px;         /* padding inside white gallery box */
  --img-w: 460px;          /* gallery image width */
  --img-gap: 5px;         /* gap between images (50% of box pad ~) */
  --sidebar-w: 260px;
  --box-h: 72vh;           /* gallery/about box height */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'NHG', 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  line-height: 15.5px;
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 150vh;             /* taller than viewport so the ring bottom scrolls into view */
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- Fixed background elements (desktop) ---------- */
.bg-layer { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }

.bg-sonofman {
  position: absolute;
  top: 12px;
  right: -4vw;
  width: 62vw;
  max-width: 1000px;
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

.bg-donut {
  position: absolute;
  top: 12px;
  left: 43%;
  width: 108px;
  z-index: 1;
  pointer-events: none;
}

.bg-bin {
  position: absolute;
  top: calc(150px + 72vh + 30px);
  left: calc(var(--sidebar-w) + 12px);
  width: 88px;
  z-index: 3;
  pointer-events: none;
}

.bg-gif {
  position: absolute;
  top: calc(150px + 72vh + 30px);
  right: 3vw;
  width: 150px;
  z-index: 3;
  pointer-events: none;
  border-radius: 2px;
}

/* ---------- Lobsters (drift, above everything except bubbles) ---------- */
.lobster {
  position: fixed;
  z-index: 6;
  font-size: 22px;
  line-height: 1;
  pointer-events: none;
  will-change: transform;
}

/* ---------- Header logo ---------- */
.site-logo {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 480px;
  z-index: 5;
  pointer-events: none;
}
.site-logo img { width: calc(100% * 0.9); height: auto; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--sidebar-w);
  z-index: 4;
  padding: 178px 24px 24px 24px;
  display: flex;
  flex-direction: column;
}

.project-list { list-style: none; margin-bottom: 22px; }
.project-list li { margin: 0; }
.project-list a {
  font-size: 17px;
  line-height: 1.55;
  display: inline-block;
}
.project-list a:hover,
.project-list li.active a { color: var(--accent); }

.assistant {
  display: inline-block;    /* hug the bar's width */
  margin-bottom: 32px;
}

.assistant-video{display:block;width:fit-content;max-width:100%;height:auto;}

/* AI assistant pill — auto-hugs its content so text never clips */
.ding-form {
  display: flex;
  align-items: center;
  background: var(--pill);
  border-radius: 20px;
  padding: 3px 3px 3px 0;
  width: fit-content;
  gap: 6px;
}
.ding-form input {
  width: auto;
  border: none;
  background: transparent;
  color: var(--pill-text);
  font-family: inherit;
  font-size: 8.5px;
  padding: 4px 8px 4px 11px;   /* right padding before the button */
  outline: none;
}
.ding-form input::placeholder { color: var(--pill-text); opacity: 1; }
.ding-form button {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid #d8d4e0;
  background: var(--bg);
  color: var(--pill);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-links { list-style: none; margin-top: 4px; }
.nav-links li { display: flex; align-items: center; gap: 7px; font-size: 17px; line-height: 1.7; }
.nav-links .emoji { font-size: 15px; }

/* ---------- Main content area ---------- */
.main {
  position: absolute;
  left: var(--sidebar-w);
  top: 0;
  right: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  padding-top: 150px;      /* clear the logo */
  padding-right: 12px;
}

/* white gallery/about box masks the middle of sonofman */
.content-box {
  background: #ffffff;
  height: var(--box-h);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
}

/* ---------- Horizontal scroll gallery (posts) ---------- */
.hscroll {
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.hscroll::-webkit-scrollbar { display: none; height: 0; width: 0; }

.hscroll-inner {
  display: flex;
  flex-direction: row;
  height: 100%;
  padding: var(--box-pad) 0 var(--box-pad) var(--box-pad);
  align-items: stretch;
  width: max-content;
}

/* newspaper-style text flow: fill column top→bottom, wrap to next */
.post-text {
  height: 100%;
  display: flex;
  flex-flow: column wrap;
  align-content: flex-start;
  gap: 0 var(--col-gap);
  flex-shrink: 0;
}
.post-text p {
  width: var(--col-w);
  margin: 0;
}
.post-text p + p { text-indent: 1.4em; }

.gap-spacer { width: var(--box-pad); flex-shrink: 0; }
.end-spacer { width: var(--box-pad); flex-shrink: 0; }

/* wrapper disappears from layout so injected images become direct
   items in the horizontal flex row (instead of stacking vertically) */
.gallery-mount { display: contents; }

.gallery-item {
  flex:0 0 auto;
  width:auto;
  flex-shrink:0;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.gallery-item + .gallery-item { margin-left: var(--img-gap); }
.gallery-item .img-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
}
.gallery-item .img-wrap img {
  height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
}
.gallery-item figcaption {
  height: 22px;
  flex-shrink: 0;
  padding-top: 6px;
  font-size: 13px;
  line-height: 15.5px;
  color: #333;
}

/* ---------- Retro Win95 scrollbar ---------- */
.retrobar {
  height: 16px;
  background: var(--scroll-bar-bg);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  user-select: none;
}
.rb-btn {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background: var(--scroll-face);
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #606060;
  border-bottom: 2px solid #606060;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  line-height: 1;
  cursor: pointer;
  font-family: monospace;
  color: #000;
}
.rb-btn:active {
  border-top: 2px solid #606060;
  border-left: 2px solid #606060;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}
.rb-track {
  flex: 1;
  position: relative;
  background: var(--scroll-track);
  cursor: pointer;
}
.rb-thumb {
  position: absolute;
  left: 0;
  top: 0;
  height: 16px;
  width: 70px;
  background: var(--scroll-face);
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #606060;
  border-bottom: 2px solid #606060;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: grab;
}
.rb-thumb:active { cursor: grabbing; }
.rb-grip { width: 1px; height: 8px; background: #606060; }
.rb-grip-w { width: 1px; height: 8px; background: #fff; }

/* ---------- About page (static, no scroll) ---------- */
.about-box {
  background: #ffffff;
  height: var(--box-h);
  position: relative;
  z-index: 2;
  display: flex;
  padding: var(--box-pad);
}
.about-text {
  display: flex;
  flex-flow: column wrap;
  align-content: flex-start;
  gap: 0 var(--col-gap);
  height: 100%;
  flex-shrink: 0;
}
.about-text p {
  width: var(--col-w);
  margin: 0;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  text-align: justify;
}
.about-text p:first-child { color: var(--accent); }
.about-text p + p { text-indent: 1.4em; }
.about-media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.about-media video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ---------- Landing (no project selected) ---------- */
.landing-blank { flex: 1; }

/* ---------- Ding speech bubbles ---------- */
.ding-bubble {
  position: fixed;
  background: var(--bubble);
  color: #fff;
  font-size: 13px;
  line-height: 1.2;
  padding: 6px 11px;
  border-radius: 14px 14px 14px 3px;
  white-space: nowrap;
  z-index: 8;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.ding-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 8px;
  border: 6px solid transparent;
  border-top-color: var(--bubble);
  border-bottom: 0;
  border-left: 0;
}

/* ==========================================================================
   MOBILE (<= 768px)  — minimal vertical layout
   ========================================================================== */
@media (max-width: 768px) {
  body { overflow: auto; font-size: 13px; min-height: 0; }

  /* hide all desktop-only chrome */
  .bg-sonofman, .bg-donut, .bg-bin, .bg-gif,
  .lobster, .sidebar .assistant, .sidebar .ding-form,
  .assistant-video, .retrobar {
    display: none !important;
  }

  .site-logo { position: static; width: 100%; padding: 10px 16px 0; }
  .site-logo img { width: calc(78% * 0.8); }

  /* top bar with burger */
  .m-topbar {
    display: flex;
    align-items: center;
    padding: 12px 16px 0;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 30;
  }
  .m-burger { display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
  .m-burger span { width: 24px; height: 2px; background: var(--ink); display: block; }

  .m-menu {
    display: none;
    padding: 8px 16px 14px;
    background: var(--bg);
    border-bottom: 0.5px solid #ddd;
  }
  .m-menu.open { display: block; }
  .m-menu ul { list-style: none; }
  .m-menu .project-list a { font-size: 16px; line-height: 2; }
  .m-menu .nav-links li { font-size: 16px; line-height: 2; }
  .m-menu-sep { height: 10px; }

  /* sidebar becomes flow container for menu only */
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 0;
    display: block;
  }
  .sidebar .project-list,
  .sidebar .nav-links { display: none; }  /* projects/nav live in burger on mobile */

  .main {
    position: static;
    left: 0;
    padding: 0 16px 40px;
    display: block;
    height: auto;
  }

  /* content box unwraps to vertical flow */
  .content-box, .about-box {
    background: transparent;
    height: auto;
    display: block;
    padding: 0;
  }
  .hscroll { overflow: visible; height: auto; }
  .hscroll-inner {
    display: block;
    width: auto;
    height: auto;
    padding: 0;
  }

  .post-text, .about-text {
    display: block;
    height: auto;
    margin-bottom: 18px;
  }
  .post-text p, .about-text p { width: 100%; }
  .about-text p:first-child { color: var(--ink); }  /* no purple highlight on mobile */

  .gap-spacer, .end-spacer { display: none; }

  .gallery-item {
    width: 100%;
    display: block;
    margin: 0 0 22px 0 !important;
  }
  .gallery-item .img-wrap { height: auto; }
  .gallery-item .img-wrap img { height: auto; }
  .gallery-item figcaption { height: auto; }

  .about-media { display: block; margin-top: 8px; }
  .about-media video { width: 100%; height: auto; }

  /* landing decorative stack (mobile, landing only) */
  .m-landing-decor { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 6px 0 30px; }
  .m-landing-decor .donut { width: 92px; }
  .m-landing-decor .ring { width: 92%; }
  .m-landing-decor .bin { width: 74px; align-self: flex-end; margin-right: 24px; }
  .m-landing-decor .gif { width: 170px; border-radius: 3px; }

  .ding-bubble { display: none !important; }  /* no AI on mobile */
}

/* Desktop: hide mobile-only elements */
@media (min-width: 769px) {
  .m-topbar, .m-menu, .m-landing-decor { display: none !important; }
}

/* ==========================================================================
   Koenig editor card classes (required by Ghost)
   ========================================================================== */
.kg-width-wide { position: relative; }
.kg-width-full { position: relative; }
.kg-image-card img { margin: 0 auto; }
.kg-image-card.kg-width-wide img { max-width: 100%; }
.kg-image-card.kg-width-full img { max-width: 100%; }

.kg-embed-card { display: flex; flex-direction: column; align-items: center; }
.kg-gallery-container { display: flex; flex-direction: column; }
.kg-gallery-row { display: flex; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; }
.kg-bookmark-card a { text-decoration: none; }

/* Custom fonts support (Ghost setting) */
:root {
  --gh-font-heading: 'NHG', 'Helvetica Neue', Arial, sans-serif;
  --gh-font-body: 'NHG', 'Helvetica Neue', Arial, sans-serif;
}
body { font-family: var(--gh-font-body); }

.site-logo img{transform:scale(.9);transform-origin:center;}
.kg-gallery-row{gap:5px!important}.kg-gallery-image img{height:auto}.crying-man, .hero-video{margin-bottom:24px;width:100%!important;}
