:root {
  --bg: #08080c;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --text: #f0f0f5;
  --text-secondary: #8a8a9a;
  --text-tertiary: #55556a;
  --green: #a6e22e;
  --yellow: #e6db74;
  --pink: #ff004f;
  --cyan: #66d9ef;
  --gray: #75715e;
  --blue: #7aa2f7;
  --red: #f7768e;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --accent-glow: rgba(255, 0, 79, 0.15);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Grain Overlay --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

body.scanlines::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.22) 50%) 0 0 / 100% 3px;
  z-index: 50;
}

.terminal-shell {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.terminal-view {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 8px;
  cursor: text;
  display: flex;
  flex-direction: column;
}

.terminal-view > :first-child {
  margin-top: auto;
}

.terminal-view::-webkit-scrollbar {
  width: 8px;
}

.terminal-view::-webkit-scrollbar-thumb {
  background: #444;
}

.line {
  margin: 0 0 0.15rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 1.2rem;
}

.line.command {
  color: var(--text);
}

.line.reply {
  color: var(--cyan);
}

.line.info {
  color: var(--gray);
}

.line.warn {
  color: var(--yellow);
}

.line.error {
  color: var(--red);
}

.line.ascii {
  color: var(--pink);
  line-height: 1.1;
  font-weight: 700;
}

.line.title {
  color: var(--yellow);
  font-weight: 700;
}

.line.dim {
  color: var(--gray);
}

.link-anchor {
  color: var(--cyan);
  text-decoration: none;
}

.link-anchor:hover {
  text-decoration: underline;
}

.prompt-arrow-success {
  color: var(--green);
  font-weight: 700;
}

.prompt-arrow-fail {
  color: var(--red);
  font-weight: 700;
}

.prompt-path {
  color: var(--cyan);
}

.prompt-git-prefix {
  color: var(--blue);
}

.prompt-git-branch {
  color: var(--red);
}

.prompt-command-text {
  color: var(--text);
}

.ls-dir {
  color: var(--blue);
}

.ls-file {
  color: var(--text);
}

.command-bar {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.55rem;
  padding-top: 10px;
}

.crawl-map {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  padding-top: 0.8rem;
  color: var(--gray);
  font-size: 0.75rem;
  line-height: 1.3;
}

.crawl-map a {
  color: var(--gray);
  text-decoration: none;
}

.crawl-map a:hover {
  color: var(--cyan);
  text-decoration: underline;
}

.prompt {
  white-space: pre;
  font-size: 1.2rem;
}

#command-input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 1.2rem;
  caret-color: var(--green);
}

#command-input::placeholder {
  color: var(--gray);
}

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

@media (max-width: 820px) {
  .terminal-shell {
    padding: 14px;
  }

  .line,
  .prompt,
  #command-input {
    font-size: 1.02rem;
  }

  .crawl-map {
    font-size: 0.68rem;
  }
}

/* ═══════════════════════════════════════════════
   SITE VIEW — Cinematic Dark
   ═══════════════════════════════════════════════ */

.site {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-secondary);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.6;
}

.site-wrap {
  max-width: 740px;
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
}

/* ── Hero ── */

.s-hero {
  padding-bottom: 3rem;
  border-bottom: 2px solid var(--pink);
}

.s-hero-top {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* ── Photo ── */

.s-photo {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--pink);
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--accent-glow), 0 0 60px rgba(255, 0, 79, 0.06);
}

.s-name {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.6rem, 5.5vw, 3.8rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: #fff;
  margin: 0;
}

.s-bio {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 1.8rem 0 0;
}

.s-bio a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  transition: color 0.15s, border-color 0.15s;
}

.s-bio a:hover,
.s-bio-btn:hover {
  color: var(--pink);
  border-color: var(--pink);
}

.s-bio-btn {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: var(--text);
  background: none;
  padding: 0;
  margin: 0;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

/* ── Meta (Companies / Social) ── */

.s-meta {
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
}

.s-meta-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.2rem;
}

.s-meta-label {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.s-meta-items {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.s-logo-sep {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.1);
}

.s-meta-items a {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.15s;
}

.s-meta-items a:hover {
  color: var(--pink);
}

.s-logo {
  height: 42px;
  width: auto;
}

.s-logo--sd {
  height: 44px;
  position: relative;
  top: 4px;
}

/* ── Sections ── */

.site section {
  padding: 2.5rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.s-heading {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: 1.6rem;
  color: var(--text);
  margin: 0 0 1.2rem;
  letter-spacing: -0.005em;
  line-height: 1.2;
}

/* ── Projects ── */

.s-projects {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.s-project {
  display: block;
  text-decoration: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: background 0.2s var(--ease-out-expo), border-color 0.2s var(--ease-out-expo), box-shadow 0.2s var(--ease-out-expo);
}

.s-project:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 0, 79, 0.2);
  box-shadow: 0 4px 24px rgba(255, 0, 79, 0.08);
}

.s-project-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.s-project-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.s-project-name {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--text);
  transition: color 0.15s;
}

.s-project:hover .s-project-name {
  color: var(--pink);
}

.s-project-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

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

.s-project-tag {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.s-project-featured {
  border-color: rgba(255, 0, 79, 0.15);
  background: rgba(255, 0, 79, 0.02);
}

.s-project-featured:hover {
  border-color: rgba(255, 0, 79, 0.3);
  box-shadow: 0 4px 32px rgba(255, 0, 79, 0.12);
}

.s-project-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.65rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: auto;
}

.s-project-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a6e22e;
  box-shadow: 0 0 6px rgba(166, 226, 46, 0.4);
}

/* ── Entry List (Notes) ── */

.s-list {
  display: flex;
  flex-direction: column;
}

.s-item {
  display: block;
  padding: 0.8rem 0;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: border-color 0.15s;
}

.s-item:last-child {
  border-bottom: none;
}

.s-item:hover {
  border-color: var(--pink);
}

.s-item:hover .s-item-title {
  color: var(--pink);
}

.s-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.s-item-title {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--text);
  transition: color 0.15s;
  line-height: 1.3;
  letter-spacing: 0.005em;
}

.s-item-date {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.s-item-desc {
  display: block;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
  line-height: 1.6;
}

/* ── Email Modal ── */

.email-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 12, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.email-modal.is-open {
  display: flex;
}

.email-modal-inner {
  position: relative;
  background: #0e0e14;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 2.5rem 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.email-img {
  display: block;
  width: 380px;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.email-copy-btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 0.4rem 1.2rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.email-copy-btn:hover {
  color: var(--pink);
  border-color: var(--pink);
}

.email-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.7rem;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}

.email-close-btn:hover {
  color: var(--pink);
}

/* ── Mode Toggle ── */

.mode-toggle {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  background: rgba(8, 8, 12, 0.9);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mode-toggle:hover {
  color: var(--pink);
  border-color: rgba(255, 0, 79, 0.2);
}

.mode-toggle kbd {
  font-family: inherit;
  font-size: inherit;
  color: var(--text-tertiary);
  background: transparent;
  line-height: 1;
}

/* ── Responsive ── */

@media (max-width: 640px) {
  .site-wrap {
    padding: 2.5rem 1rem 2rem;
  }

  .s-hero-top {
    gap: 1rem;
  }

  .s-photo {
    width: 80px;
    height: 80px;
  }

  .s-bio {
    font-size: 0.95rem;
  }

  .s-meta {
    flex-direction: column;
    gap: 1.5rem;
  }

  .s-project {
    padding: 1.2rem;
  }

  .mode-toggle {
    bottom: 0.6rem;
    right: 0.6rem;
  }
}
