/* ==========================================================================
   Hector Tan — Personal Website
   Shared stylesheet
   Palette derived from the brand logo (navy / blue / orange accent).
   ========================================================================== */

:root {
  --navy-900: #0a1f3c;
  --navy-800: #0d2b52;
  --navy-700: #123a6b;
  --blue-600: #1a6dff;
  --blue-500: #2f7bf5;
  --blue-300: #7db4ff;
  --orange:   #f5a623;
  --orange-600: #ef8c1a;

  --ink:      #16202e;
  --muted:    #5b6b80;
  --line:     #e2e8f2;
  --surface:  #ffffff;
  --surface-2:#f5f7fb;
  --surface-3:#eef2f9;

  --header-h: 132px;
  --maxw:     1120px;
  --radius:   14px;
  --shadow:   0 10px 30px rgba(10, 31, 60, 0.08);
  --shadow-sm:0 2px 10px rgba(10, 31, 60, 0.06);

  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface-2);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--navy-800); }

img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Header  (logo sits on a WHITE band → the logo's own white background blends
   in, so there is never any visible white-box contrast. The logo file itself
   is never altered.)
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.brand-row {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 24px 6px;
}

.brand-row a { display: inline-block; line-height: 0; }

.brand-logo {
  height: 74px;         /* proportional scale only — aspect ratio preserved */
  width: auto;
}

/* Nav bar: three regions — left / center / right */
.main-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4px 24px 14px;
}

.nav-left  { justify-self: start; }
.nav-center{ justify-self: center; display: flex; gap: 6px; }
.nav-right { justify-self: end; }

.nav-link {
  position: relative;
  display: inline-block;
  padding: 8px 14px;
  color: var(--navy-800);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .3px;
  border-radius: 8px;
  transition: color .18s ease, background .18s ease;
}
.nav-link:hover { color: var(--blue-600); background: var(--surface-3); }

.nav-link.active { color: var(--blue-600); }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 2px;
  height: 2px;
  background: var(--orange);
  border-radius: 2px;
}

/* Search button */
.search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 50%;
  cursor: pointer;
  color: var(--navy-800);
  transition: all .18s ease;
}
.search-btn:hover {
  border-color: var(--blue-500);
  color: var(--blue-600);
  box-shadow: 0 0 0 4px rgba(47,123,245,.12);
}
.search-btn svg { width: 20px; height: 20px; }

/* Mobile menu toggle (hidden on desktop) */
.menu-toggle { display: none; }

/* ==========================================================================
   Search overlay
   ========================================================================== */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 31, 60, .55);
  backdrop-filter: blur(3px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.search-overlay.open { display: flex; }

.search-panel {
  width: min(640px, 92vw);
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

.search-panel input {
  width: 100%;
  border: 0;
  padding: 20px 22px;
  font-size: 18px;
  font-family: var(--font);
  outline: none;
  border-bottom: 1px solid var(--line);
}
.search-results { max-height: 46vh; overflow-y: auto; }
.search-results a {
  display: block;
  padding: 14px 22px;
  color: var(--navy-800);
  border-bottom: 1px solid var(--surface-2);
}
.search-results a:hover { background: var(--surface-2); }
.search-results .r-title { font-weight: 700; }
.search-results .r-desc { font-size: 13px; color: var(--muted); }
.search-results .empty { padding: 22px; color: var(--muted); }

/* ==========================================================================
   Hero + sections
   ========================================================================== */
.hero {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 55%, var(--blue-600) 130%);
  color: #fff;
  padding: 76px 0 84px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -80px; top: -80px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(245,166,35,.9), rgba(245,166,35,0) 70%);
  opacity: .5;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin: 0 0 14px;
  line-height: 1.1;
  letter-spacing: -.5px;
}
.hero p { font-size: 1.15rem; max-width: 620px; color: #d8e4f7; margin: 0 0 28px; }

.eyebrow {
  display: inline-block;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--orange);
  font-weight: 700;
  margin-bottom: 14px;
}

.btn {
  display: inline-block;
  padding: 13px 26px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-primary { background: var(--orange); color: var(--navy-900); }
.btn-primary:hover { color: var(--navy-900); transform: translateY(-2px); box-shadow: 0 10px 22px rgba(245,166,35,.35); }
.btn-ghost { border-color: rgba(255,255,255,.5); color: #fff; margin-left: 10px; }
.btn-ghost:hover { color: #fff; border-color: #fff; }

.page-head {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff;
  padding: 56px 0;
}
.page-head .eyebrow { margin-bottom: 8px; }
.page-head h1 { margin: 0 0 8px; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.page-head p { color: #cfdcf0; margin: 0; max-width: 640px; }

.section { padding: 64px 0; }
.section.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.section h2 { font-size: 1.7rem; color: var(--navy-900); margin: 0 0 8px; }
.section .lead { color: var(--muted); max-width: 680px; }

/* Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
  margin-top: 32px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card .tag {
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--blue-600); margin-bottom: 10px;
}
.card h3 { margin: 0 0 8px; color: var(--navy-900); font-size: 1.2rem; }
.card p { margin: 0 0 14px; color: var(--muted); }
.card a.more { font-weight: 700; }

/* Musings — filters + blog feed */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 30px 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.filter-group h4 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy-800);
  padding: 7px 15px;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.chip:hover { border-color: var(--blue-500); color: var(--blue-600); }
.chip.active { color: #fff; }
.chip.active.cat { background: var(--blue-600); border-color: var(--blue-600); }
.chip.active.sec { background: var(--orange-600); border-color: var(--orange-600); }
.chip.active:not(.cat):not(.sec) { background: var(--navy-800); border-color: var(--navy-800); }

.results-count { margin: 22px 0 0; font-size: 14px; color: var(--muted); }

.feed { margin-top: 10px; }
.post { padding: 28px 0; border-bottom: 1px solid var(--line); }
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}
.badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
}
.badge.cat { background: rgba(26, 109, 255, .12); color: var(--blue-600); }
.badge.sec { background: rgba(245, 166, 35, .18); color: var(--orange-600); }
.post h2 { margin: 0 0 8px; font-size: 1.5rem; color: var(--navy-900); }
.post h2 a { color: var(--navy-900); }
.post h2 a:hover { color: var(--blue-600); }
.post p { margin: 0 0 12px; color: #3a4a5e; max-width: 720px; }
.post .readmore { font-weight: 700; }
.feed-empty { padding: 46px 0; color: var(--muted); font-size: 15px; }

/* Load more */
.load-more-wrap { display: flex; justify-content: center; margin-top: 30px; }
.load-more {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-800);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 26px;
  cursor: pointer;
  transition: all .15s ease;
}
.load-more:hover {
  border-color: var(--blue-500);
  color: var(--blue-600);
  box-shadow: var(--shadow-sm);
}
.load-more .lm-count { color: var(--muted); font-weight: 600; }

/* Search box */
.search-field {
  position: relative;
  max-width: 480px;
  margin-bottom: 26px;
}
.search-field svg {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.search-field input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 15px;
  background: #fff;
}
.search-field input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 4px rgba(47, 123, 245, .12);
}

/* Chip counts */
.chip-count {
  display: inline-block;
  margin-left: 4px;
  font-size: 12px;
  font-weight: 700;
  opacity: .6;
}
.chip.active .chip-count { opacity: .85; }
.chip.is-zero { opacity: .45; }

/* Post meta on the dark article header */
.post-meta.on-dark { color: #cfdcf0; margin: 10px 0 14px; }
.back-link { display: inline-block; color: var(--blue-300); font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.back-link:hover { color: #fff; }

/* Article body */
.article { font-size: 1.075rem; }
.article h2 { margin-top: 36px; }
.article blockquote {
  margin: 28px 0;
  padding: 6px 22px;
  border-left: 4px solid var(--orange);
  color: var(--navy-800);
  font-size: 1.2rem;
  font-style: italic;
}
.article ul { padding-left: 22px; }
.article li { margin: 6px 0; }

/* Prev / next navigation */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.post-nav-link {
  display: flex;
  flex-direction: column;
  max-width: 46%;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.post-nav-link.next { text-align: right; margin-left: auto; }
.post-nav-link:hover { border-color: var(--blue-500); box-shadow: var(--shadow-sm); }
.post-nav-dir { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.post-nav-title { color: var(--navy-900); font-weight: 700; margin-top: 3px; }

/* Prose (legal / long text pages) */
.prose { max-width: 760px; }
.prose h2 { margin-top: 34px; color: var(--navy-900); }
.prose h3 { color: var(--navy-800); }
.prose p, .prose li { color: #2c3a4c; }
.prose ul { padding-left: 20px; }
.updated { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: start; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--navy-800); font-size: 14px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; font-family: var(--font); font-size: 15px; background: #fff;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(47,123,245,.12); }
.contact-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-sm); }
.contact-card .email { font-size: 1.15rem; font-weight: 700; color: var(--blue-600); }

.form-status { margin: 14px 0 0; min-height: 20px; font-weight: 600; font-size: 14px; }
.form-status.success { color: #157347; }
.form-status.error { color: #c0392b; }

/* Honeypot spam trap — visually hidden, off-screen, out of tab order. */
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.timeline { list-style: none; padding: 0; margin: 30px 0 0; }
.timeline li { position: relative; padding: 0 0 26px 28px; border-left: 2px solid var(--line); }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px #fff;
}
.timeline .yr { font-weight: 700; color: var(--blue-600); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--navy-900);
  color: #cdd9ec;
  padding: 30px 0;
  margin-top: 40px;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a { color: #cdd9ec; font-size: 14px; }
.footer-links a:hover { color: #fff; }
.footer-copy { font-size: 14px; color: #9fb2cd; }
.footer-copy strong { color: #fff; font-weight: 700; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 760px) {
  .brand-logo { height: 56px; }
  .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px;
    background: #fff; cursor: pointer; color: var(--navy-800);
  }
  .main-nav { grid-template-columns: auto 1fr auto; }
  .nav-left { justify-self: start; order: 1; }
  .nav-right { order: 3; }
  .nav-center {
    order: 4;
    grid-column: 1 / -1;
    justify-self: stretch;
    flex-direction: column;
    display: none;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    margin-top: 6px;
  }
  .nav-center.open { display: flex; }
  .nav-link { text-align: center; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
}
