/* =========================================================
   Ethan Haskell — Portfolio
   Design tokens
   ========================================================= */
:root {
  /* Color */
  --bg: #0E141B;
  --bg-raised: #131A22;
  --surface: #161E27;
  --surface-2: #1C2530;
  --border: #26313D;
  --text: #E8ECEF;
  --text-dim: #8B9AAB;
  --text-faint: #56636F;
  --accent: #35D0C0;
  --accent-dim: #1F8377;
  --accent-soft: rgba(53, 208, 192, 0.12);
  --highlight: #F2A65A;
  --highlight-soft: rgba(242, 166, 90, 0.14);

  /* Type */
  --font-head: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Layout */
  --max-w: 1080px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.6em;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; color: var(--text); max-width: 62ch; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

section { padding: 6rem 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: none; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  display: block;
}

.section-head { margin-bottom: 3rem; max-width: 46ch; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.section-head p { color: var(--text-dim); }

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* =========================================================
   Nav
   ========================================================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(14, 20, 27, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-brand {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  flex: none;
}
.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0; padding: 0;
}
.nav-links a {
  color: var(--text-dim);
  font-size: 0.92rem;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }
.nav-toggle {
  display: none;
  background: none; border: none; color: var(--text);
  cursor: pointer;
  padding: 0.5rem;
}
.nav-toggle svg { width: 22px; height: 22px; }

@media (max-width: 760px) {
  .nav-links {
    position: fixed;
    top: 64px; left: 0; right: 0;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .nav-links.open { max-height: 320px; }
  .nav-links li { border-top: 1px solid var(--border); }
  .nav-links a { display: block; padding: 1rem var(--gutter); }
  .nav-toggle { display: block; }
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #06201C; }
.btn-primary:hover { background: #4EDCCC; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-row { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-top: 2rem; }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  padding-top: 10rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.hero .container {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 3rem;
  align-items: center;
}
.hero-status {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 1.4rem;
}
.hero-status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  margin-right: 0.5rem;
  box-shadow: 0 0 6px var(--accent);
}
.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  margin-bottom: 0.3em;
}
.hero .role {
  font-family: var(--font-head);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--accent);
  margin-bottom: 1.2rem;
  font-weight: 500;
}
.hero p.lede { color: var(--text-dim); font-size: 1.05rem; }

.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}
.hero-photo-frame {
  position: relative;
  width: min(280px, 60vw);
  margin: 30px;
}
.hero-photo-frame img {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  position: relative;
  z-index: 2;
}
.hero-photo-frame::before {
  content: "";
  position: absolute;
  inset: -14px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-lg) + 10px);
  z-index: 1;
}
.hero-net {
  position: absolute;
  inset: -30px;
  width: calc(100% + 60px);
  height: calc(100% + 60px);
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}
.hero-net path {
  stroke: var(--accent);
  stroke-width: 1;
  fill: none;
  opacity: 0.5;
  stroke-dasharray: 500;
  stroke-dashoffset: 500;
  animation: trace 2.6s ease-out forwards;
}
.hero-net circle {
  fill: var(--accent);
  opacity: 0;
  filter: drop-shadow(0 0 4px var(--accent));
  animation: node-in 0.5s ease-out forwards;
}
@keyframes trace { to { stroke-dashoffset: 0; } }
@keyframes node-in { to { opacity: 0.8; } }

@media (max-width: 820px) {
  .hero .container { grid-template-columns: 1fr; }
  .hero-visual { order: -1; margin-bottom: 1rem; }
  .hero-photo-frame { width: 180px; }
}

/* =========================================================
   About
   ========================================================= */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}
.about-bio p { color: var(--text-dim); }
.edu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.6rem;
  margin-top: 1.5rem;
}
.edu-card h3 { font-size: 1.05rem; margin-bottom: 0.2em; }
.edu-card .meta { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 0.8em; }
.edu-card .coursework { font-size: 0.88rem; color: var(--text-dim); }
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--highlight);
  background: var(--highlight-soft);
  border: 1px solid rgba(242, 166, 90, 0.35);
  border-radius: 999px;
  padding: 0.2em 0.7em;
  margin-top: 0.8em;
}

.skill-group { margin-bottom: 1.6rem; }
.skill-group h4 {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 0.7em;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35em 0.7em;
}

.leader-strip {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
.leader-strip .item h4 { font-size: 0.95rem; margin-bottom: 0.2em; }
.leader-strip .item span { color: var(--text-dim); font-size: 0.85rem; }

@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; }
  .leader-strip { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   Timeline (Experience — genuinely chronological)
   ========================================================= */
.timeline { margin-top: 3.5rem; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  width: 1px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding-left: 2.2rem;
  margin-bottom: 2.2rem;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: 0; top: 4px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.timeline-item .when {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  display: block;
  margin-bottom: 0.3em;
}
.timeline-item h4 { font-size: 1.02rem; margin-bottom: 0.1em; }
.timeline-item .org { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 0.6em; display: block; }
.timeline-item ul { margin: 0; padding-left: 1.1rem; color: var(--text-dim); font-size: 0.92rem; }
.timeline-item li { margin-bottom: 0.35em; }

/* =========================================================
   Projects
   ========================================================= */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
}
.project-card h3 { font-size: 1.05rem; margin-bottom: 0.5em; }
.project-card ul {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding-left: 1.1rem;
  margin: 0 0 1.2rem;
  flex: 1;
}
.project-card li { margin-bottom: 0.5em; }
.project-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.2rem; }
.project-tags .tag { font-size: 0.75rem; padding: 0.25em 0.6em; }
.project-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.project-note { font-size: 0.78rem; color: var(--text-faint); margin-top: 0.5rem; }
.project-more { text-align: center; margin-top: 2.5rem; }

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

/* =========================================================
   Resume
   ========================================================= */
.resume-panel {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  align-items: center;
}
.resume-highlights { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.resume-highlights li {
  padding: 0.6em 0;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.resume-highlights li span:first-child { color: var(--text); }
.resume-qr {
  text-align: center;
  border-left: 1px solid var(--border);
  padding-left: 2.5rem;
}
.resume-qr img {
  width: 130px; height: 130px;
  margin: 0 auto 0.8rem;
  border-radius: var(--radius-sm);
}
.resume-qr p { color: var(--text-faint); font-size: 0.78rem; margin: 0; font-family: var(--font-mono); }

@media (max-width: 820px) {
  .resume-panel { grid-template-columns: 1fr; }
  .resume-qr { border-left: none; border-top: 1px solid var(--border); padding-left: 0; padding-top: 2rem; }
}

/* =========================================================
   Contact
   ========================================================= */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}
.contact-list { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.contact-list li { margin-bottom: 1rem; }
.contact-list .label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-bottom: 0.2em;
}
.contact-list a { color: var(--text); font-size: 0.98rem; }
.contact-list a:hover { color: var(--accent); }

.field { margin-bottom: 1.2rem; }
.field label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.4em; }
.field input, .field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.7em 0.9em;
}
.field textarea { resize: vertical; min-height: 120px; }
.form-note { font-size: 0.8rem; color: var(--text-faint); margin-top: 0.8rem; }
.form-status { font-size: 0.88rem; margin-top: 0.8rem; min-height: 1.2em; }
.form-status.ok { color: var(--accent); }

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

/* =========================================================
   Footer
   ========================================================= */
footer {
  padding: 2.5rem 0;
}
footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
footer p { color: var(--text-faint); font-size: 0.85rem; margin: 0; }
.footer-links { display: flex; gap: 1.4rem; list-style: none; margin: 0; padding: 0; }
.footer-links a { color: var(--text-dim); font-size: 0.85rem; }

/* =========================================================
   Chatbot
   ========================================================= */
#chat-toggle {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 200;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #06201C;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  transition: transform 0.15s ease;
}
#chat-toggle:hover { transform: scale(1.06); }
#chat-toggle svg { width: 24px; height: 24px; }

#chat-panel {
  position: fixed;
  bottom: 5.5rem; right: 1.5rem;
  z-index: 200;
  width: min(340px, calc(100vw - 2.5rem));
  height: min(460px, calc(100vh - 8rem));
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
#chat-panel.open { transform: translateY(0); opacity: 1; pointer-events: auto; }

.chat-head {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-head .title { font-family: var(--font-mono); font-size: 0.85rem; }
.chat-head .title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: 0.5rem; }
.chat-head button { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 1.1rem; line-height: 1; }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.msg {
  max-width: 85%;
  padding: 0.6em 0.85em;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.5;
}
.msg.bot {
  background: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}
.msg.user {
  background: var(--accent-soft);
  border: 1px solid rgba(53,208,192,0.3);
  color: var(--text);
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1.1rem 0.8rem;
}
.chat-suggestions button {
  font-size: 0.76rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 0.35em 0.75em;
  cursor: pointer;
}
.chat-suggestions button:hover { border-color: var(--accent); color: var(--accent); }

.chat-input-row {
  border-top: 1px solid var(--border);
  display: flex;
  padding: 0.7rem;
  gap: 0.5rem;
}
.chat-input-row input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 0.6em 0.8em;
}
.chat-input-row button {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #06201C;
  padding: 0 1rem;
  cursor: pointer;
  font-weight: 600;
}

@media (max-width: 480px) {
  #chat-panel { right: 1.25rem; bottom: 5rem; }
}
