/* ===================================================================
   CodeThue.vn —  / Oliver Design System
   Warm Paper Light Mode (#f4f2ed) & Warm Obsidian Dark Mode (#121110)
   Editorial Typography (Lora serif italic + Archivo bold + Inter sans)
   Vibrant Warm Amber Accent (#e8631a) + Clean Pill UI & Accordion
   =================================================================== */

[x-cloak] {
  display: none !important;
}

:root {
  --serif: 'Lora', Georgia, serif;
  --disp: 'Archivo', system-ui, -apple-system, sans-serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;

  /* Light Theme (Warm Paper / Editorial Linen) */
  --bg: #f4f2ed;
  --surface: #ffffff;
  --card: #ffffff;
  --dark: #101010;
  --darktext: #f4f2ed;
  
  --ink: #111110;
  --text: #2b2a26;
  --muted: #6c675c;
  --dim: #9d968a;
  
  --border: #e2ddd1;
  --border2: #d2ccbc;
  
  --accent: #e8631a;
  --accent2: #f5a623;
  --accent-soft: rgba(232, 99, 26, 0.12);
  
  --shadow: 0 18px 44px -20px rgba(60, 45, 15, 0.22);
  --shadow-sm: 0 2px 6px -2px rgba(60, 45, 15, 0.08);
  --grid: rgba(17, 17, 16, 0.04);
  
  --build: #e8631a;
  --build-soft: rgba(232, 99, 26, 0.12);
  --invest: #1a9e63;
  --invest-soft: rgba(26, 158, 99, 0.12);
  --market: #2f6fed;
  --market-soft: rgba(47, 111, 237, 0.12);

  /* Compatibility aliases */
  --bg-body: var(--bg);
  --bg-surface: var(--surface);
  --bg-card: var(--card);
  --text-main: var(--ink);
  --text-muted: var(--muted);
  --border-color: var(--border);
  --accent-primary: var(--accent);
}

html.dark, [data-theme="dark"] {
  /* Dark Theme (Warm Obsidian / Carbon) */
  --bg: #121110;
  --surface: #1b1a18;
  --card: #1b1a18;
  --dark: #0a0a09;
  --darktext: #f0ede6;
  
  --ink: #f0ede6;
  --text: #e2dfd6;
  --muted: #a29b8d;
  --dim: #6c665a;
  
  --border: #2c2a26;
  --border2: #3b3831;
  
  --accent: #e8631a;
  --accent2: #f5a623;
  --accent-soft: rgba(232, 99, 26, 0.16);
  
  --shadow: 0 18px 44px -20px rgba(0, 0, 0, 0.65);
  --shadow-sm: 0 2px 6px -2px rgba(0, 0, 0, 0.4);
  --grid: rgba(240, 237, 230, 0.035);
  
  --build: #f5a623;
  --build-soft: rgba(245, 166, 35, 0.14);
  --invest: #3ecf8e;
  --invest-soft: rgba(62, 207, 142, 0.14);
  --market: #6ea8fe;
  --market-soft: rgba(110, 168, 254, 0.14);

  /* Compatibility aliases */
  --bg-body: var(--bg);
  --bg-surface: var(--surface);
  --bg-card: var(--card);
  --text-main: var(--ink);
  --text-muted: var(--muted);
  --border-color: var(--border);
  --accent-primary: var(--accent);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
  overflow-x: hidden;
  max-width: 100%;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  color: var(--accent);
}

/* SECTION HEADINGS & KICK ( style) */
.kick, .hello {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.kick .dash, .hello .dash {
  width: 20px;
  height: 2px;
  background: var(--accent);
  display: inline-block;
}

.sec-t {
  font-family: var(--disp);
  font-weight: 800;
  font-size: clamp(1.85rem, 3.8vw, 2.75rem);
  letter-spacing: -1.2px;
  color: var(--ink);
  line-height: 1.08;
}
.sec-t em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: -0.3px;
}

/* PILLS */
.pill {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 50px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pill.b {
  color: var(--build);
  background: var(--build-soft);
}
.pill.i {
  color: var(--invest);
  background: var(--invest-soft);
}
.pill.m {
  color: var(--market);
  background: var(--market-soft);
}

/* Prevent global a:hover from overriding button text colors */
a.abtn, a.abtn:hover,
a.ncta, a.ncta:hover,
a.btn-glow-primary, a.btn-glow-primary:hover,
a.btn-glass, a.btn-glass:hover,
a.tech-badge,
a.kitem,
button {
  text-decoration: none;
}

/* BUTTONS ( Style) */
.abtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 13.5px;
  padding: 12px 24px;
  border-radius: 50px;
  transition: all 0.15s ease;
  box-shadow: 0 10px 24px -10px rgba(20, 15, 5, 0.25);
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
}
.abtn:hover {
  transform: translateY(-2px);
}

/* Variant 1: ACCENT (Orange / Hero Action) */
.abtn.acc,
.btn-glow-primary {
  background: var(--accent) !important;
  color: #ffffff !important;
  border-color: var(--accent) !important;
  box-shadow: 0 10px 24px -10px var(--accent);
}
.abtn.acc:hover,
.btn-glow-primary:hover {
  background: #c84e0e !important;
  border-color: #c84e0e !important;
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -6px rgba(232, 99, 26, 0.45);
}

/* Variant 2: DARK / CONTRAST (Ink Pill) */
.abtn.dark {
  background: var(--ink) !important;
  color: var(--bg) !important;
  border-color: var(--ink) !important;
}
.abtn.dark:hover {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -8px rgba(232, 99, 26, 0.4);
}

/* Variant 3: LITE / OUTLINE (Soft Pill) */
.abtn.lite,
.btn-glass {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border: 1.5px solid var(--border2) !important;
}
.abtn.lite:hover,
.btn-glass:hover {
  background: var(--accent-soft) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -8px rgba(232, 99, 26, 0.25);
}

/* Default abtn without variant */
.abtn:not(.acc):not(.dark):not(.lite) {
  background: var(--ink) !important;
  color: var(--bg) !important;
}
.abtn:not(.acc):not(.dark):not(.lite):hover {
  background: var(--accent) !important;
  color: #ffffff !important;
  transform: translateY(-2px);
}

/* TOP NAV ( Style) */
nav.top, nav.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
  width: 100%;
}
.nav-in {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
@media (min-width: 640px) {
  .nav-in {
    padding: 0 24px;
    height: 66px;
    gap: 16px;
  }
}
#mobile-drawer-menu {
  width: 100%;
  max-height: calc(100vh - 62px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.15);
}
@media (min-width: 640px) {
  #mobile-drawer-menu {
    max-height: calc(100vh - 66px);
  }
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.3px;
}
.logo:hover {
  color: var(--ink);
}
.logo .o {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13.5px;
  font-weight: 900;
  flex-shrink: 0;
}
.nav-links {
  display: none;
  gap: 20px;
  align-items: center;
}
@media (min-width: 1024px) {
  .nav-links {
    display: flex;
  }
}
.nav-links a:not(.ncta) {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.15s;
  white-space: nowrap;
}
.nav-links a:not(.ncta):hover, .nav-links a.on {
  color: var(--accent);
}
.kbtn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--dim);
  border: 1px solid var(--border2);
  background: transparent;
  padding: 6px 12px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.kbtn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.tgl {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.tgl:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.ncta {
  font-family: var(--disp);
  font-size: 13px;
  font-weight: 700;
  color: var(--bg) !important;
  background: var(--ink) !important;
  border: 1px solid var(--ink) !important;
  padding: 10px 20px;
  border-radius: 50px;
  white-space: nowrap;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ncta:hover {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 20px -6px var(--accent);
}

/* CARDS (.pcard, .pro-card, .glass-card) */
.pcard, .pro-card, .glass-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s ease;
  position: relative;
}
.pcard:hover, .pro-card:hover, .glass-card:hover {
  transform: translateY(-3px);
  border-color: var(--border2);
  box-shadow: var(--shadow);
}
html.dark .pcard:hover, html.dark .pro-card:hover, html.dark .glass-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow);
}

/* ACCORDION ( Style) */
.accwrap {
  display: grid;
  gap: 12px;
}
/* ACCORDION ( Style) */
.accwrap {
  display: grid;
  gap: 12px;
}
.aitem {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
  transition: all 0.2s ease;
}
.aitem .ahead {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 18px 22px;
  cursor: pointer;
  user-select: none;
}
.aitem .num {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--dim);
}
.aitem h3 {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.4px;
  color: var(--ink);
  margin: 0;
}
.aitem .ax {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  transition: all 0.2s ease;
}

/* HIDE BODY WHEN CLOSED */
.aitem .abody {
  display: none !important;
  padding: 0 24px 22px;
}

/* OPEN ACCORDION STATE */
.aitem.open {
  background: var(--dark) !important;
  border-color: var(--dark) !important;
}
.aitem.open .num {
  color: var(--accent) !important;
}
.aitem.open h3 {
  color: var(--darktext) !important;
}
.aitem.open .ax {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #ffffff !important;
  transform: rotate(45deg);
}
.aitem.open .abody {
  display: block !important;
  color: rgba(244, 242, 237, 0.9) !important;
}
.aitem.open .abody p {
  color: rgba(244, 242, 237, 0.9) !important;
  line-height: 1.65;
  font-size: 13.5px;
}
.aitem.open .tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.aitem.open .tags span {
  font-family: var(--mono);
  font-size: 11px;
  border: 1px solid rgba(244, 242, 237, 0.3) !important;
  border-radius: 50px;
  padding: 3px 12px;
  color: rgba(244, 242, 237, 0.9) !important;
  white-space: nowrap;
}

/* COMMAND PALETTE (⌘K MODAL) */
.kwrap {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none !important;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.kwrap.open {
  display: flex !important;
}
.kbox {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 18px;
  box-shadow: 0 40px 90px -20px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: kpop 0.22s cubic-bezier(0.2, 0.7, 0.3, 1);
}
@keyframes kpop {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to { opacity: 1; transform: none; }
}
.kbox .ks {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.kbox .ks svg {
  width: 16px;
  height: 16px;
  stroke: var(--dim);
  fill: none;
  stroke-width: 2;
}
.kbox .ks input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-size: 14.5px;
  font-family: inherit;
}
.kbox .ks input::placeholder {
  color: var(--dim);
}
.kbox .kl {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  background: var(--surface);
}
.kitem {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  transition: background 0.15s;
}
.kitem:hover {
  background: var(--bg);
  color: var(--accent);
}
.kitem .kdot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--dim);
}
.kitem .kdot.b { background: var(--build); }
.kitem .kdot.i { background: var(--invest); }
.kitem .kdot.m { background: var(--market); }
.kitem .kx {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
  white-space: nowrap;
}

/* SEARCH SUB-FORM (Pill Shape) */
.sub-form {
  display: flex;
  border: 1.5px solid var(--ink);
  border-radius: 50px;
  overflow: hidden;
  background: var(--surface);
  max-width: 580px;
  width: 100%;
  margin: 0 auto;
  box-shadow: 0 4px 16px -4px rgba(40, 30, 10, 0.1);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sub-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 8px 24px -6px rgba(232, 99, 26, 0.25);
}
.sub-form input {
  flex: 1;
  font-size: 14px;
  background: transparent;
  border: none;
  color: var(--ink);
  padding: 13px 20px;
  outline: none;
  min-width: 0;
  font-family: inherit;
}
.sub-form input::placeholder {
  color: var(--dim);
}
.sub-form button {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 13px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  padding: 13px 24px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sub-form button:hover {
  background: var(--accent);
  color: #ffffff;
}

/* FLOATING PILL (Hero Decorative) */
.fpill {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 50px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 20px -8px rgba(40, 30, 10, 0.2);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* TECH BADGES */
.tech-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 50px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
  white-space: nowrap;
}
.tech-badge:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* TICKER BANNER ( Style) */
.ticker {
  background: var(--dark);
  color: var(--darktext);
  overflow: hidden;
  padding: 12px 0;
  position: relative;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ticker .tk {
  display: flex;
  white-space: nowrap;
  animation: ticker-mq 24s linear infinite;
  width: max-content;
}
@keyframes ticker-mq {
  to { transform: translateX(-50%); }
}
.ticker span {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 13.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
.ticker span i {
  font-style: normal;
  color: var(--accent);
}

/* FOOTER ( Style) */
footer.foot-o {
  border-top: 1px solid var(--border);
  padding: 40px 0 32px;
  margin-top: 60px;
  background: var(--surface);
  transition: background 0.2s, border-color 0.2s;
}
.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.foot .fm {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
}
.foot .fr {
  display: flex;
  gap: 20px;
  font-family: var(--mono);
  font-size: 12px;
  flex-wrap: wrap;
}
.foot .fr a {
  color: var(--muted);
  transition: color 0.15s;
}
.foot .fr a:hover {
  color: var(--accent);
}

/* PULSE GREEN */
.pulse-green {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 2s infinite;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ACCESSIBILITY FOCUS */
:focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px !important;
}

button, a, input, select, textarea {
  -webkit-tap-highlight-color: transparent;
}

/* SCROLLBAR */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--dim);
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
