/* =============================================================================
   Portfolio + layout styles

   Visual source: docs/design-preview.html (final); legacy: portfolio-design-preview.html, new-design-preview.html

   Structure:
     1. Design tokens (:root) — colors, spacing, typography; change sizes here
     2. Global reset
     3. Sections (HTML from sections/*.py) — nav, hero, skills, experience, contact, footer
     4. Chat chrome (static HTML in §11; Gradio log/input in chat_overrides.css)
     5. Responsive — portfolio content breakpoints
     6. Gradio shell — app grid, sticky chat column, hide default footer

   Served at /static/css/portfolio.css (static FastAPI site).
   ============================================================================= */

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=Sora:wght@500;600;700&display=swap");


/* =============================================================================
   1. DESIGN TOKENS
   All shared custom properties. Components below should prefer these over literals.
   ============================================================================= */

:root {
  /* --- Color palette --- */
  --bg-base: #030810;
  --bg-card: rgba(12, 24, 48, 0.72);
  --bg-card-solid: #0e1a34;
  --text-primary: #f4f7fc;
  --text-body: #d2dced;
  --text-muted: #9eb0d0;
  --accent-cyan: #2ee7f7;
  --accent-blue: #00c8ff;
  --accent-violet: #b794ff;
  --gradient-name: linear-gradient(90deg, #00c8ff 0%, #2ee7f7 42%, #5dffa8 100%);
  --border: rgba(255, 255, 255, 0.06); /* neutral — footer, subtle dividers */
  --border-accent: rgba(46, 231, 247, 0.2); /* cyan — cards, chat console accents */
  --border-bright: rgba(255, 255, 255, 0.08); /* nav, section edges — separation via glow */
  --border-panel: rgba(255, 255, 255, 0.08); /* hero, skills, cards, contact, chat log, chat input */
  --surface-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --surface-glass-bg: rgba(10, 18, 34, 0.72);
  --surface-glass-blur: blur(18px) saturate(1.25);
  --surface-gloss: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.04) 16%,
    transparent 38%
  );
  --surface-glow: 0 0 0 1px rgba(46, 231, 247, 0.05);
  --shadow-card: 0 4px 32px rgba(0, 0, 0, 0.36), var(--surface-glow);
  --shadow-card-hover: 0 16px 52px rgba(0, 0, 0, 0.48), 0 0 80px rgba(46, 231, 247, 0.1);
  --glow-cyan-soft: 0 0 56px rgba(46, 231, 247, 0.12);
  --glow-violet-soft: 0 0 64px rgba(183, 148, 255, 0.1);
  --bg-radial-top: radial-gradient(ellipse 120% 75% at 15% -8%, rgba(0, 200, 255, 0.14) 0%, transparent 58%);
  --bg-radial-mid: radial-gradient(ellipse 100% 60% at 88% 18%, rgba(183, 148, 255, 0.11) 0%, transparent 54%);
  --bg-radial-bottom: radial-gradient(ellipse 85% 50% at 50% 105%, rgba(46, 231, 247, 0.07) 0%, transparent 48%);
  --bg-depth: linear-gradient(175deg, #0a1628 0%, #050b16 42%, #02060e 100%);

  /* --- Layout & spacing --- */
  --col-pad-x: 28px; /* horizontal inset for portfolio + chat column content */
  --nav-height: 68px; /* fixed nav bar; used for sticky top offset and scroll-margin */

  /* --- Typography (single source of truth) --- */
  --font-size-section: 1.4rem; /* h2.section, .chat-header h2 (Work Experience, Quang's Assistant) */
  --font-size-card-title: 17px; /* project card h3 */
  --font-size-card-text: 14px; /* employer, description, Get In Touch body copy */
  --font-size-pill: 12px; /* hero .pill, project .tag, chat .chip */
  --font-size-footer: 12px;
  --color-input-placeholder: var(--text-primary); /* chat placeholder + site footer — bright off-white */
  --font-size-chat: 15px; /* chat log user + assistant messages (matches .intro) */
  --line-height-chat: 1.65;
  /* Pair A — inverted chat roles: warm short user questions, bright bot answers */
  --color-chat-user: #e8c97a; /* dusty gold */
  --color-chat-assistant: #ffffff; /* white — readable for long assistant replies */
  --chat-message-max-width: 48ch; /* assistant readability in flat layout */
}


/* =============================================================================
   2. GLOBAL / RESET
   ============================================================================= */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "DM Sans", system-ui, sans-serif;
  background-color: var(--bg-base);
  background-image: var(--bg-radial-top), var(--bg-radial-mid), var(--bg-radial-bottom), var(--bg-depth);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
}


/* =============================================================================
   3. SECTION: NAV
   Source: sections/nav.py
   Gradio mounts HTML in .nav-mount; bar is position:fixed (see §6 Gradio shell).
   ============================================================================= */

/* In-flow spacer so content starts below the fixed bar */
.nav-mount {
  height: var(--nav-height);
  flex-shrink: 0;
}

.nav-mount nav,
nav.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 30;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--col-pad-x);
  background: linear-gradient(
    180deg,
    rgba(10, 20, 40, 0.82) 0%,
    rgba(6, 12, 26, 0.78) 100%
  );
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border-bottom: 1px solid var(--border-bright);
  box-shadow:
    var(--surface-highlight),
    0 4px 32px rgba(0, 0, 0, 0.35),
    0 0 80px rgba(0, 200, 255, 0.05);
}

/* Component: logo mark */
.logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent-cyan) 0%, var(--accent-blue) 45%, var(--accent-violet) 100%);
  box-shadow:
    var(--surface-highlight),
    0 0 48px rgba(46, 231, 247, 0.22),
    0 4px 14px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Sora, sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--bg-base);
}

/* Component: nav links */
nav ul {
  display: flex;
  gap: 32px;
  list-style: none;
  margin-left: auto;
}

nav a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  transition: color 0.15s;
}

nav a:hover {
  color: var(--accent-cyan);
  text-shadow: 0 0 32px rgba(46, 231, 247, 0.22);
}


/* =============================================================================
   4. SECTION: PORTFOLIO COLUMN
   Wrapper around hero, skills, experience, contact (sections/portfolio.py).
   ============================================================================= */

.portfolio {
  padding: 28px var(--col-pad-x) 56px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 100%;
}


/* =============================================================================
   5. SECTION: HERO
   Source: sections/hero.py
   ============================================================================= */

/* Component: hero card */
.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  gap: 28px;
  background: var(--surface-glass-bg);
  backdrop-filter: var(--surface-glass-blur);
  -webkit-backdrop-filter: var(--surface-glass-blur);
  border: 1px solid var(--border-panel);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card), var(--surface-highlight);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background: var(--surface-gloss);
}

.hero-photo-wrap {
  flex-shrink: 0;
}

.hero-photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 72% center;
  border: 2px solid transparent;
  background:
    linear-gradient(var(--bg-card-solid), var(--bg-card-solid)) padding-box,
    linear-gradient(145deg, var(--accent-cyan), var(--accent-blue), var(--accent-violet)) border-box;
  box-shadow: 0 0 56px rgba(46, 231, 247, 0.12);
}

.hero h1 {
  font-family: Sora, sans-serif;
  font-size: 2.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  background: var(--gradient-name);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Component: role pills (Blockchain / AI) */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pill {
  font-size: var(--font-size-pill);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(46, 231, 247, 0.22) 0%, rgba(46, 231, 247, 0.1) 100%);
  color: var(--accent-cyan);
  border: 1px solid var(--border-bright);
  box-shadow: var(--surface-highlight), 0 0 32px rgba(46, 231, 247, 0.08);
}

.pill.ai {
  background: linear-gradient(180deg, rgba(183, 148, 255, 0.26) 0%, rgba(183, 148, 255, 0.12) 100%);
  color: #d4c4ff;
  border-color: rgba(183, 148, 255, 0.55);
  box-shadow: var(--surface-highlight), var(--glow-violet-soft);
}

.greeting {
  color: var(--accent-cyan);
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
  text-shadow: 0 0 40px rgba(46, 231, 247, 0.16);
}

.intro {
  color: var(--text-body);
  line-height: 1.75;
  font-size: 15px;
  max-width: 54ch;
}

.location {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.hero-actions {
  margin-top: 18px;
}

/* Component: CTA to chat (#chat anchor) */
.btn-ask {
  background: linear-gradient(135deg, #00c8ff 0%, #2ee7f7 50%, #00e8c8 100%);
  border: none;
  color: var(--bg-base);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  box-shadow:
    var(--surface-highlight),
    0 4px 24px rgba(0, 200, 255, 0.28),
    0 0 56px rgba(46, 231, 247, 0.12);
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
}

.btn-ask:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow:
    var(--surface-highlight),
    0 6px 32px rgba(0, 200, 255, 0.32),
    0 0 72px rgba(46, 231, 247, 0.18);
}

a.btn-ask {
  display: inline-block;
  text-decoration: none;
}

/* Scroll target when nav links to #chat */
#chat {
  scroll-margin-top: var(--nav-height);
}


/* =============================================================================
   6. SECTION: SKILLS
   Source: sections/experience.py (skills strip above project grid)
   ============================================================================= */

.skills {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-glass-bg);
  backdrop-filter: var(--surface-glass-blur);
  -webkit-backdrop-filter: var(--surface-glass-blur);
  border: 1px solid var(--border-panel);
  border-radius: 10px;
  margin-bottom: 32px;
  font-size: 12px;
  color: var(--text-muted);
  box-shadow: var(--shadow-card), var(--surface-highlight);
}

.skills::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background: var(--surface-gloss);
}

.skills span::after {
  content: " · ";
  color: #475569;
}

.skills span:last-child::after {
  content: "";
}


/* =============================================================================
   7. SHARED COMPONENT: Section headings
   Used in portfolio (h2.section) and chat column (.chat-header h2).
   ============================================================================= */

h2.section,
.chat-header h2 {
  font-family: Sora, sans-serif;
  font-size: var(--font-size-section);
  font-weight: 600;
  color: var(--accent-cyan);
  text-shadow: 0 0 56px rgba(46, 231, 247, 0.18);
}

h2.section {
  margin-bottom: 18px;
}


/* =============================================================================
   8. SECTION: WORK EXPERIENCE
   Source: sections/experience.py + components/project_card.py
   ============================================================================= */

.projects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 48px;
}

/* Component: project card */
.card {
  position: relative;
  overflow: hidden;
  background: var(--surface-glass-bg);
  backdrop-filter: var(--surface-glass-blur);
  -webkit-backdrop-filter: var(--surface-glass-blur);
  border: 1px solid var(--border-panel);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow-card), var(--surface-highlight);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background: var(--surface-gloss);
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-card-hover), var(--surface-highlight);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.card img {
  height: 32px;
  width: auto;
  max-width: 100px;
  object-fit: contain;
}

.card time {
  font-size: 11px;
  color: var(--text-muted);
}

.card h3 {
  font-size: var(--font-size-card-title);
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--accent-blue);
}

.card .employer {
  font-size: var(--font-size-card-text);
  color: var(--text-primary);
  margin-bottom: 10px;
  font-weight: 500;
}

/* Component: technology tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tag {
  font-size: var(--font-size-pill);
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(46, 231, 247, 0.24) 0%, rgba(46, 231, 247, 0.12) 100%);
  color: #b8f8ff;
  border: 1px solid rgba(46, 231, 247, 0.45);
  box-shadow: var(--surface-highlight);
}

.tag:nth-child(even) {
  background: linear-gradient(180deg, rgba(183, 148, 255, 0.26) 0%, rgba(183, 148, 255, 0.12) 100%);
  color: #e8dcff;
  border-color: rgba(183, 148, 255, 0.42);
}

.card p {
  font-size: var(--font-size-card-text);
  color: var(--text-muted);
  line-height: 1.55;
}


/* =============================================================================
   9. SECTION: GET IN TOUCH
   Source: sections/contact.py
   ============================================================================= */

.get-in-touch {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 36px 32px;
  background: var(--surface-glass-bg);
  backdrop-filter: var(--surface-glass-blur);
  -webkit-backdrop-filter: var(--surface-glass-blur);
  border: 1px solid var(--border-panel);
  border-radius: 16px;
  margin-bottom: 0;
  margin-top: auto;
  box-shadow: var(--shadow-card), var(--surface-highlight);
}

.get-in-touch::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background: var(--surface-gloss);
}

.get-in-touch-content {
  flex: 1;
  min-width: 0;
}

.get-in-touch .section {
  margin-bottom: 16px;
}

.get-in-touch p {
  color: var(--text-body);
  font-size: var(--font-size-card-text);
  line-height: 1.7;
  margin-bottom: 10px;
}

.get-in-touch .platforms-label {
  margin-top: 18px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Component: social icon buttons */
.contact-icons {
  display: flex;
  gap: 14px;
}

.contact-icons a {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(46, 231, 247, 0.18) 0%, rgba(46, 231, 247, 0.08) 100%);
  border: 1px solid var(--border-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--surface-highlight), var(--surface-glow);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}

.contact-icons a:hover {
  transform: scale(1.06);
  background: linear-gradient(180deg, rgba(46, 231, 247, 0.28) 0%, rgba(46, 231, 247, 0.14) 100%);
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan-soft), var(--surface-highlight);
}

.contact-icons img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.get-in-touch-visual {
  flex-shrink: 0;
  width: 72px;
}

.get-in-touch-visual img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 48px rgba(46, 231, 247, 0.2));
}


/* =============================================================================
   10. SECTION: SITE FOOTER
   Source: sections/footer.py — not Gradio's built-in footer (hidden in §6).
   ============================================================================= */

.site-footer {
  text-align: center;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: var(--font-size-footer);
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-input-placeholder);
  -webkit-text-fill-color: var(--color-input-placeholder);
  padding: 20px var(--col-pad-x) 28px;
  border-top: 1px solid var(--border);
  box-shadow: 0 -1px 0 rgba(46, 231, 247, 0.04);
}

/* =============================================================================
   11. SECTION: CHAT — static HTML chrome
   Source: sections/chat.py

   Gradio chatbot widget (log, input, message colors): chat_overrides.css
   Chat log colors use :root --color-chat-user / --color-chat-assistant (Pair A).
   ============================================================================= */

/* --- 11.1 Header --- */
.chat-header {
  flex-shrink: 0;
  padding: 28px 0 16px;
  border-bottom: 1px solid var(--border-bright);
  box-shadow: 0 1px 0 rgba(46, 231, 247, 0.04), 0 8px 48px rgba(0, 200, 255, 0.04);
}

.chat-header h2 {
  margin-bottom: 6px;
}

.chat-header-subtitle,
.chat-header p {
  font-size: 13px;
  color: var(--text-body);
}

/* --- 11.2 Suggestion chips --- */
.chips {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
}

.chip {
  font-size: var(--font-size-pill);
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(183, 148, 255, 0.24) 0%, rgba(183, 148, 255, 0.12) 100%);
  color: #e8dcff;
  border: 1px solid rgba(183, 148, 255, 0.5);
  box-shadow: var(--surface-highlight), 0 0 32px rgba(183, 148, 255, 0.08);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.chip:hover {
  border-color: rgba(183, 148, 255, 0.75);
  box-shadow: var(--surface-highlight), var(--glow-violet-soft);
  background: linear-gradient(180deg, rgba(183, 148, 255, 0.32) 0%, rgba(183, 148, 255, 0.16) 100%);
}

button.chip {
  appearance: none;
}


/* =============================================================================
   12. RESPONSIVE — portfolio content
   Breakpoints for HTML sections only; split/chat layout in §6.
   ============================================================================= */

@media (max-width: 700px) {
  .projects {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hero-actions {
    display: flex;
    justify-content: center;
  }

  .get-in-touch {
    flex-direction: column;
  }
}

@media (max-width: 1024px) {
  .portfolio {
    display: block;
    flex: none;
    min-height: 0;
  }

  .get-in-touch {
    margin-top: 0;
    margin-bottom: 32px;
  }
}


/* =============================================================================
   13. STATIC SITE LAYOUT
   Dual-column shell (no Gradio wrappers).
   ============================================================================= */

.site-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.layout-split {
  display: grid;
  grid-template-columns: minmax(0, 55fr) minmax(0, 45fr);
  align-items: stretch;
  position: relative;
  flex: 1 1 auto;
  min-height: calc(100vh - var(--nav-height));
}

.layout-split::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 55%;
  width: 1px;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
  z-index: 2;
}

@media (max-width: 1024px) {
  .layout-split {
    grid-template-columns: 1fr;
    grid-template-areas: "portfolio" "chat";
    min-height: 0;
  }

  .layout-split::after {
    display: none;
  }

  .portfolio {
    grid-area: portfolio;
  }
}
