/* sergeimellow.com : single stylesheet, no build step.
   Two theming axes:
   - light/dark via prefers-color-scheme
   - general/technical via .mode-technical on <html> (forces the dark
     terminal palette, green accent, mono headings) */

:root {
  --bg: #ffffff;
  --fg: #1a1f24;
  --muted: #5a6570;
  --accent: #0b5fa5;
  --accent-contrast: #ffffff;
  --card: #f4f6f8;
  --border: #dde3e8;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --font-heading: var(--font-body);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418;
    --fg: #e6ebf0;
    --muted: #9aa7b2;
    --accent: #4da3e0;
    --accent-contrast: #0f1418;
    --card: #171e24;
    --border: #2a343d;
  }
}

/* Deep dive is always dark: a terminal-flavored near-black regardless of
   the visitor's OS theme. */
html.mode-technical {
  --bg: #0b100d;
  --fg: #dbe7de;
  --muted: #93a89a;
  --accent: #4ec98f;
  --accent-contrast: #0b100d;
  --card: #121a15;
  --border: #24352b;
  --font-heading: var(--font-mono);
  color-scheme: dark;
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2rem, 1.5rem + 2.5vw, 3rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.75rem); }
h3 { font-size: 1.15rem; }

html.mode-technical h2::before {
  content: "$ ";
  color: var(--accent);
}

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

img { max-width: 100%; height: auto; }

/* ---------- Audience toggle mechanics ---------- */

html:not(.mode-technical) [data-audience="technical"] { display: none; }
html.mode-technical [data-audience="general"] { display: none; }
html:not(.js) .mode-toggle { display: none; }

/* ---------- Layout ---------- */

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

section { padding: 2.5rem 0 1rem; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.5rem 1rem;
  z-index: 10;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.wordmark {
  font-family: var(--font-heading);
  font-weight: 700;
  text-decoration: none;
  color: var(--fg);
  margin-right: auto;
  white-space: nowrap;
}

.site-nav { display: flex; gap: 0.9rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.site-nav a:hover { color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 0.75rem; }

.mode-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  background: var(--card);
}

.mode-toggle button {
  font-family: var(--font-body);
  font-size: 0.85rem;
  min-height: 2.4rem;
  padding: 0 0.9rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.mode-toggle button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-contrast);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--fg);
  background: var(--card);
  font-size: 0.95rem;
}
.btn:hover { border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.btn-small { padding: 0.35rem 0.8rem; font-size: 0.85rem; white-space: nowrap; }

/* ---------- Hero ---------- */

.hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding-top: 3.5rem;
}

.portrait {
  width: clamp(120px, 22vw, 190px);
  height: auto;
  border-radius: 50%;
  border: 3px solid var(--border);
  flex-shrink: 0;
}

.hero .title {
  color: var(--accent);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

.tagline { color: var(--muted); max-width: 34rem; margin-top: 0; }

.prompt { font-family: var(--font-mono); color: var(--accent); }

.hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.25rem; }

/* ---------- Experience ---------- */

.job { margin-bottom: 2rem; }
.job-header h3 { margin-bottom: 0.1em; }
.job-meta { color: var(--muted); margin: 0 0 0.75rem; font-size: 0.95rem; }
.job-meta .role { font-weight: 600; color: var(--fg); }

.job ul { padding-left: 1.2rem; }
.job li { margin-bottom: 0.5rem; }

.education { color: var(--muted); }

/* ---------- Skills ---------- */

.chips {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.chips li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.95rem;
}

.skills-full { margin: 0; }
.skills-full div { margin-bottom: 0.7rem; }
.skills-full dt {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
}
.skills-full dd { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- Projects ---------- */

.section-intro { color: var(--muted); }

.project-grid { display: grid; gap: 1.25rem; }

.project {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
}

.project h3 { color: var(--accent); }

.project .one-liner { font-weight: 600; margin-top: 0; }

.project details {
  margin-top: 0.75rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.75rem;
}

.project summary {
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--accent);
}

/* ---------- Personal ---------- */

.personal-flex { display: flex; gap: 1.5rem; align-items: flex-start; }
.personal-flex img {
  width: 260px;
  border-radius: 12px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* ---------- Contact ---------- */

.contact-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.contact-list li { display: flex; align-items: center; gap: 0.6rem; }
.contact-list svg { color: var(--muted); flex-shrink: 0; }

.resume-links { margin-top: 1.25rem; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1.5rem 1.25rem 2.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p { margin: 0.25rem 0; }
.colophon { font-family: var(--font-mono); font-size: 0.8rem; }

/* ---------- Responsive ---------- */

@media (max-width: 719px) {
  .site-nav { display: none; }
  .hero { flex-direction: column; text-align: center; padding-top: 2rem; }
  .hero-cta { justify-content: center; }
  .tagline { margin-inline: auto; }
  .personal-flex { flex-direction: column; }
  .personal-flex img { width: 100%; max-width: 420px; }
}

@media (min-width: 720px) {
  .project-grid { grid-template-columns: 1fr; }
}

/* ---------- Deep dive experience ---------- */

/* Faint phosphor grid + vignette behind everything in technical mode */
html.mode-technical body {
  background-image:
    radial-gradient(ellipse at 50% -10%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 55%),
    repeating-linear-gradient(0deg, transparent 0 31px, color-mix(in srgb, var(--accent) 4%, transparent) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, color-mix(in srgb, var(--accent) 4%, transparent) 31px 32px);
  background-attachment: fixed;
}

/* Hero stat row (technical only) */
.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  margin: 1.25rem 0 0;
  font-family: var(--font-mono);
}
.stat { display: flex; flex-direction: column; }
.stat-num, .stat-plus {
  font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem);
  font-weight: 700;
  color: var(--accent);
  display: inline;
}
.stat-label {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
}

/* Terminal hint */
.term-hint { margin-top: 1rem; }
.term-hint button {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  color: var(--fg);
  opacity: 0.8;
  cursor: pointer;
}
.term-hint button:hover { border-color: var(--accent); opacity: 1; }
.term-hint kbd {
  font-family: var(--font-mono);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 0.35em;
  background: var(--card);
}

/* Boot overlay */
.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #0a0f0c;
  color: #4ec98f;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 15vh 8vw;
  white-space: pre-wrap;
  transition: opacity 0.35s ease;
}
.boot-overlay.fade { opacity: 0; }
.boot-cursor::after {
  content: "\2588";
  animation: blink 0.7s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Interactive terminal */
.term-backdrop[hidden] { display: none; }
.term-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.term {
  width: min(680px, 100%);
  max-height: min(460px, 85vh);
  display: flex;
  flex-direction: column;
  background: #0a0f0c;
  color: #d7e6dc;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  border: 1px solid #2c4a3a;
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.8rem;
  background: #101812;
  border-bottom: 1px solid #2c4a3a;
}
.term-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #2c4a3a;
}
.term-dot:nth-child(1) { background: #e0655a; }
.term-dot:nth-child(2) { background: #e0b153; }
.term-dot:nth-child(3) { background: #59b56f; }
.term-title {
  margin-left: 0.5rem;
  font-size: 0.8rem;
  opacity: 0.7;
}
.term-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #d7e6dc;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.2rem;
}
.term-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.8rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.term-body a { color: #4ec98f; }
.term-body .term-cmd-echo { color: #8fb89e; }
.term-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  border-top: 1px solid #2c4a3a;
}
.term-prompt { color: #4ec98f; }
.term-input-row input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #d7e6dc;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  .boot-overlay { display: none !important; }
  .boot-cursor::after { animation: none; }
}

/* ---------- Terminal mode toggle button ---------- */

:root { --term-green: #1f8a5f; }
@media (prefers-color-scheme: dark) {
  :root { --term-green: #4ec98f; }
}
html.mode-technical { --term-green: #4ec98f; }

.mode-toggle .mode-term {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--term-green);
}
.mode-toggle .mode-term::before {
  content: ">_ " / "";
}
.mode-toggle .mode-term::after {
  content: "\2588";
  margin-left: 0.12em;
  font-size: 0.8em;
  animation: blink 1.1s steps(1) infinite;
}
html:not(.mode-technical) .mode-toggle .mode-term {
  animation: term-pulse 2.6s ease-out infinite;
}
.mode-toggle .mode-term[aria-pressed="true"] {
  color: var(--accent-contrast);
  animation: none;
}
@keyframes term-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--term-green) 45%, transparent); }
  55%  { box-shadow: 0 0 0 8px color-mix(in srgb, var(--term-green) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--term-green) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .mode-toggle .mode-term,
  .mode-toggle .mode-term::after { animation: none !important; }
}
