/* ============ SARTHAK BHOT — Apple-inspired light theme ============ */
:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --card: #ffffff;
  --card-border: #d2d2d7;
  --text: #1d1d1f;
  --text-dim: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #006edb;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, sans-serif;
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.05);
  --shadow-lift: 0 12px 32px rgba(0, 0, 0, 0.1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  overflow-x: hidden;
}

::selection { background: rgba(0, 113, 227, 0.18); }

.wrap { max-width: 1020px; margin: 0 auto; padding: 0 24px; }

/* Accent spans now inherit — no colored highlights */
.accent { color: inherit; }
.hl { color: inherit; font-weight: 600; }

/* ---------- Nav ---------- */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
#nav.scrolled { border-bottom-color: var(--card-border); background: rgba(255, 255, 255, 0.9); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06); }
.nav-inner {
  max-width: 1020px; margin: 0 auto; padding: 0 24px;
  height: 48px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
#navLinks { margin-left: auto; }
.logo {
  font-weight: 700; font-size: 1rem; letter-spacing: 0.02em;
  color: var(--text); text-decoration: none;
}
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links a {
  color: var(--text); text-decoration: none; font-size: 13px; opacity: 0.8;
  transition: opacity 0.25s;
}
.nav-links a:hover, .nav-links a.active { opacity: 1; }
.nav-cta {
  background: var(--accent); color: #fff !important; opacity: 1 !important;
  border-radius: 999px; padding: 5px 14px !important; font-size: 12px !important;
}
.nav-cta:hover { background: var(--accent-hover); }
.menu-btn { display: none; background: none; border: none; cursor: pointer; flex-direction: column; gap: 6px; padding: 8px; }
.menu-btn span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.3s; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; padding: 120px 24px 110px; text-align: left;
  background: var(--bg);
  overflow: hidden;
}
.hero-glow { display: none; }
.hero-inner {
  max-width: 1020px; width: 100%; display: grid;
  grid-template-columns: 1.4fr 1fr; gap: 60px; align-items: center; position: relative;
}
.eyebrow {
  color: var(--text-dim); font-size: 1rem; font-weight: 500;
  margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(2.75rem, 7vw, 4.5rem); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.05; margin-bottom: 18px;
  color: var(--text);
}
.hero-sub { color: var(--text-dim); font-size: 1.25rem; line-height: 1.5; max-width: 540px; margin-bottom: 34px; }
.hero-btns { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-block; padding: 12px 28px; border-radius: 999px;
  font-size: 1rem; font-weight: 500; text-decoration: none;
  transition: background 0.25s, transform 0.25s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border: 1px solid var(--card-border); color: var(--accent); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); }
.btn:hover { transform: scale(1.06); }
.btn:active { transform: scale(0.96); }

.hero-photo { display: flex; justify-content: center; }
.photo-frame {
  width: 280px; height: 280px; border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-soft);
}
.photo-frame img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 20%;
  display: block;
}

/* ---------- Currently strip ---------- */
.currently {
  border-top: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
  background: var(--bg-alt);
  padding: 18px 0;
}
.currently .wrap {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; flex-wrap: wrap; text-align: center;
}
.currently-label {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim);
}
.currently span:not(.currently-label) { color: var(--text); font-size: 0.92rem; }
.currently i { color: var(--card-border); font-style: normal; }

/* ---------- Sections ---------- */
.section { padding: 100px 0; }
.section-alt { background: var(--bg-alt); }
.section-eyebrow {
  color: var(--text-dim); font-size: 0.9rem; font-weight: 600;
  letter-spacing: 0.06em; margin-bottom: 10px;
}
.section-title {
  font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 40px;
  color: var(--text);
}

/* Reveal animation — subtle and quick */
.reveal { opacity: 0; transform: translateY(24px) scale(0.98); transition: opacity 0.6s cubic-bezier(0.22,1,0.36,1), transform 0.6s cubic-bezier(0.22,1,0.36,1); }
.reveal.visible { opacity: 1; transform: none; }
/* directional variant — section headings sweep in from the left */
.reveal-left { transform: translateX(-36px); }
.reveal-left.visible { transform: none; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; margin-bottom: 32px; }
.about-grid p { color: var(--text-dim); font-size: 1.05rem; line-height: 1.65; margin-bottom: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font-size: 0.88rem; color: var(--text); background: var(--bg-alt);
  border-radius: 999px; padding: 8px 18px;
}

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.skill-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 28px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.skill-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.skill-card h3 { font-size: 1.05rem; margin-bottom: 16px; color: var(--text); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills span {
  font-size: 0.85rem; color: var(--text); background: var(--bg-alt);
  border-radius: 8px; padding: 6px 12px;
}

/* ---------- Projects ---------- */
#projects { background: var(--bg-alt); }
.projects-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.project-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 34px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.project-top { display: flex; justify-content: space-between; align-items: center; }
.status {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  border-radius: 999px; padding: 5px 14px;
}
.status.done { background: rgba(0, 113, 227, 0.1); color: var(--accent); }
.status.planning { background: var(--bg-alt); color: var(--text-dim); }
.project-date { color: var(--text-dim); font-size: 0.88rem; }
.project-card h3 { font-size: 1.4rem; letter-spacing: -0.01em; color: var(--text); }
.project-card p { color: var(--text-dim); font-size: 0.98rem; flex: 1; }
.project-card .pills span { background: var(--bg-alt); }
.project-link {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 6px;
  color: var(--accent); text-decoration: none; font-weight: 500; font-size: 0.98rem;
}
.project-link:hover { text-decoration: underline; }
.project-link.muted { color: var(--text-dim); cursor: default; }
.project-link.muted:hover { text-decoration: none; }

/* ---------- Experience ---------- */
#experience { background: var(--bg); }
.timeline { position: relative; padding-left: 30px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px;
  background: var(--card-border); border-radius: 2px;
}
.tl-item { position: relative; margin-bottom: 40px; }
.tl-item:last-child { margin-bottom: 0; }
.tl-dot {
  position: absolute; left: -30px; top: 6px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--bg);
  border: 3px solid var(--accent);
}
.tl-date { color: var(--text-dim); font-size: 0.85rem; letter-spacing: 0.04em; }
.tl-body h3 { font-size: 1.25rem; margin: 6px 0 8px; color: var(--text); }
.tl-body h3 span { color: var(--text-dim); font-weight: 400; }
.tl-body p { color: var(--text-dim); max-width: 640px; }
.edu-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 28px 32px;
  display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
  box-shadow: var(--shadow-soft);
}
.edu-card h3 { font-size: 1.2rem; margin-bottom: 6px; color: var(--text); }
.edu-card p { color: var(--text-dim); }
#experience .edu-card .tl-date { color: var(--text-dim); }

/* ---------- Expandable project details ---------- */
.project-teaser { flex: 1; }
.project-more { margin: -4px 0 4px; }
.project-more summary {
  cursor: pointer; color: var(--accent); font-size: 0.92rem; font-weight: 500;
  list-style: none; display: inline-block;
}
.project-more summary::-webkit-details-marker { display: none; }
.project-more summary::before { content: "+ "; font-weight: 700; }
.project-more[open] summary::before { content: "– "; }
.project-more > p { color: var(--text-dim); font-size: 0.95rem; margin-top: 10px; }

/* ---------- Contact ---------- */
.contact-wrap { text-align: center; display: flex; flex-direction: column; align-items: center; }
.contact-wrap .section-title { margin-bottom: 20px; }
.contact-wrap p { color: var(--text-dim); margin-bottom: 34px; }
.contact-btns { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-bottom: 44px; }
.socials { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.socials a {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; font-size: 0.95rem;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 999px; padding: 12px 24px;
  transition: border-color 0.25s;
}
.socials a:hover { border-color: var(--accent); }

/* ---------- Footer ---------- */
footer { background: var(--bg-alt); padding: 28px 0; text-align: center; }
footer p { color: var(--text-dim); font-size: 0.8rem; }

/* ---------- Cert & timeline photos ---------- */
.edu-card.with-photos { display: block; padding: 0; overflow: hidden; }
.cert-photos { display: grid; gap: 2px; }
.cert-photos.cols-2 { grid-template-columns: 1fr 1fr; }
.cert-photos a { display: block; aspect-ratio: 16/9; overflow: hidden; }
.cert-photos img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.cert-photos a:hover img { transform: scale(1.03); }
.cert-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 28px 32px; }
.tl-photos { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }
.tl-photos a { display: block; aspect-ratio: 4/3; overflow: hidden; border-radius: 10px; border: 1px solid var(--card-border); }
.tl-photos img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }

/* ---------- Lightbox (photo popup) ---------- */
.cert-photos a, .tl-photos a { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.88); }
.lightbox-figure { position: relative; z-index: 1; margin: 0; text-align: center; max-width: 94vw; }
.lightbox-figure img {
  max-width: 94vw; max-height: 82vh; border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}
.lightbox-close {
  position: absolute; top: 18px; right: 18px; z-index: 2;
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, 0.16); color: #fff;
  font-size: 1.5rem; line-height: 1;
  transition: background 0.25s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox-prev, .lightbox-next {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, 0.16); color: #fff;
  font-size: 1.6rem; line-height: 1; padding-bottom: 4px;
  transition: background 0.25s;
}
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox-prev { left: 14px; }
.lightbox-next { right: 14px; }
@media (max-width: 820px) {
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
}

/* ---------- Apple-style scroll effects (progressive enhancement) ---------- */
@supports (animation-timeline: view()) {
  .section-title {
    animation: title-focus linear backwards;
    animation-timeline: view();
    animation-range: entry 0% entry 70%;
  }
  .skill-card, .project-card, .edu-card {
    animation: card-drift linear backwards;
    animation-timeline: view();
    animation-range: entry 0% entry 90%;
  }
  .cert-photos img, .tl-photos img {
    animation: photo-settle linear backwards;
    animation-timeline: view();
    animation-range: entry 0% entry 80%;
  }
  @keyframes title-focus {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes card-drift {
    from { transform: translateY(36px) scale(0.985); }
    to { transform: translateY(0) scale(1); }
  }
  @keyframes photo-settle {
    from { transform: scale(1.14); }
    to { transform: scale(1); }
  }
}
@media (prefers-reduced-motion: reduce) {
  .section-title, .skill-card, .project-card, .edu-card,
  .cert-photos img, .tl-photos img { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .hero-btns .btn, .lightbox.open .lightbox-figure { animation: none !important; }
  #progress { display: none; }
}

/* ---------- Polish: pop-ins & micro-interactions ---------- */
::selection { background: var(--accent); color: #fff; }

#progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  z-index: 300; pointer-events: none;
}

/* hero buttons cascade in on load */
@keyframes btn-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.94); }
  to { opacity: 1; transform: none; }
}
.hero-btns .btn { animation: btn-pop 0.55s cubic-bezier(0.22,1,0.36,1) backwards; }
.hero-btns .btn:nth-child(2) { animation-delay: 0.1s; }
.hero-btns .btn:nth-child(3) { animation-delay: 0.2s; }

/* lightbox pops open */
@keyframes lb-pop {
  from { opacity: 0; transform: scale(0.92) translateY(14px); }
  to { opacity: 1; transform: none; }
}
.lightbox.open .lightbox-figure { animation: lb-pop 0.32s cubic-bezier(0.22,1,0.36,1); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero { padding: 120px 20px 150px; }
  .hero-inner { grid-template-columns: 1fr; text-align: center; gap: 44px; }
  .hero-sub { margin-left: auto; margin-right: auto; }
  .hero-btns { justify-content: center; }
  .hero-photo { order: -1; }
  .photo-frame { width: 190px; height: 190px; }
  .about-grid, .projects-grid { grid-template-columns: 1fr; }
  .nav-links {
    position: fixed; top: 48px; left: 0; right: 0; flex-direction: column;
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px; gap: 18px; align-items: center;
    transform: translateY(-130%); transition: transform 0.35s ease;
    border-bottom: 1px solid var(--card-border);
  }
  .nav-links.open { transform: none; }
  #navLinks { margin-left: 0; }
  .theme-toggle { margin-left: auto; }
  .menu-btn { display: flex; }
  .section { padding: 72px 0; }
  .hero h1 { font-size: clamp(2.5rem, 11vw, 3.5rem); }
  .cert-photos.cols-2 { grid-template-columns: 1fr; }
  .cert-row { padding: 24px; }
  .edu-card { padding: 24px; }
}

/* ============ DARK MODE (default) — "workshop at night" ============ */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0b0e;
  --bg-alt: #0f1116;
  --card: #14171e;
  --card-border: #262c38;
  --text: #f2f4f8;
  --text-dim: #9aa3b2;
  --accent: #f2a33c;
  --accent-hover: #d98e28;
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-lift: 0 12px 32px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] #nav { background: rgba(10, 11, 14, 0.72); }
html[data-theme="dark"] #nav.scrolled { background: rgba(10, 11, 14, 0.9); }
html[data-theme="dark"] .btn-primary { background: var(--accent); color: #1a1206; }
html[data-theme="dark"] .btn-primary:hover { background: var(--accent-hover); color: #1a1206; }
html[data-theme="dark"] .btn-ghost { color: var(--accent); }
html[data-theme="dark"] .btn-ghost:hover { border-color: var(--accent); }
html[data-theme="dark"] .nav-cta { color: #1a1206 !important; }
html[data-theme="dark"] ::selection { background: var(--accent); color: #1a1206; }
html[data-theme="dark"] .status.done { background: rgba(242, 163, 60, 0.14); color: var(--accent); }
/* subtle warm glow in the hero, dark mode only (static gradient — no perf cost) */
html[data-theme="dark"] .hero-glow {
  display: block;
  position: absolute; width: 620px; height: 620px; border-radius: 50%;
  top: -140px; right: -100px; pointer-events: none;
  background: radial-gradient(circle, rgba(242, 163, 60, 0.09) 0%, rgba(242, 163, 60, 0) 62%);
}
/* faint film grain for texture, dark mode only (static layer — no perf cost) */
html[data-theme="dark"] body::after {
  content: ""; position: fixed; inset: 0; z-index: 999; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (max-width: 820px) {
  html[data-theme="dark"] .nav-links { background: rgba(10, 11, 14, 0.96); }
}

/* ============ Theme toggle (sun / moon) ============ */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--card); border: 1px solid var(--card-border);
  color: var(--text); cursor: pointer;
  transition: border-color 0.25s, transform 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle:active { transform: scale(0.9); }
.theme-toggle svg { width: 17px; height: 17px; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="light"] .theme-toggle .icon-sun { display: none; }

/* ============ Hero terminal (typing effect) ============ */
.terminal {
  max-width: 520px; margin-bottom: 30px; text-align: left;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow-soft);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.term-bar { display: flex; gap: 7px; padding: 10px 14px; border-bottom: 1px solid var(--card-border); }
.term-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--card-border); }
.term-bar span:first-child { background: #ff5f57; }
.term-bar span:nth-child(2) { background: #febc2e; }
.term-bar span:nth-child(3) { background: #28c840; }
.term-body { padding: 14px 16px 16px; font-size: 0.86rem; line-height: 1.7; }
.term-line { color: var(--text); }
.term-body .prompt { color: var(--accent); font-weight: 700; margin-right: 8px; }
.term-out {
  color: var(--text-dim); opacity: 0; transform: translateY(4px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.term-out.show { opacity: 1; transform: none; }
.caret {
  display: inline-block; width: 8px; height: 1.05em;
  background: var(--accent); vertical-align: text-bottom;
  animation: caret-blink 1s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none; } }
@media (max-width: 820px) { .terminal { margin-inline: auto; } }

/* ============ Hero particle network canvas ============ */
#netCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}

/* ============ Custom cursor + magnetic buttons (desktop) ============ */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 1000;
  border-radius: 50%;
}
.cursor-dot { width: 6px; height: 6px; background: var(--accent); }
.cursor-ring {
  width: 34px; height: 34px; border: 1.5px solid var(--accent); opacity: 0.55;
  transition: width 0.25s ease, height 0.25s ease, opacity 0.25s ease;
}
.cursor-ring.is-hover { width: 54px; height: 54px; opacity: 0.9; }
.has-custom-cursor, .has-custom-cursor a, .has-custom-cursor button { cursor: none; }
@media (prefers-reduced-motion: reduce) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* ============ Fake terminal (~ key) ============ */
.tx-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; transition: opacity 0.2s ease;
}
.tx-overlay[hidden] { display: none; }
.tx-overlay.open { opacity: 1; }
.tx {
  width: min(680px, 100%); height: min(440px, 80vh);
  background: #0b0e14; border: 1px solid #2a2f3a; border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  transform: translateY(10px) scale(0.98); transition: transform 0.2s ease;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: left;
}
.tx-overlay.open .tx { transform: none; }
.tx-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #11151d; border-bottom: 1px solid #2a2f3a; }
.tx-dots { display: flex; gap: 6px; }
.tx-dots i { width: 11px; height: 11px; border-radius: 50%; background: #3a4150; }
.tx-dots i:first-child { background: #ff5f57; }
.tx-dots i:nth-child(2) { background: #febc2e; }
.tx-dots i:nth-child(3) { background: #28c840; }
.tx-title { flex: 1; text-align: center; color: #8b93a5; font-size: 0.78rem; }
.tx-close { background: none; border: none; color: #8b93a5; font-size: 1.15rem; line-height: 1; cursor: pointer; padding: 2px 6px; }
.tx-close:hover { color: #fff; }
.tx-body { flex: 1; overflow-y: auto; padding: 14px 16px; color: #c9d1d9; font-size: 0.85rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.tx-body .tx-tp { color: #f59e0b; }
.tx-input { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid #2a2f3a; color: #c9d1d9; font-size: 0.85rem; position: relative; }
.tx-prompt { color: #f59e0b; white-space: nowrap; }
.tx-caret { width: 8px; height: 17px; background: #f59e0b; animation: tx-blink 1.05s steps(1) infinite; flex: none; }
@keyframes tx-blink { 50% { opacity: 0; } }
.tx-hidden { position: absolute; bottom: 4px; left: 4px; width: 10px; height: 10px; opacity: 0; border: none; padding: 0; font-size: 16px; }
.term-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 400;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--card-border); color: var(--accent);
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; cursor: pointer;
  box-shadow: var(--shadow-soft); opacity: 0.9;
}
.term-fab:hover { opacity: 1; border-color: var(--accent); }
.foot-tip { margin-top: 8px; font-size: 0.82rem; color: var(--text-dim); }
.foot-tip kbd {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.75rem;
  background: var(--bg-alt); border: 1px solid var(--card-border);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--text);
}
@media (prefers-reduced-motion: reduce) {
  .tx-overlay, .tx, .tx-caret { transition: none; animation: none; }
}

/* ============ BB-8 key (press B) ============ */
.bb8 { position: fixed; left: 0; bottom: 10vh; z-index: 950; width: 64px; height: 86px; pointer-events: none; animation: bb8-travel 4.6s linear forwards; }
@keyframes bb8-travel { from { transform: translateX(-90px); } to { transform: translateX(calc(100vw + 90px)); } }
.bb8-shadow { position: absolute; bottom: -4px; left: 8px; width: 48px; height: 10px; border-radius: 50%; background: rgba(0, 0, 0, 0.28); }
.bb8-body {
  position: absolute; bottom: 4px; left: 4px; width: 56px; height: 56px; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #f59e0b 0 8px, transparent 9px),
    radial-gradient(circle at 70% 62%, #f59e0b 0 6px, transparent 7px),
    radial-gradient(circle at 58% 24%, #9aa3b2 0 3px, transparent 4px),
    radial-gradient(circle at 24% 68%, #9aa3b2 0 3px, transparent 4px),
    #f4f6f8;
  border: 2px solid #d7dce2;
  animation: bb8-spin 4.6s linear forwards;
}
@keyframes bb8-spin { from { transform: rotate(0); } to { transform: rotate(1080deg); } }
.bb8-head {
  position: absolute; bottom: 52px; left: 14px; width: 36px; height: 24px;
  background: #f4f6f8; border: 2px solid #d7dce2; border-bottom: none;
  border-radius: 20px 20px 0 0;
  animation: bb8-bob 0.5s ease-in-out infinite alternate;
}
.bb8-head::after {
  content: ""; position: absolute; top: 8px; left: 50%; width: 8px; height: 8px;
  margin-left: -4px; border-radius: 50%; background: #1a1d23; box-shadow: 0 0 0 2px #f59e0b;
}
@keyframes bb8-bob { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-2px) rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .bb8 { display: none; } }

/* ============ Toast (copy-email feedback) ============ */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 1200;
  transform: translateX(-50%) translateY(12px);
  background: #151a23; color: #e8ecf1; border: 1px solid rgba(245, 158, 11, 0.45);
  padding: 10px 18px; border-radius: 999px; font-size: 0.85rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Back-to-top button ============ */
.to-top {
  position: fixed; right: 18px; bottom: 76px; z-index: 400;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--card-border); color: var(--accent);
  font-size: 1.2rem; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow-soft);
  opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.2s ease;
}
.to-top.show { opacity: 0.9; pointer-events: auto; transform: none; }
.to-top:hover { opacity: 1; border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .to-top { transition: none; } }

/* ============ Glitch effect on hero name (hover, desktop only) ============ */
@media (pointer: fine) {
  .glitch-name { position: relative; }
  .glitch-name.glitching::before,
  .glitch-name.glitching::after {
    content: attr(data-text);
    position: absolute; inset: 0;
    overflow: hidden; pointer-events: none;
  }
  .glitch-name.glitching::before {
    color: #ff3b5c;
    animation: glitch-a 0.38s steps(2) both;
  }
  .glitch-name.glitching::after {
    color: #00e5ff;
    animation: glitch-b 0.38s steps(2) both;
  }
  @keyframes glitch-a {
    0% { clip-path: inset(15% 0 65% 0); transform: translate(-5px, -2px); }
    50% { clip-path: inset(60% 0 10% 0); transform: translate(5px, 2px); }
    100% { clip-path: inset(35% 0 40% 0); transform: translate(-3px, 1px); opacity: 0; }
  }
  @keyframes glitch-b {
    0% { clip-path: inset(65% 0 15% 0); transform: translate(5px, 2px); }
    50% { clip-path: inset(10% 0 70% 0); transform: translate(-5px, -2px); }
    100% { clip-path: inset(45% 0 35% 0); transform: translate(3px, -1px); opacity: 0; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .glitch-name.glitching::before,
  .glitch-name.glitching::after { animation: none; }
}

/* ============ Custom scrollbar ============ */
html { scrollbar-width: thin; scrollbar-color: var(--card-border) var(--bg); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 8px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
