/* =============================================================================
   BACKGROUND THEME — parallax layers, fog, particles (leave unchanged)
   ============================================================================= */
:root {
  --layer-back: #e7f7e4;
  --layer-front: #e9ecff;
  --background-brightness: 100;
  --fog: #ffffff;
  --fog-strength: 50;
  --particle: #ffffff;
}

.rain {
  --layer-back: #e7f7e4;
  --layer-front: #e9ecff;
  --background-brightness: 75;
  --fog: #b4d0db;
  --fog-strength: 200;
  --particle: #ffffff;
}

.snow {
  --layer-back: #e7f7e4;
  --layer-front: #e9ecff;
  --background-brightness: 50;
  --fog: #cccccc;
  --fog-strength: 200;
  --particle: #ffffff;
}

.dark {
  --layer-back: #ff75dd;
  --layer-front: #ffda00;
  --background-brightness: 30;
  --fog: #4a2364;
  --fog-strength: 100;
  --particle: #5b7c77;
}

.dark.rain {
  --layer-back: #ff75dd;
  --layer-front: #ffda00;
  --background-brightness: 25;
  --fog: #31243a;
  --fog-strength: 200;
  --particle: #7e9b96;
}

.dark.snow {
  --layer-back: #ff75dd;
  --layer-front: #ffda00;
  --background-brightness: 20;
  --fog: #64586d;
  --fog-strength: 200;
  --particle: #7e9b96;
}

#particle-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 200%;
  height: 200%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.image-container img {
  position: fixed;
  display: block;
}

.overlay {
  position: fixed;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

#backimg1 { bottom: -100%; right: 0; z-index: -3; height: 50%; filter: grayscale(1) sepia(1) hue-rotate(201deg); }
#overlay1 { z-index: -2; }

#backimg2 { bottom: -75%; left: 0; z-index: -5; height: 55%; filter: grayscale(1) sepia(1) hue-rotate(201deg); }
#overlay2 { z-index: -4; }

#backimg3 { bottom: -45%; right: 0; z-index: -7; height: 40%; filter: grayscale(1) sepia(1) hue-rotate(201deg); }
#overlay3 { z-index: -6; }

#backimg4 { bottom: -25%; left: 0; width: 100%; min-width: 1500px; z-index: -9; filter: grayscale(1) sepia(1) hue-rotate(201deg); }
#overlay4 { z-index: -8; }

#backimg5 { bottom: 5%; left: 0; width: 100%; min-width: 1500px; z-index: -11; filter: grayscale(1) sepia(1) hue-rotate(201deg); }
#overlay5 { z-index: -10; }

/* =============================================================================
   FOREGROUND — glassmorphic portfolio (blue-green-white / purple-pink-black)
   ============================================================================= */
:root {
  --fg: #0c2e32;
  --fg-muted: #3d5c60;
  --fg-subtle: #5a7a7e;
  --accent: #0a6b72;
  --accent-soft: #5b9ea3;
  --highlight: #274521;

  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-shadow: 0 8px 32px rgba(10, 60, 70, 0.08), 0 2px 8px rgba(10, 60, 70, 0.04);
  --glass-blur: blur(18px) saturate(160%);

  --btn-primary-bg: rgba(10, 107, 114, 0.85);
  --btn-primary-fg: #ffffff;
  --tag-bg: rgba(224, 250, 255, 0.7);
  --tag-fg: #004556;
}

.dark {
  --fg: #eef0f8;
  --fg-muted: #b8bdd4;
  --fg-subtle: #8b92ad;
  --accent: #ff75dd;
  --accent-soft: #e8a0d8;
  --highlight: #ffda00;

  --glass-bg: rgba(12, 8, 28, 0.55);
  --glass-bg-strong: rgba(18, 12, 38, 0.72);
  --glass-border: rgba(255, 117, 221, 0.22);
  --glass-shadow: 0 8px 40px rgba(0, 0, 0, 0.35), 0 0 1px rgba(255, 117, 221, 0.15);
  --glass-blur: blur(20px) saturate(140%);

  --btn-primary-bg: rgba(255, 117, 221, 0.75);
  --btn-primary-fg: #120818;
  --tag-bg: rgba(74, 35, 100, 0.5);
  --tag-fg: #f0d4f8;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: transparent;
  color: var(--fg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  text-wrap: balance;
  font-weight: 600;
  letter-spacing: -0.02em;
}

p {
  text-wrap: pretty;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Glass utility */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, transform 0.25s ease;
}

/* Layout */
.portfolio {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.section {
  padding: 5rem 0;
}

.section-header {
  margin-bottom: 2.5rem;
}

.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.section-header h2 {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 400;
  color: var(--fg);
}

/* Top bar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.65rem max(1rem, calc((100vw - 1100px) / 2));
  border-top: 0;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  color: var(--fg);
}

.brand:hover {
  color: var(--accent);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.topnav a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg-muted);
  padding: 0.4rem 0.75rem;
  border-radius: 0.45rem;
  transition: color 0.2s ease, background 0.2s ease;
}

.topnav a:hover,
.topnav a.active {
  color: var(--fg);
  background: var(--glass-bg-strong);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
  color: var(--fg);
  background: var(--glass-bg-strong);
}

.mode-toggle {
  background: transparent;
}

.sun-icon {
  display: none;
}

.moon-icon {
  display: block;
}

.dark .sun-icon {
  display: block;
}

.dark .moon-icon {
  display: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border-color: transparent;
}

.btn-ghost {
  background: var(--glass-bg);
  color: var(--fg);
  border-color: var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Hero */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 6.5rem;
}

.hero .container {
  display: grid;
  grid-template-columns: minmax(0, 640px);
  justify-content: center;
  gap: 1rem;
  align-items: start;
}

.hero-content {
  padding: 2.5rem;
  border-radius: 1.5rem;
  max-width: 640px;
  width: 100%;
}

.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero-title {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2.75rem, 6vw, 4rem);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
}

.hero-lead {
  font-size: 1.1rem;
  color: var(--fg);
  margin-bottom: 1rem;
}

.hero-body {
  font-size: 0.95rem;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}

.intro-copy {
  margin-bottom: 1.75rem;
}

.intro-expanded {
  display: grid;
  gap: 0.85rem;
  color: var(--fg-muted);
  font-size: 0.95rem;
  margin: 0.25rem 0 1rem;
}

.intro-expanded[hidden] {
  display: none;
}

.intro-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.intro-toggle svg {
  transition: transform 0.2s ease;
}

.intro-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.weather-card {
  width: min(100%, 640px);
  padding: 0.8rem;
  border-radius: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.weather-label {
  color: var(--fg-muted);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0;
  text-align: center;
}

.weather-adventurer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.adventurer-crop {
  max-height: 210px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.adventurer-crop a {
  display: flex;
  align-items: center;
  justify-content: center;
}

.adventurer-crop img {
  max-height: 315px;
  transform: translateY(0);
}

.weather-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.weather-btn {
  min-width: 4.4rem;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  background: var(--glass-bg);
  color: var(--fg-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.weather-btn:hover {
  color: var(--fg);
  transform: translateY(-1px);
}

.weather-btn[aria-pressed="true"] {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border-color: transparent;
}

.hero-stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat {
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  min-width: 160px;
  text-align: right;
}

.stat-value {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--fg);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.project-card {
  display: block;
  padding: 1.5rem;
  border-radius: 1.25rem;
  color: var(--fg);
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-soft);
}

.project-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  color: var(--fg);
}

.project-card p {
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin-bottom: 1rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tags span {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--tag-fg);
  border: 1px solid var(--glass-border);
}

/* Articles */
.article-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.article-card {
  padding: 1.35rem;
  border-radius: 1.15rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  opacity: 1;
  transition: max-height 0.65s ease, padding 0.65s ease, opacity 0.5s ease, transform 0.65s ease;
}

.article-card.article-hidden {
  display: none;
}

.article-card.article-revealing {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  transform: translateY(-0.75rem);
}

.article-card.article-revealing.article-visible {
  max-height: 24rem;
  padding-top: 1.35rem;
  padding-bottom: 1.35rem;
  opacity: 1;
  transform: translateY(0);
}

.article-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  color: var(--fg);
}

.article-card h3 a {
  color: inherit;
}

.article-card h3 a:hover {
  color: var(--accent);
}

.article-card p {
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.65rem;
}

.article-meta time {
  color: var(--fg-subtle);
}

.article-separator {
  display: grid;
  grid-template-columns: minmax(2rem, 1fr) auto minmax(2rem, 1fr);
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  transition: transform 0.65s ease, opacity 0.35s ease;
}

.article-separator span {
  height: 1px;
  background: var(--glass-border);
}

.article-separator[hidden] {
  display: none;
}

.article-separator.is-exiting {
  opacity: 0;
  transform: translateY(0.5rem);
}

.see-more[hidden] {
  display: none;
}

/* Experience */
.experience-card {
  padding: 2rem;
  border-radius: 1.5rem;
  margin-bottom: 10px;
}

.experience-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.experience-meta h3 {
  font-size: 1.25rem;
}

.company {
  color: var(--accent);
  font-weight: 500;
  font-size: 0.95rem;
  margin-top: 0.15rem;
}

.experience-meta time {
  font-size: 0.85rem;
  color: var(--fg-muted);
  white-space: nowrap;
}

.experience-intro {
  color: var(--fg-muted);
  margin-bottom: 1rem;
}

.experience-card ul {
  padding-left: 1.25rem;
  color: var(--fg-muted);
  font-size: 0.92rem;
}

.experience-card li {
  margin-bottom: 0.5rem;
}

.experience-card li::marker {
  color: var(--accent);
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.skill-card {
  padding: 1.35rem;
  border-radius: 1.15rem;
}

.skill-card:hover {
  transform: translateY(-3px);
}

.skill-card h3 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  color: var(--fg);
}

.skill-card p {
  font-size: 0.88rem;
  color: var(--fg-muted);
}

/* Education */
.education-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 1rem;
}

.edu-card {
  padding: 1.5rem;
  border-radius: 1.25rem;
}

.edu-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.edu-meta h3 {
  font-size: 1.05rem;
}

.edu-meta time {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.edu-school {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.edu-detail {
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.edu-card h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.edu-card p {
  font-size: 0.9rem;
  color: var(--fg-muted);
}

/* Footer */
.site-footer {
  width: 100%;
  margin: auto 0 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0;
  padding: 1.35rem 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-links a:hover {
  color: var(--accent);
}

/* Huggy chat assistant */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.huggy-widget {
  --huggy-bottom: 0.35rem;
  --huggy-height: clamp(7.5rem, 13vw, 10.25rem);
  --huggy-width: calc(var(--huggy-height) * 0.96);
  --huggy-size: var(--huggy-height);
  --huggy-chat-width: min(25rem, calc(100vw - 2rem));
  position: fixed;
  right: max(0.65rem, env(safe-area-inset-right));
  bottom: calc(var(--huggy-bottom) + env(safe-area-inset-bottom));
  z-index: 120;
  width: var(--huggy-width);
  pointer-events: none;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.35s ease, bottom 0.25s ease;
}

.huggy-widget.huggy-visible {
  transform: translateY(0);
  opacity: 1;
}

.huggy-avatar {
  position: relative;
  z-index: 2;
  display: block;
  width: var(--huggy-width);
  height: var(--huggy-height);
  padding: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
  overflow: visible;
  pointer-events: auto;
  transform-origin: bottom center;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.huggy-avatar:hover {
  transform: translateY(-0.25rem) scale(1.02);
  filter: drop-shadow(0 0.65rem 1.2rem rgba(0, 190, 220, 0.2));
}

.huggy-avatar:focus-visible,
.huggy-icon-button:focus-visible,
.huggy-send:focus-visible,
.huggy-form textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.huggy-avatar img {
  display: block;
  width: auto;
  height: 100%;
  max-width: none;
  margin-left: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 0.8rem 1.2rem rgba(0, 0, 0, 0.18));
}

.huggy-status {
  position: absolute;
  left: 2.5rem;
  bottom: 0.35rem;
  z-index: 4;
  display: block;
  width: 0.92rem;
  height: 0.92rem;
  border-radius: 50%;
  background: var(--huggy-status-color, #8b98a5);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow:
    0 0 0 0.16rem var(--huggy-status-ring, rgba(139, 152, 165, 0.2)),
    0 0 0.75rem var(--huggy-status-glow, rgba(139, 152, 165, 0.8)),
    0 0.2rem 0.5rem rgba(0, 0, 0, 0.22);
}

.huggy-status[data-huggy-status="waking"] {
  --huggy-status-color: #28a8ff;
  --huggy-status-ring: rgba(40, 168, 255, 0.22);
  --huggy-status-glow: rgba(40, 168, 255, 0.82);
}

.huggy-status[data-huggy-status="ready"] {
  --huggy-status-color: #22c55e;
  --huggy-status-ring: rgba(34, 197, 94, 0.22);
  --huggy-status-glow: rgba(34, 197, 94, 0.82);
}

.huggy-status[data-huggy-status="limited"] {
  --huggy-status-color: #f59e0b;
  --huggy-status-ring: rgba(245, 158, 11, 0.24);
  --huggy-status-glow: rgba(245, 158, 11, 0.82);
}

.huggy-status[data-huggy-status="daily"] {
  --huggy-status-color: #ef4444;
  --huggy-status-ring: rgba(239, 68, 68, 0.24);
  --huggy-status-glow: rgba(239, 68, 68, 0.82);
}

.huggy-status[data-huggy-status="offline"] {
  --huggy-status-color: #8b98a5;
  --huggy-status-ring: rgba(139, 152, 165, 0.22);
  --huggy-status-glow: rgba(139, 152, 165, 0.75);
}

.huggy-chat {
  position: absolute;
  right: calc(var(--huggy-size) * 0.22);
  bottom: calc(var(--huggy-size) * 0.9);
  z-index: 1;
  width: var(--huggy-chat-width);
  max-height: min(34rem, calc(100vh - 7rem));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(0.75rem) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.huggy-widget.chat-open .huggy-chat {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.huggy-widget.chat-open .huggy-avatar {
  pointer-events: none;
}

.huggy-widget.chat-open .huggy-avatar img,
.huggy-widget.chat-open .huggy-status {
  pointer-events: none;
}

.huggy-widget.avatar-priority .huggy-avatar,
.huggy-widget.avatar-priority .huggy-avatar img,
.huggy-widget.avatar-priority .huggy-status {
  pointer-events: auto;
}

.huggy-widget.send-priority .huggy-avatar {
  transform: none;
  filter: none;
}

.huggy-widget.send-priority .huggy-avatar img,
.huggy-widget.send-priority .huggy-status {
  pointer-events: none;
}

.huggy-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.9rem 1rem 0.65rem;
  border-bottom: 1px solid var(--glass-border);
}

.huggy-kicker {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.huggy-chat-header h2 {
  margin-top: 0.1rem;
  font-size: 1rem;
  letter-spacing: 0;
  color: var(--fg);
}

.huggy-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  color: var(--fg);
  cursor: pointer;
}

.huggy-icon-button span {
  font-size: 1.35rem;
  line-height: 1;
}

.huggy-messages {
  min-height: 12rem;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.huggy-message {
  max-width: 86%;
  padding: 0.62rem 0.75rem;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.huggy-message p {
  margin: 0;
}

.huggy-message p + p,
.huggy-message p + ul,
.huggy-message ul + p {
  margin-top: 0.55rem;
}

.huggy-message ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.huggy-message li + li {
  margin-top: 0.35rem;
}

.huggy-message.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid var(--glass-border);
  color: var(--fg);
}

.huggy-message.user {
  align-self: flex-end;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
}

.dark .huggy-message.assistant {
  background: rgba(18, 12, 38, 0.66);
}

.huggy-form {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  padding: 0.75rem;
  border-top: 1px solid var(--glass-border);
}

.huggy-form textarea {
  width: 100%;
  max-height: 8rem;
  resize: none;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0.68rem 0.75rem;
  background: rgba(255, 255, 255, 0.5);
  color: var(--fg);
  font: inherit;
  line-height: 1.35;
}

.dark .huggy-form textarea {
  background: rgba(0, 0, 0, 0.18);
}

.huggy-form textarea:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.huggy-send {
  position: relative;
  z-index: 4;
  min-width: 4.6rem;
  border: 0;
  border-radius: 8px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.huggy-send:hover,
.huggy-send.proxy-hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.huggy-send:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* Responsive */
@media (max-width: 900px) {
  .hero-stats {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .stat {
    flex: 1;
    min-width: 140px;
    text-align: left;
  }

  .education-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  html {
    scroll-padding-top: 1rem;
    scroll-padding-bottom: 6rem;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .topbar {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.55rem 0.9rem calc(0.55rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--glass-border);
    border-bottom: 0;
  }

  .topbar .brand {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
  }

  .topnav,
  .topbar-actions .icon-btn:not(.mode-toggle),
  .topbar-actions .btn-ghost {
    display: none;
  }

  .topbar-actions {
    grid-column: 3;
    grid-row: 1;
    justify-content: flex-end;
    align-self: center;
  }

  .mode-toggle {
    display: flex;
  }

  .nav-toggle {
    display: flex;
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    align-self: center;
    margin: 0;
    width: 2.4rem;
    height: 2.4rem;
    align-items: center;
    justify-content: center;
  }

  .topbar.nav-open .topnav {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: auto;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    padding: 0.75rem;
    box-shadow: var(--glass-shadow);
  }

  .topbar.nav-open .topnav a {
    width: 100%;
    text-align: center;
  }

  .huggy-widget {
    --huggy-bottom: 4.05rem;
    --huggy-height: clamp(6.1rem, 28vw, 8.1rem);
    right: 0.35rem;
  }

  .huggy-widget.chat-open {
    left: 0;
    right: 0;
    width: 100vw;
  }

  .huggy-widget.chat-open .huggy-avatar {
    margin-left: auto;
    margin-right: 0.35rem;
  }

  .topbar.nav-open ~ .huggy-widget,
  body:has(.topbar.nav-open) .huggy-widget {
    --huggy-bottom: 20rem;
  }

  .huggy-chat {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(var(--huggy-size) * 0.88);
    width: 100vw;
    height: calc(100vh - var(--huggy-bottom) - var(--huggy-size) * 0.88 - env(safe-area-inset-bottom));
    max-height: none;
    border-left: 0;
    border-right: 0;
    border-radius: 8px 8px 0 0;
  }

  .huggy-widget.chat-open .huggy-chat {
    transform: translateY(0);
  }

  .huggy-messages {
    min-height: 10rem;
  }

  .brand {
    font-size: 0.85rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero-content {
    padding: 1.75rem;
  }

  .weather-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .weather-options {
    justify-content: flex-start;
    width: 100%;
  }

  .weather-btn {
    flex: 1;
  }

  .section {
    padding: 3.5rem 0;
  }

  .hero {
    padding-top: 2rem;
    padding-bottom: 6.5rem;
  }

  .article-card.article-revealing.article-visible {
    max-height: 28rem;
  }

  .article-card p {
    -webkit-line-clamp: 4;
    line-clamp: 4;
  }

  .site-footer {
    padding: 1.5rem 0 calc(6rem + env(safe-area-inset-bottom));
  }

  .footer-inner {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
    gap: 0.85rem 1rem;
  }
}

@media (min-width: 769px) {
  .experience-meta {
    flex-direction: row;
    align-items: center;
  }

  .edu-meta {
    flex-direction: row;
    align-items: baseline;
  }
}
