/* ============================================================
   Joseph Moskovitz — personal site
   Space + nuclear theme: deep-space background with parallax
   starfield (assets/site.js), reactor-gold + plasma-cyan accents.
   Colors/fonts are defined once in :root below.
   ============================================================ */

@font-face {
  font-family: "Twemoji Country Flags";
  src: url("https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1.4/dist/TwemojiCountryFlags.woff2") format("woff2");
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0061-E007A, U+E007F;
  font-display: swap;
}

:root {
  --bg: #060a14;
  --bg-card: rgba(16, 26, 46, 0.72);
  --bg-card-hover: rgba(22, 34, 58, 0.85);
  --text: #e9eef8;
  --muted: #94a0b8;
  --rule: rgba(255, 255, 255, 0.10);
  --gold: #f2b134;        /* reactor glow */
  --cyan: #5fd0f5;        /* plasma */
  --font-head: "Space Grotesk", "Helvetica Neue", Arial, "Apple Color Emoji", "Noto Color Emoji", "Twemoji Country Flags", sans-serif;
  --font-body: "Inter", "Helvetica Neue", Arial, "Apple Color Emoji", "Noto Color Emoji", "Twemoji Country Flags", sans-serif;
  --max-width: 980px;
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(56, 89, 179, 0.20), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(95, 208, 245, 0.07), transparent 55%),
    radial-gradient(800px 500px at 70% 105%, rgba(242, 177, 52, 0.07), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

/* starfield canvas sits behind everything */
#stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.container {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
}

/* padding-top keeps heading margins from collapsing out of <main>,
   so absolutely-positioned page animations anchor to the true top */
main.container { padding-top: 6px; }

/* ---------- sticky nav ---------- */
nav.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(6, 10, 20, 0.75);
  border-bottom: 1px solid var(--rule);
}

nav.site-nav .nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

nav.site-nav .brand {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

nav.site-nav .brand .dot { color: var(--gold); }

nav.site-nav .links {
  display: flex;
  gap: 22px;
  font-family: var(--font-head);
  font-size: 0.92rem;
  text-transform: lowercase;
  letter-spacing: 0.06em;
}

nav.site-nav .links a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

nav.site-nav .links a:hover { color: var(--text); }
nav.site-nav .links a.active { color: var(--text); border-bottom-color: var(--gold); }

/* ---------- hero (index) ---------- */
.hero {
  position: relative;
  padding: 96px 0 72px;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 40px;
  align-items: center;
}

.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 700;
  line-height: 1.08;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}

.hero h1 .grad {
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .tagline {
  font-family: var(--font-head);
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 18px;
}

.hero .sub { color: var(--muted); font-size: 1.12rem; max-width: 34em; }

/* electron cloud graphic — drawn on canvas by site.js */
.cloud-wrap { display: flex; justify-content: center; }
#cloud { width: min(340px, 72vw); height: auto; aspect-ratio: 1; }

/* per-page animation / decor, top-right of main, above the heading zone */
.page-anim, .page-decor {
  position: absolute;
  top: -2px;
  right: 12px;
  pointer-events: none;
  opacity: 0.9;
}

/* keep the magnetar graphic anchored while making it visually larger */
.page-anim[data-anim="magnetar"] {
  transform: scale(2);
  transform-origin: top right;
}

@media (max-width: 900px) { .page-anim, .page-decor { display: none; } }

/* ---------- about layout: text left, portrait on the right ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 48px;
  align-items: start;
  margin-bottom: 24px;
}

.portrait-wrap { margin: 6px 0 0; }

.portrait {
  width: 100%;
  border-radius: 14px;
  filter: grayscale(100%);
  border: 1px solid var(--rule);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  transition: filter 0.4s ease;
  display: block;
}

.portrait:hover { filter: grayscale(35%); }

@media (max-width: 720px) {
  .about-grid { grid-template-columns: 1fr; gap: 8px; }
  .portrait-wrap { order: -1; display: flex; justify-content: center; margin-bottom: 24px; }
  .portrait { width: min(240px, 70vw); }
}

/* affiliation logos under the portrait */
.logo-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 20px;
}

.logo-strip a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 12px 8px 10px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.logo-strip a:hover { border-color: rgba(242, 177, 52, 0.45); transform: translateY(-2px); }

.logo-strip img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 6px;
  filter: grayscale(1) brightness(1.15);
  opacity: 0.85;
  transition: filter 0.25s ease, opacity 0.25s ease;
}

.logo-strip a:hover img { filter: none; opacity: 1; }

.logo-strip .logo-name {
  font-family: var(--font-head);
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  text-align: center;
  color: var(--muted);
  line-height: 1.3;
}

.logo-strip a:hover .logo-name { color: var(--text); }

@media (max-width: 720px) {
  .logo-strip { grid-template-columns: repeat(4, 1fr); max-width: 400px; margin: 20px auto 0; }
}

/* page headings */
h1.page-heading {
  font-family: var(--font-head);
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  font-weight: 700;
  margin: 58px 0 10px;
  letter-spacing: -0.01em;
}

h1.page-heading::after {
  content: "";
  display: block;
  width: 64px;
  height: 3px;
  margin-top: 14px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
}

.page-sub { color: var(--muted); max-width: 46em; margin-bottom: 40px; }

h2 {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 48px 0 10px;
}

p { margin: 0 0 20px; }

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--gold); }

main .prose a { border-bottom: 1px solid rgba(95, 208, 245, 0.35); }
main .prose a:hover { border-bottom-color: rgba(242, 177, 52, 0.6); }

.prose { max-width: 46em; }
.muted { color: var(--muted); }

/* ---------- scroll-reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- work + featured cards ---------- */
.card-grid, .featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 26px;
  padding: 0;
  margin: 0 0 64px;
  list-style: none;
}

.featured-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.card:hover {
  transform: translateY(-5px);
  border-color: rgba(95, 208, 245, 0.45);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5), 0 0 24px rgba(95, 208, 245, 0.08);
  background: var(--bg-card-hover);
}

.card .thumb {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
  background: #0d1526;
  position: relative;
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.4s ease;
}

.card:hover .thumb img { transform: scale(1.04); }

/* featured (social) thumbs: portrait ratio, never cropped — the whole
   image is shown (letterboxed on the dark card if ratios differ) */
.feat-thumb { aspect-ratio: 4 / 5; }
.card .feat-thumb img { object-fit: contain; object-position: center; }
.card:hover .feat-thumb img { transform: none; }
.feat-thumb .feat-ph { display: none; }

.feat-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(400px 260px at 20% 0%, rgba(95, 208, 245, 0.12), transparent 60%),
    radial-gradient(400px 260px at 85% 100%, rgba(242, 177, 52, 0.12), transparent 60%),
    #0d1526;
}

.feat-thumb.placeholder .feat-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.5;
}

.feat-thumb.placeholder .feat-ph svg { width: 34px; height: 34px; fill: var(--muted); }

.card .card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }

.chip {
  align-self: flex-start;
  font-family: var(--font-head);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(242, 177, 52, 0.4);
  border-radius: 999px;
  padding: 3px 11px;
  margin-bottom: 12px;
}

.chip.ig-chip { display: inline-flex; align-items: center; gap: 6px; }
.chip.ig-chip svg { width: 12px; height: 12px; fill: var(--gold); }

.card .card-title {
  font-family: var(--font-head);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 6px;
  color: var(--text);
}

.card .card-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 10px; }
.card .card-desc { font-size: 0.92rem; color: #c4cdde; margin: 0 0 16px; flex: 1; }

.card .card-links { display: flex; flex-wrap: wrap; gap: 8px 18px; font-family: var(--font-head); font-size: 0.86rem; }
.card .card-links a::after { content: " →"; }

/* ---------- click-to-play video embed ---------- */
.video-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: #000;
  cursor: pointer;
  margin: 0 0 16px;
}

.video-embed img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
  transition: opacity 0.25s ease, transform 0.3s ease;
}

.video-embed:hover img { opacity: 1; transform: scale(1.03); }

.video-embed .play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 38px;
  border-radius: 10px;
  background: rgba(6, 10, 20, 0.8);
  border: 1px solid rgba(242, 177, 52, 0.6);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.video-embed .play-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-40%, -50%);
  border-left: 14px solid var(--gold);
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
}

.video-embed:hover .play-btn { background: rgba(6, 10, 20, 0.95); border-color: var(--gold); }

.video-embed iframe { width: 100%; height: 100%; border: 0; }

/* ---------- news list ---------- */
.news-list { list-style: none; margin: 0 0 64px; padding: 0; }

.news-list li {
  display: grid;
  grid-template-columns: 150px 170px 1fr;
  gap: 22px;
  padding: 26px 0;
  border-bottom: 1px solid var(--rule);
  align-items: start;
}

.news-list li.no-thumb { grid-template-columns: 150px 1fr; }

.news-list .when {
  font-family: var(--font-head);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 4px;
}

.news-list .outlet { color: var(--gold); display: block; }

.news-thumb {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--rule);
  background: #0d1526;
}

.news-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.news-thumb:hover img { transform: scale(1.05); }

.news-list .news-title {
  font-family: var(--font-head);
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 6px;
}

.news-list .news-title a { color: var(--text); }
.news-list .news-title a:hover { color: var(--cyan); }
.news-list .news-desc { margin: 0; font-size: 0.94rem; color: #c4cdde; }

@media (max-width: 680px) {
  .news-list li, .news-list li.no-thumb { grid-template-columns: 1fr; gap: 10px; }
  .news-thumb { max-width: 320px; }
}

/* ---------- buttons + pdf ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--bg);
  background: linear-gradient(90deg, var(--cyan), #8fdcf8);
  border-radius: 999px;
  padding: 10px 22px;
  margin: 0 12px 12px 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover { color: var(--bg); transform: translateY(-2px); box-shadow: 0 8px 26px rgba(95, 208, 245, 0.3); }

.btn.gold { background: linear-gradient(90deg, var(--gold), #f8cf74); }
.btn.gold:hover { box-shadow: 0 8px 26px rgba(242, 177, 52, 0.3); }

.pdf-frame {
  width: 100%;
  height: 900px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  margin: 16px 0 40px;
  background: #0d1526;
}

@media (max-width: 640px) { .pdf-frame { height: 520px; } }

/* ---------- tabs (cv page) ---------- */
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--rule);
  margin-top: 26px;
}

.tab-btn {
  font-family: var(--font-head);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 18px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--gold); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---------- coursework table ---------- */
.course-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }

.course-stats .stat {
  font-family: var(--font-head);
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 16px;
}

.course-stats .stat strong { color: var(--gold); font-weight: 700; }

.course-controls { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; align-items: center; }

.course-controls input[type="search"],
.course-controls select {
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.course-controls input[type="search"] { flex: 1 1 240px; }
.course-controls select { flex: 0 1 auto; }
.course-controls input:focus, .course-controls select:focus { border-color: rgba(95, 208, 245, 0.5); }
.course-controls select:disabled { opacity: 0.35; cursor: not-allowed; }
.course-controls select option { background: #0d1526; }

/* segmented toggle: gt credit ↔ ap exams */
.seg-toggle {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px;
}

.seg-btn {
  font-family: var(--font-head);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.seg-btn:hover { color: var(--text); }

.seg-btn.active {
  color: var(--bg);
  background: linear-gradient(90deg, var(--gold), #f8cf74);
  font-weight: 700;
}

/* SAT strip — standardized testing, below the AP table, AP view only */
.sat-strip {
  display: none;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 22px;
  background: linear-gradient(90deg, rgba(242, 177, 52, 0.10), rgba(95, 208, 245, 0.06));
  border: 1px solid rgba(242, 177, 52, 0.35);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  padding: 14px 20px;
  margin-top: 20px;
}

.sat-strip.show { display: flex; }

.sat-strip .sat-label {
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.sat-strip .sat-score {
  font-family: var(--font-head);
  font-size: 1.15rem;
  color: var(--text);
}

.sat-strip .sat-score strong { color: var(--gold); font-size: 1.35rem; }
.sat-strip .sat-outof { color: var(--muted); font-size: 0.85rem; }
.sat-strip .sat-detail { color: var(--muted); font-size: 0.88rem; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--bg-card);
}

.course-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }

.course-table th {
  font-family: var(--font-head);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: #0d1526;
}

.course-table th:hover { color: var(--cyan); }
.course-table th.sort-asc::after  { content: " ↑"; color: var(--gold); }
.course-table th.sort-desc::after { content: " ↓"; color: var(--gold); }

.course-table td {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

.course-table .title-cell { white-space: normal; min-width: 200px; }
.course-table .title-cell .equiv { color: var(--muted); font-size: 0.85em; }
.course-table .sem-cell { color: var(--muted); font-size: 0.85rem; }
.course-table .num-col { text-align: right; }
.course-table tbody tr { transition: background 0.15s ease; }
.course-table tbody tr:hover { background: rgba(95, 208, 245, 0.06); }
.course-table tbody tr:last-child td { border-bottom: none; }

.course-link { border-bottom: 1px dotted rgba(95, 208, 245, 0.5); }
.course-link:hover { border-bottom-color: var(--gold); }

.grade {
  display: inline-block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 6px;
  padding: 2px 9px;
}

.grade-A, .grade-5 { color: var(--gold); background: rgba(242, 177, 52, 0.12); border: 1px solid rgba(242, 177, 52, 0.35); }
.grade-T, .grade-GT, .grade-4, .grade-Pass { color: var(--cyan); background: rgba(95, 208, 245, 0.10); border: 1px solid rgba(95, 208, 245, 0.3); }
.grade-V  { color: var(--muted); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--rule); }

/* ---------- footer ---------- */
footer {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  border-top: 1px solid var(--rule);
  background: rgba(6, 10, 20, 0.6);
  text-align: center;
  padding: 36px 0 48px;
  font-family: var(--font-head);
  font-size: 0.88rem;
  color: var(--muted);
}

.social {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-bottom: 16px;
}

.social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.social a:hover {
  color: var(--gold);
  border-color: rgba(242, 177, 52, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(242, 177, 52, 0.15);
}

.social svg { width: 20px; height: 20px; fill: currentColor; }

/* inline icon links (about page) */
.icon-link { display: inline-flex; align-items: center; gap: 7px; }
.icon-link svg { width: 17px; height: 17px; fill: currentColor; }

/* ---------- responsive hero ---------- */
@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; padding: 64px 0 40px; text-align: center; }
  .hero .sub { margin: 0 auto; }
  .cloud-wrap { order: -1; }
  #cloud { width: min(240px, 60vw); }
  nav.site-nav .links { gap: 14px; font-size: 0.85rem; }
}
