/* ================================================================
   Josh Wu Portfolio — Craigslist-faithful layout
   ================================================================ */

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

html, body { height: 100%; }

body {
  font-family: Arial, sans-serif;
  font-size: 13px;
  color: #333;
  background: #fff;
}

a { color: #0e0be1; text-decoration: none; }
a:hover { text-decoration: underline; }

hr.rule {
  border: none;
  border-top: 0px solid #999;
  margin: 8px 0 0;
}

/* ── Page wrapper — sticky footer anchor ─────── */
#page {
  width: 1000px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── 3-panel content row ──────────────────────── */
#content { display: flex; align-items: stretch; flex: 1 0 auto; }

/* ── LEFT SIDEBAR ─────────────────────────────── */
#leftbar {
  order: 0;
  flex: 0 0 230px;
  width: 230px;
  background: #ededed;
  border-left: 1px solid #bbb;
  border-right: 1px solid #bbb;
  padding: 12px 12px 20px;
  margin: 14px 0 18px;
  min-height: 580px;
}

#logo-link {
  font-family: 'Times New Roman', Times, serif;
  font-size: 26px;
  color: #591c9a;
  display: block;
  text-align: center;
  text-decoration: none;
  line-height: 1.2;
  margin-bottom: 1px;
}
#logo-link:hover { text-decoration: underline; }

#descriptor {
  text-align: center;
  font-size: 11px;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.3;
}

/* search */
#search-wrap { margin-bottom: 10px; position: relative; }
#search-wrap svg { position: absolute; left: 5px; top: 50%; transform: translateY(-50%); pointer-events: none; }
#search {
  width: 100%;
  font: 12px Arial, sans-serif;
  color: #333;
  border: 1px solid #999;
  padding: 3px 5px 3px 22px;
  outline: none;
}
#search:focus { border-color: #591c9a; }

/* sidebar section label */
.lbar-label {
  font-size: 11px;
  font-weight: bold;
  color: #0e0be1;
  text-align: center;
  border-bottom: 1px solid #ccc;
  padding-bottom: 2px;
  margin: 6px 0 4px;
}

/* sidebar link list — centered, purple */
.lbar-list { list-style: none; }
.lbar-list li { margin: 2px 0; text-align: center; }
.lbar-list a { color: #0e0be1; font-size: 13px; }
.lbar-list a:hover { text-decoration: underline; }
.lbar-list .dim { color: #888; font-size: 11px; }

/* sidebar plain text list */
.lbar-plain { list-style: none; }
.lbar-plain li {
  margin: 5px 0;
  font-size: 12px;
  color: #444;
  line-height: 1.4;
}

/* ── RIGHT SIDEBAR ────────────────────────────── */
#rightbar {
  order: 2;
  flex: 0 0 136px;
  width: 120px;
  border-left: 1px solid #ccc;
  padding: 0 8px;
  margin: 14px 0 18px;
  min-height: 580px;
}

.rbar-title {
  color: #0e0be1;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  border-top: 1px solid #999;
  border-bottom: 1px solid #999;
  background: #fff;
  padding: 2px 4px;
  margin-bottom: 6px;
}

.rbar-group {
  font-size: 10px;
  font-weight: bold;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 8px 0 2px;
}

.rbar-list { list-style: none; }
.rbar-list li { margin: 2px 0; }
.rbar-list a { color: #0e0be1; font-size: 12px; }
.rbar-list a:hover { text-decoration: underline; }
.rbar-list a.active { font-weight: bold; text-decoration: underline; }
#show-all { color: #0e0be1; }

/* ── CENTER PANEL ─────────────────────────────── */
#center {
  order: 1;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  padding: 14px 12px 8px 12px;
}

/* ── TOP BAR (location + action icons) ────────── */
#topbar {
  background: #ededed;
  border-top: 1px solid #bbb;
  border-bottom: 1px solid #bbb;
  padding: 10px 14px;
  margin-bottom: 14px;
  overflow: hidden;
}
.tb-location {
  float: left;
  font-family: 'Times New Roman', Times, serif;
  font-size: 20px;
  color: #0e0be1;
  line-height: 34px;
  cursor: pointer;
}
.tb-location:hover { text-decoration: underline; }
.tb-pin { color: #0e0be1; margin-right: 3px; }
.tb-actions { float: right; }
.tb-actions a {
  float: left;
  margin-left: 18px;
  text-align: center;
  font-size: 10px;
  color: #0e0be1;
  line-height: 1.15;
}
.tb-actions a:hover { text-decoration: none; }
.tb-actions a:hover .tb-label { text-decoration: underline; }
.tb-icon { display: block; font-size: 19px; margin-bottom: 1px; }

/* 3 equal columns */
.col-wrap::after { content: ''; display: block; clear: both; }
.col {
  float: left;
  width: 33.33%;
  padding-right: 12px;
  vertical-align: top;
}
.col:last-child { padding-right: 0; }

/* ── Section block ────────────────────────────── */
.section { margin-bottom: 14px; }

/* THE key element: purple bordered box, centered, linkable */
.section-header {
  color: #0e0be1;
  font-size: 13px;
  font-weight: bold;
  text-align: center;
  border-top: 1px solid #999;
  border-bottom: 1px solid #999;
  background: #ebebeb;
  line-height: 1.4;
}
.section-header a {
  color: #0e0be1;
  text-decoration: none;
  display: block;
  padding: 2px 6px;
}
.section-header a:hover { text-decoration: underline; }

/* Section body */
.section-body {
  padding: 3px 2px 0;
}
.section-body ul { list-style: none; }
.section-body ul li { margin: 0; line-height: 1.4; border-bottom: 1px solid #d0d0d0; padding: 2px 0; }
.section-body ul li:hover { background: #f0f0f0; }
.section-body ul li:last-child { border-bottom: none; }
.section-body ul li a { font-size: 13px; color: #0e0be1; }
.section-body ul li a:hover { text-decoration: underline; }
.section-body ul li.plain { color: #444; font-size: 13px; }
.section-body ul li .sub { display: block; color: #555; font-size: 12px; line-height: 1.35; }

/* skills all-view category header */
.skill-cat-header {
  font-weight: bold;
  color: #0e0be1;
  font-size: 12px;
  margin-top: 10px;
  padding-top: 4px;
  border-top: 1px solid #ddd;
}
.skill-cat-header:first-child { margin-top: 2px; border-top: none; }

/* two-column project list inside a section */
.two-col { overflow: hidden; }
.two-col ul {
  float: left;
  width: 50%;
}
.two-col ul:first-child { padding-right: 10px; }
.two-col ul:last-child  { padding-left: 4px; }

/* hidden states for JS filter */
.section-body ul li.hidden { display: none; }
#no-results {
  font-size: 11px;
  color: #888;
  padding: 4px 2px;
}

/* ── STICKY FOOTER ────────────────────────────── */
#footer {
  flex: 0 0 auto;
  height: 26px;
  background: #ededed;
  border-top: 1px solid #bbb;
  font-size: 11px;
  color: #888;
  text-align: center;
  line-height: 26px;
}
#footer a { color: #0e0be1; }
#footer a:hover { text-decoration: underline; }

/* ================================================================
   PROJECTS GRID PAGE (projects.html)
   ================================================================ */

#grid-page { padding: 0 4px; flex: 1 0 auto; }

.grid-topbar {
  padding: 6px 0 5px;
  font-size: 12px;
  border-bottom: 1px solid #ccc;
  margin-bottom: 8px;
}
.grid-topbar #logo-small {
  font-family: 'Times New Roman', Times, serif;
  font-size: 18px;
  color: #591c9a;
  text-decoration: none;
}
.grid-topbar #logo-small:hover { text-decoration: underline; }
.grid-topbar .sep { margin: 0 6px; color: #999; }
.grid-topbar .back { color: #0e0be1; }

.grid-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 2px;
  color: #0e0be1;
}
.grid-subtitle {
  font-size: 11px;
  color: #888;
  margin-bottom: 8px;
}

/* the grid itself — border-collapse style via border-top + border-left on container */
.proj-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #ccc;
  border-left: 1px solid #ccc;
}
.proj-card {
  border-right: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  padding: 8px 10px;
  box-sizing: border-box;
}
.card-img {
  margin: -8px -10px 8px;
  overflow: hidden;
  height: 130px;
  background: #f0f0f0;
}
.card-img img,
.card-img video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-title { font-size: 13px; font-weight: bold; margin-bottom: 2px; }
.card-title a { color: #0e0be1; }
.card-title a:hover { text-decoration: underline; }
.card-desc { font-size: 12px; color: #555; margin-bottom: 3px; line-height: 1.3; }
.card-tech { font-size: 11px; color: #999; }

/* ================================================================
   PROJECT MEDIA — Craigslist-style gallery
   ================================================================ */

.gallery { margin-bottom: 12px; max-width: 640px; }

/* large main viewer */
.gallery-main {
  width: 100%;
  height: 400px;
  border: 1px solid #ccc;
  border-bottom: none;
  background: #111;
  overflow: hidden;
  position: relative;
}
.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #111;
}
.gallery-main video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

/* thumbnail strip */
.gallery-thumbs {
  border: 1px solid #ccc;
  background: #f4f4f4;
  padding: 4px 4px 2px;
  overflow: hidden;
}
.gallery-thumb {
  float: left;
  width: 76px;
  height: 60px;
  border: 2px solid #ccc;
  margin: 2px 3px 2px 0;
  cursor: pointer;
  overflow: hidden;
  background: #ddd;
  position: relative;
}
.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-thumb.active { border-color: #591c9a; }
.gallery-thumb:hover { border-color: #888; }
.gallery-thumb.active:hover { border-color: #591c9a; }

/* video thumbnail — dark bg + play icon */
.gallery-thumb-video {
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.gallery-thumb-video::after {
  content: '▶';
  color: #fff;
  font-size: 22px;
  opacity: 0.85;
}

/* ================================================================
   ALL OTHER INNER PAGES (about, experience, certifications, education)
   ================================================================ */

/* ================================================================
   HOVER PREVIEW TOOLTIP
   ================================================================ */

#preview-tip {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid #999;
  padding: 0;
  max-width: 190px;
  font-family: Arial, sans-serif;
  font-size: 12px;
  color: #333;
  pointer-events: none;
  display: none;
  box-shadow: none;
}
#preview-tip img {
  display: block;
  width: 190px;
  height: 120px;
  object-fit: cover;
  border-bottom: 1px solid #ccc;
}
#preview-tip .tip-body {
  padding: 5px 7px 6px;
}
#preview-tip .tip-title {
  font-weight: bold;
  font-size: 12px;
  color: #591c9a;
  margin-bottom: 2px;
}
#preview-tip .tip-desc {
  color: #666;
  font-size: 11px;
  line-height: 1.35;
}

/* ── Inner pages ──────────────────────────────────── */

#proj-topbar {
  padding: 6px 0 5px;
  font-size: 12px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
#proj-page-nav {
  margin-left: auto;
  font-size: 12px;
  white-space: nowrap;
}
#proj-page-nav a { color: #0e0be1; }
#proj-page-nav a:hover { text-decoration: underline; }
#proj-page-nav .sep { color: #999; margin: 0 5px; }
#proj-topbar #logo-small {
  font-family: 'Times New Roman', Times, serif;
  font-size: 18px;
  color: #591c9a;
  text-decoration: none;
}
#proj-topbar #logo-small:hover { text-decoration: underline; }
#proj-topbar .sep { margin: 0 6px; color: #999; }
#proj-topbar .back { color: #0e0be1; }

#proj-body { padding: 10px 4px 0; max-width: 720px; flex: 1 0 auto; }

.proj-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.org-logo { height: 36px; width: auto; flex-shrink: 0; display: block; }
.proj-title { font-size: 18px; font-weight: bold; color: #333; margin-bottom: 2px; }
.proj-tagline { font-size: 12px; color: #666; }

/* inner-page section header — reuse same bordered-box style */
.inner-section-header {
  color: #0e0be1;
  font-size: 13px;
  font-weight: bold;
  text-align: center;
  border-top: 1px solid #999;
  border-bottom: 1px solid #999;
  padding: 2px 6px;
  margin: 10px 0 6px;
  background: #ebebeb;
}

.exp-row { overflow: hidden; cursor: pointer; }
.exp-row:hover { background: #e8e8e8; }
.exp-row:hover .inner-section-header { background: #d8d8d8; }
.inner-section-header:has(.exp-logo) { display: flex; align-items: center; gap: 8px; padding: 2px 8px; }
.inner-section-header:has(.exp-logo) a { flex: 1; }
.exp-logo { height: 22px; width: auto; flex-shrink: 0; object-fit: contain; }

.detail-body { padding: 0 2px 8px; }
.detail-body p { line-height: 1.5; margin-bottom: 6px; }
.detail-body ul { list-style: none; }
.detail-body ul li { margin: 3px 0; line-height: 1.4; }

.tech-inline { font-size: 13px; color: #444; padding: 2px 0 8px 2px; }
.tech-inline span::after { content: ' \B7 '; color: #aaa; }
.tech-inline span:last-child::after { content: ''; }

/* anchor targets — give them scroll offset */
.anchor-target { padding-top: 6px; }

/* inner page footer link */
.page-footer-link { font-size: 11px; color: #888; margin-top: 14px; border-top: 1px solid #999; padding-top: 4px; }
.page-footer-link a { color: #888; }
.page-footer-link a:hover { text-decoration: underline; }

/* ================================================================
   LOCATION MAP MODAL
   ================================================================ */
#loc-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,0.45);
  align-items: center;
  justify-content: center;
}
#loc-modal.open { display: flex; }
#loc-popup {
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 3px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
  overflow: hidden;
  width: 520px;
}
#loc-header {
  background: #ededed;
  border-bottom: 1px solid #ccc;
  padding: 7px 12px;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
}
#loc-close {
  background: none;
  border: 1px solid #999;
  cursor: pointer;
  font-size: 11px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  color: #333;
  flex-shrink: 0;
}
#loc-close:hover { background: #ddd; }
#loc-map-wrap {
  position: relative;
  height: 400px;
}
#loc-map { width: 100%; height: 100%; }
#loc-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center,
    rgba(190,225,240,0.18) 0%,
    rgba(190,225,240,0.18) 40%,
    rgba(255,255,255,0.72) 57%,
    #fff 69%
  );
}
#loc-footer {
  background: #ededed;
  border-top: 1px solid #ccc;
  text-align: center;
  font-size: 12px;
  color: #444;
  padding: 6px;
}

/* ================================================================
   MOBILE LAYOUT  (≤ 640px)
   ================================================================ */

/* Hidden on desktop */
#mobile-logo { display: none; }
#mobile-nav  { display: none; }

@media (max-width: 640px) {

  /* Full-width page */
  #page { width: 100%; min-width: 0; }

  /* ── Topbar: flex, compact ───────────────────── */
  #topbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    overflow: visible;
  }
  #mobile-logo {
    display: block;
    font-family: 'Times New Roman', Times, serif;
    font-size: 17px;
    color: #591c9a;
    text-decoration: none;
    flex-shrink: 0;
    padding-right: 8px;
    border-right: 1px solid #bbb;
    line-height: 1;
  }
  #mobile-logo:hover { text-decoration: underline; }
  .tb-location { float: none; font-size: 13px; line-height: 1; flex: 1 1 auto; }
  .tb-location svg { width: 14px; height: 14px; }
  .tb-actions { float: none; flex-shrink: 0; }
  .tb-actions a { margin-left: 8px; font-size: 9px; }
  .tb-icon { font-size: 15px; }

  /* ── Content row ─────────────────────────────── */
  #content { align-items: flex-start; }

  /* ── Left sidebar → sticky narrow nav ────────── */
  #leftbar {
    flex: 0 0 88px;
    width: 88px;
    padding: 0;
    margin: 0;
    min-height: 0;
    border-left: none;
    border-right: 1px solid #bbb;
    background: #ededed;
    position: sticky;
    top: 0;
    align-self: flex-start;
    max-height: 100vh;
    overflow-y: auto;
  }
  #logo-link, #descriptor, #search-wrap, .lbar-label, .lbar-list, .lbar-plain, #coop-label { display: none; }
  #leftbar hr { display: none; }
  #mobile-nav { display: block; padding-top: 6px; }
  .mnav-item {
    display: block;
    padding: 10px 8px 10px 4px;
    font-size: 13px;
    color: #0e0be1;
    text-align: right;
    border-bottom: 1px solid #ccc;
    text-decoration: none;
    line-height: 1.2;
  }
  .mnav-item:hover { background: #fff; text-decoration: none; }
  .mnav-item.active { background: #fff; font-weight: bold; }

  /* ── Right sidebar: hidden ───────────────────── */
  #rightbar { display: none; }

  /* ── Center: single-column ───────────────────── */
  #center { padding: 8px 8px; overflow: visible; }
  .col { float: none; width: 100%; padding-right: 0; }
  .section-body ul li { padding: 6px 2px; line-height: 1.5; }
  .section-body ul li .sub { line-height: 1.5; }

  /* ── Footer ──────────────────────────────────── */
  #footer { height: auto; line-height: 1.6; padding: 6px 10px; }

  /* ── Map modal: full-width on mobile ─────────── */
  #loc-popup { width: 94vw; }
  #loc-map-wrap { height: 300px; }

}

/* ================================================================
   TAB ISOLATION (JS sets data-mob-active; desktop never has it)
   ================================================================ */
#center[data-mob-active] .section[data-mob-tab] { display: none; }
#center[data-mob-active="projects"]  .section[data-mob-tab="projects"]  { display: block; }
#center[data-mob-active="experience"] .section[data-mob-tab="experience"] { display: block; }
#center[data-mob-active="awards"]    .section[data-mob-tab="awards"]    { display: block; }
#center[data-mob-active="education"] .section[data-mob-tab="education"] { display: block; }
#center[data-mob-active="about"]     .section[data-mob-tab="about"]     { display: block; }
#center[data-mob-active="skills"]    .section[data-mob-tab="skills"]    { display: block; }
#center[data-mob-active="certs"]     .section[data-mob-tab="certs"]     { display: block; }
