
/* Offline portfolio stylesheet. Edit colors and layout here. */
:root {
  --bg: #06101f;
  --panel: rgba(12, 23, 40, 0.82);
  --panel-strong: #0d1b2d;
  --line: rgba(110, 231, 255, 0.24);
  --text: #e7f6ff;
  --muted: #9db4c8;
  --accent: #6ee7ff;
  --accent-2: #34d399;
  --accent-3: #7c3aed;
  --danger: #f97316;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at top left, rgba(124, 58, 237, 0.16), transparent 32rem), var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}
body::selection { background: var(--accent); color: #06101f; }
a { color: inherit; }
img { max-width: 100%; display: block; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 999;
  background: var(--accent);
  color: #06101f;
  padding: .7rem 1rem;
  border-radius: 999px;
}
.skip-link:focus { top: 1rem; }

.animated-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url("assets/img/site_background.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: .88;
  animation: none;
}
.animated-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6,16,31,.12), rgba(6,16,31,.72));
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1.03); }
  to { transform: translate3d(-28px, 18px, 0) scale(1.08); }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem clamp(1rem, 3vw, 2rem);
  background: rgba(6, 16, 31, .78);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; font-weight: 800; }
.brand-mark {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 13px;
  color: #06101f; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 30px rgba(110,231,255,.35);
}
.brand-text { color: var(--muted); letter-spacing: .03em; }
.brand-avatar {
  display: block;
  object-fit: cover;
  object-position: center 22%;
  border: 1px solid rgba(110,231,255,.35);
  background: #091425;
  color: transparent;
}
.site-nav { display: flex; align-items: center; gap: .35rem; }
.site-nav a {
  text-decoration: none;
  color: var(--muted);
  padding: .6rem .8rem;
  border-radius: 999px;
  transition: color .2s, background .2s, transform .2s;
}
.site-nav a:hover, .site-nav a:focus { color: var(--text); background: rgba(110,231,255,.09); transform: translateY(-1px); }
.nav-toggle { display: none; }

.section, .hero {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 7rem) 0;
}
.section-grid {
  min-height: calc(100svh - 72px);
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: clamp(2rem, 5vw, 5rem);
}
.eyebrow {
  color: var(--accent-2);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .15em;
  font-size: .78rem;
  margin: 0 0 .9rem;
}
h1, h2, h3 { line-height: 1.08; margin-top: 0; }
h1 {
  font-size: clamp(3rem, 9vw, 6.8rem);
  margin-bottom: .6rem;
  letter-spacing: -.06em;
}
.hero h2 { color: var(--muted); font-size: clamp(1.15rem, 2.4vw, 1.55rem); font-weight: 650; max-width: 760px; }
.tagline, .lead { font-size: clamp(1.1rem, 2vw, 1.32rem); color: #d6e9f5; max-width: 850px; }
.contact-line { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.4rem 0 1.8rem; color: var(--muted); }
.contact-line span { border: 1px solid var(--line); border-radius: 999px; padding: .45rem .75rem; background: rgba(7,17,31,.55); }
.hero-actions, .section-actions { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.section-actions { margin-top: 2rem; }
.btn, .small-btn {
  border: 1px solid var(--line);
  background: rgba(12, 23, 40, .72);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  border-radius: 999px;
  padding: .85rem 1.05rem;
  font: inherit;
  font-weight: 750;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.btn:hover, .btn:focus, .small-btn:hover, .small-btn:focus { transform: translateY(-2px); border-color: rgba(110,231,255,.65); box-shadow: 0 0 28px rgba(110,231,255,.16); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #06101f; border: 0; }
.small-btn { padding: .45rem .72rem; font-size: .86rem; }
.updated { color: var(--muted); font-size: .92rem; margin-top: 1.2rem; }

.terminal-card {
  border: 1px solid rgba(110,231,255,.28);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(14, 30, 54, .92), rgba(7,17,31,.88));
  box-shadow: var(--shadow), inset 0 0 50px rgba(110,231,255,.05);
  min-height: 420px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-schematic {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.terminal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 10, 20, .1), rgba(4, 10, 20, .34) 42%, rgba(4, 10, 20, .84)),
    repeating-linear-gradient(0deg, transparent 0 16px, rgba(110,231,255,.03) 17px 18px);
  pointer-events: none;
}
.terminal-overlay {
  position: relative;
  z-index: 1;
  width: min(90%, 430px);
  margin: 0;
  border: 1px solid rgba(110,231,255,.34);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(5, 14, 27, .92);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 46px rgba(0,0,0,.34), 0 0 28px rgba(110,231,255,.10), inset 0 0 24px rgba(124,58,237,.08);
}
.terminal-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 31px, rgba(110,231,255,.05) 32px, transparent 33px),
    linear-gradient(0deg, transparent 0 31px, rgba(110,231,255,.04) 32px, transparent 33px);
  background-size: 64px 64px;
  opacity: .32;
  pointer-events: none;
}
.terminal-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2, 8, 18, .06), rgba(2, 8, 18, .20));
  pointer-events: none;
}
.terminal-top { position: relative; z-index: 1; display: flex; gap: .45rem; padding: 1rem; border-bottom: 1px solid rgba(110,231,255,.18); background: rgba(4, 10, 22, .54); }
.terminal-top span { width: .78rem; height: .78rem; border-radius: 999px; background: var(--accent-2); }
.terminal-top span:nth-child(2) { background: var(--danger); }
.terminal-top span:nth-child(3) { background: var(--accent); }
.terminal-card pre { position: relative; z-index: 1; margin: 0; padding: 1.25rem; min-height: 170px; white-space: pre-wrap; color: #d4fff4; text-shadow: 0 0 8px rgba(52,211,153,.10); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95rem; }

.section-heading { max-width: 880px; margin-bottom: 2rem; }
.section-heading h2 { font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.04em; }
.muted { color: var(--muted); }

.skills-grid, .resume-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.skill-card, .resume-card, .glass-panel, .contact-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: 0 14px 55px rgba(0,0,0,.19);
}
.skill-card h3, .resume-card h3 { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: .55rem; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: .35rem .62rem;
  background: rgba(110,231,255,.08);
  border: 1px solid rgba(110,231,255,.18);
  color: #d8f8ff;
  font-size: .88rem;
  animation: chipPulse 6s ease-in-out infinite;
}
.chip:nth-child(3n) { animation-delay: 1.2s; }
.chip:nth-child(4n) { animation-delay: 2.1s; }
@keyframes chipPulse { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 18px rgba(110,231,255,.16); } }

.filters { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: 1.3rem; }
.filter-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .55rem .85rem;
  background: rgba(7,17,31,.64);
  color: var(--muted);
  cursor: pointer;
  font-weight: 750;
}
.filter-btn.active, .filter-btn:hover, .filter-btn:focus { color: #06101f; background: var(--accent); border-color: transparent; }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.project-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(12,23,40,.84);
  box-shadow: 0 18px 60px rgba(0,0,0,.22);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.project-card:hover { transform: translateY(-5px); border-color: rgba(110,231,255,.58); box-shadow: 0 0 50px rgba(110,231,255,.14); }
.project-card img { display: block; width: 100%; aspect-ratio: 16 / 8.5; object-fit: contain; object-position: center; background: #07111f; image-rendering: auto; }
.project-body { padding: 1.1rem; }
.project-body h3 { font-size: 1.3rem; }
.project-body p { color: var(--muted); }
.project-footer { display: flex; justify-content: space-between; gap: .8rem; align-items: center; margin-top: 1rem; }
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { font-size: .77rem; color: #c7f7ff; border: 1px solid rgba(52,211,153,.24); border-radius: 999px; padding: .22rem .48rem; background: rgba(52,211,153,.08); }

.code-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 17, 31, .94);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.code-tabs { display: flex; flex-wrap: wrap; gap: .4rem; overflow-x: visible; padding: .75rem; border-bottom: 1px solid var(--line); }
.code-tab {
  flex: 0 0 auto;
  border: 1px solid rgba(110,231,255,.18);
  border-radius: 999px;
  background: rgba(110,231,255,.06);
  color: var(--muted);
  padding: .52rem .72rem;
  cursor: pointer;
  font-weight: 700;
}
.code-tab[aria-selected="true"] { color: #06101f; background: var(--accent-2); }
.code-toolbar { display: flex; justify-content: space-between; gap: .8rem; align-items: center; padding: .75rem 1rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.code-panel { margin: 0; max-height: 620px; overflow: auto; padding: 1.1rem; color: #d6f7ff; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; line-height: 1.55; tab-size: 2; }

.split { display: grid; grid-template-columns: .9fr 1.1fr; gap: 1rem; align-items: start; }
.resume-grid { grid-template-columns: .7fr 1.15fr 1.15fr; }
.contact-section { padding-bottom: 4rem; }
.contact-card { max-width: 760px; }
.site-footer { text-align: center; color: var(--muted); padding: 2rem 1rem 3rem; border-top: 1px solid var(--line); background: rgba(6,16,31,.72); }

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 6, 14, .76);
  backdrop-filter: blur(12px);
}
.modal {
  width: min(980px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  border-radius: 28px;
  border: 1px solid rgba(110,231,255,.35);
  background: #07111f;
  box-shadow: 0 40px 110px rgba(0,0,0,.52);
  position: relative;
}
.modal-close {
  position: sticky;
  top: .8rem;
  float: right;
  z-index: 1;
  margin: .8rem;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(12,23,40,.9);
  color: var(--text);
  cursor: pointer;
  font-size: 1.7rem;
}
/* Details modal images should show the full thumbnail/flowchart.
   Do not crop or zoom them like the small project-card previews. */
.modal-hero {
  background: #f4f4f4;
  padding: clamp(.5rem, 1.4vw, 1rem);
  border-bottom: 1px solid var(--line);
}
.modal-hero img {
  width: 100%;
  height: auto;
  max-height: 72vh;
  object-fit: contain;
  object-position: center;
  background: #f4f4f4;
  border-bottom: 0;
  transform: none !important;
}
.modal-body { padding: clamp(1rem, 3vw, 2rem); }
.modal-body h2 { font-size: clamp(1.8rem, 4vw, 3rem); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1.2rem 0; }
.detail-box { border: 1px solid var(--line); border-radius: 18px; padding: 1rem; background: rgba(110,231,255,.04); }
.detail-box h3 { color: var(--accent); margin-bottom: .55rem; }
.detail-box ul { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.modal-code-links { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }

.reveal { opacity: 0; transform: translateY(16px); transition: opacity .65s ease, transform .65s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(12,23,40,.72);
    color: var(--text);
    font-size: 1.2rem;
  }
  .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: .75rem 1rem 1rem;
    background: rgba(6,16,31,.96);
    border-bottom: 1px solid var(--line);
  }
  .site-nav.open { display: flex; }
  .section-grid, .split { grid-template-columns: 1fr; }
  .skills-grid, .project-grid, .resume-grid, .detail-grid { grid-template-columns: 1fr; }
  .terminal-card { min-height: 280px; }
}

@media (max-width: 560px) {
  .section, .hero { width: min(100% - 1rem, 1160px); padding: 3rem 0; }
  .hero-actions { align-items: stretch; }
  .btn { width: 100%; text-align: center; }
  .code-toolbar { flex-direction: column; align-items: flex-start; }
  .brand-text { display: none; }
}

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

@media print {
  :root { --text: #111827; --muted: #374151; --bg: #ffffff; --panel: #ffffff; --line: #d1d5db; }
  body { background: #fff; color: #111827; font-size: 11pt; }
  .animated-bg, .site-header, .hero-actions, .filters, .code-shell, .modal-backdrop, .site-footer, .terminal-card { display: none !important; }
  .section, .hero { width: 100%; padding: 1rem 0; page-break-inside: avoid; }
  .section-grid, .split, .skills-grid, .project-grid, .resume-grid { display: block; }
  .project-card, .skill-card, .resume-card, .glass-panel, .contact-card { box-shadow: none; border: 1px solid #d1d5db; margin-bottom: .7rem; background: #fff; }
  .project-card img { display: none; }
  a { color: #111827; text-decoration: none; }
  h1 { font-size: 32pt; }
  h2 { font-size: 18pt; }
  .reveal { opacity: 1; transform: none; }
}


/* ---------- Phone/mobile layout stabilization ---------- */
@media (max-width: 900px) {
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  * { box-sizing: border-box; }

  img, video, canvas, svg {
    max-width: 100%;
  }

  .site-header {
    padding: .65rem .9rem;
    min-height: 64px;
    gap: .6rem;
  }

  .brand {
    min-width: 0;
    gap: .55rem;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    flex: 0 0 38px;
  }

  .brand-avatar {
    object-fit: cover;
    object-position: center 22%;
  }

  .brand-text {
    font-size: .95rem;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-toggle {
    display: inline-grid !important;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-left: auto;
    border-radius: 12px;
    border: 1px solid rgba(110,231,255,.24);
    background: rgba(110,231,255,.08);
    color: var(--text);
    cursor: pointer;
    z-index: 1002;
  }

  .site-nav {
    position: fixed;
    top: 72px;
    left: 1rem;
    right: 1rem;
    display: none !important;
    flex-direction: column;
    align-items: stretch;
    gap: .35rem;
    padding: .8rem;
    border: 1px solid rgba(110,231,255,.28);
    border-radius: 18px;
    background: rgba(5, 14, 27, .98);
    backdrop-filter: blur(18px);
    box-shadow: 0 24px 60px rgba(0,0,0,.45);
    z-index: 1001;
  }

  .site-nav.open,
  .site-nav.is-open {
    display: flex !important;
  }

  .site-nav a {
    display: block;
    width: 100%;
    padding: .82rem .95rem;
    text-align: left;
  }

  .section {
    padding: 3.25rem 1rem;
  }

  .hero {
    padding-top: 3.5rem;
  }

  .hero-grid,
  .section-grid,
  .split,
  .resume-grid,
  .skills-grid,
  .project-grid,
  .detail-grid,
  .contact-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 1rem !important;
  }

  .hero h1,
  .section h2 {
    font-size: clamp(2.05rem, 11vw, 3.5rem);
    line-height: 1.05;
    letter-spacing: -.04em;
    overflow-wrap: break-word;
  }

  .lead,
  .muted,
  p,
  li {
    overflow-wrap: anywhere;
  }

  .hero-actions,
  .resume-actions,
  .contact-actions,
  .modal-code-links,
  .project-footer {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
  }

  .btn,
  .small-btn {
    min-height: 44px;
    white-space: normal;
  }

  .terminal-card {
    min-height: 300px;
    margin-top: 1rem;
  }

  .terminal-overlay {
    width: calc(100% - 2rem);
    left: 1rem;
    right: 1rem;
    border-radius: 18px;
  }

  .terminal-card pre {
    font-size: .76rem;
    padding: .9rem;
    line-height: 1.55;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
  }

  .project-card {
    min-width: 0;
  }

  .project-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: contain;
    background: rgba(6,16,31,.78);
  }

  .resume-card,
  .skill-card,
  .project-card,
  .glass-panel,
  .contact-card {
    min-width: 0;
    border-radius: 20px;
  }

  .filters,
  .code-tabs,
  .tag-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: .45rem;
    padding-bottom: .45rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .filter-btn,
  .code-tab,
  .tag {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .code-shell {
    margin-inline: -1rem;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    max-width: calc(100% + 2rem);
  }

  pre,
  code,
  .code-output,
  .code-panel pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre;
    font-size: .75rem;
    -webkit-overflow-scrolling: touch;
  }

  .modal-backdrop {
    padding: .75rem;
  }

  .modal {
    width: min(94vw, 760px);
    max-height: 88vh;
    border-radius: 20px;
    overflow: auto;
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-hero,
  .modal-hero img {
    max-height: 240px;
    object-fit: contain;
  }

  .modal-top h2,
  .modal h2 {
    font-size: 1.35rem;
    line-height: 1.15;
  }

  .site-footer {
    padding-inline: 1rem;
    text-align: center;
    font-size: .88rem;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding-inline: .75rem;
  }

  .brand-text {
    max-width: 36vw;
  }

  .section {
    padding: 2.8rem .85rem;
  }

  .hero h1,
  .section h2 {
    font-size: clamp(1.9rem, 12vw, 3rem);
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .small-btn {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
  }

  .terminal-card {
    min-height: 280px;
  }

  .terminal-card pre {
    font-size: .7rem;
  }

  .contact-line {
    align-items: flex-start;
  }

  .contact-line span,
  .contact-line a {
    overflow-wrap: anywhere;
  }
}




/* ---------- Mobile project visibility fix ---------- */
@media (max-width: 900px) {
  #projects {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  #projectGrid,
  .project-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  #projectGrid .project-card,
  .project-grid .project-card {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
  }

  #projectGrid .project-card img,
  .project-grid .project-card img {
    display: block !important;
    width: 100% !important;
    max-height: 220px !important;
    object-fit: contain !important;
  }

  .project-body,
  .project-card-body {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .project-footer {
    align-items: center;
  }
}



/* ---------- Mobile modal layout fix ---------- */
.modal {
  position: relative;
}

.modal-close {
  position: absolute;
  top: .9rem;
  right: .9rem;
  float: none;
  margin: 0;
}

#modalContent {
  display: block;
  clear: both;
}

.modal-hero {
  overflow: hidden;
}

.modal-hero img {
  display: block;
}

@media (max-width: 900px) {
  .modal {
    width: min(94vw, 760px);
    max-height: 88vh;
    overflow: auto;
    padding-top: 0;
  }

  .modal-close {
    top: .7rem;
    right: .7rem;
    width: 46px;
    height: 46px;
  }

  .modal-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .75rem .75rem .5rem;
    max-height: none;
    overflow: hidden;
  }

  .modal-hero img {
    width: 100%;
    height: auto;
    max-height: min(40vh, 300px) !important;
    object-fit: contain !important;
    object-position: center top;
  }

  .modal-body {
    clear: both;
    padding: 1rem;
  }

  .modal-body .eyebrow,
  .modal-body h2,
  .modal-body .lead {
    position: relative;
    z-index: 0;
  }
}

@media (max-width: 480px) {
  .modal-hero img {
    max-height: min(34vh, 260px) !important;
  }
}


/* ---------- Apple-like motion and mobile-only layout ---------- */
:root {
  --ease-apple: cubic-bezier(.22, 1, .36, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.site-header,
.project-card,
.resume-card,
.skill-card,
.glass-panel,
.contact-card,
.code-shell,
.modal,
.btn,
.small-btn,
.filter-btn,
.code-tab {
  transition:
    transform .42s var(--ease-apple),
    opacity .42s var(--ease-apple),
    border-color .42s var(--ease-apple),
    background .42s var(--ease-apple),
    box-shadow .42s var(--ease-apple);
}

.project-card:hover,
.resume-card:hover,
.skill-card:hover,
.glass-panel:hover,
.contact-card:hover {
  transform: translateY(-6px) scale(1.008);
}

.btn:active,
.small-btn:active,
.filter-btn:active,
.code-tab:active {
  transform: scale(.97);
}

.reveal {
  opacity: 0;
  transform: translateY(24px) scale(.985);
  transition: opacity .8s var(--ease-apple), transform .8s var(--ease-apple);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

.modal-backdrop {
  animation: backdropFade .34s var(--ease-apple) both;
}

.modal {
  animation: modalRise .46s var(--ease-apple) both;
}

@keyframes backdropFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalRise {
  from { opacity: 0; transform: translateY(28px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.mobile-dock {
  display: none;
}

/* Phone layout: intentionally different from desktop */
@media (max-width: 760px) {
  body {
    padding-bottom: 86px;
    background:
      radial-gradient(circle at 50% -10%, rgba(91,255,221,.16), transparent 36rem),
      radial-gradient(circle at 10% 35%, rgba(110,231,255,.10), transparent 26rem),
      #06101f;
  }

  .animated-bg {
    opacity: .58;
    background-size: cover;
    background-position: center top;
  }

  .site-header {
    top: .65rem;
    left: .75rem;
    right: .75rem;
    width: auto;
    min-height: 58px;
    border: 1px solid rgba(110,231,255,.22);
    border-radius: 24px;
    background: rgba(7, 17, 31, .72);
    backdrop-filter: blur(22px) saturate(1.25);
    box-shadow: 0 18px 55px rgba(0,0,0,.28);
  }

  .brand-text {
    color: var(--text);
    font-weight: 900;
  }

  .nav-toggle {
    display: none !important;
  }

  .site-nav {
    display: none !important;
  }

  .mobile-dock {
    position: fixed;
    left: 50%;
    bottom: max(.8rem, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 1200;
    width: min(92vw, 430px);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .35rem;
    padding: .45rem;
    border: 1px solid rgba(110,231,255,.24);
    border-radius: 999px;
    background: rgba(7, 17, 31, .80);
    backdrop-filter: blur(26px) saturate(1.35);
    box-shadow: 0 22px 70px rgba(0,0,0,.45);
  }

  .mobile-dock a {
    min-height: 44px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 900;
    font-size: .78rem;
    letter-spacing: .01em;
    transition: background .35s var(--ease-apple), color .35s var(--ease-apple), transform .35s var(--ease-apple);
  }

  .mobile-dock a:active {
    transform: scale(.94);
    background: rgba(91,255,221,.18);
    color: var(--text);
  }

  .section {
    padding: 3.1rem 1rem;
  }

  .hero {
    padding-top: 7.2rem;
    min-height: auto;
  }

  .hero-grid {
    display: flex !important;
    flex-direction: column;
    gap: 1.2rem !important;
  }

  .hero h1 {
    font-size: clamp(2.55rem, 15vw, 4.5rem);
    line-height: .94;
    letter-spacing: -.075em;
  }

  .hero .eyebrow {
    font-size: .72rem;
    letter-spacing: .18em;
  }

  .lead {
    font-size: 1.04rem;
    line-height: 1.75;
  }

  .hero-actions {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: .75rem;
  }

  .btn {
    width: 100%;
    justify-content: center;
    border-radius: 18px;
    padding: .95rem 1rem;
  }

  .terminal-card {
    min-height: 250px;
    border-radius: 28px;
    overflow: hidden;
    transform: none !important;
  }

  .terminal-overlay {
    width: calc(100% - 1.4rem);
    left: .7rem;
    right: .7rem;
    bottom: .7rem;
    border-radius: 22px;
    background: rgba(7, 17, 31, .76);
    backdrop-filter: blur(18px);
  }

  .terminal-card pre {
    white-space: pre-wrap;
    font-size: .72rem;
    min-height: 120px;
  }

  .section-heading {
    margin-bottom: 1.15rem;
  }

  .section h2 {
    font-size: clamp(2.05rem, 11vw, 3.15rem);
    line-height: 1;
    letter-spacing: -.06em;
  }

  .skills-grid,
  .resume-grid,
  .project-grid,
  .detail-grid,
  .contact-grid,
  .section-grid,
  .split {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: .95rem !important;
  }

  .skill-card,
  .resume-card,
  .glass-panel,
  .contact-card {
    border-radius: 26px;
    background: rgba(8, 20, 38, .72);
    backdrop-filter: blur(14px);
  }

  .project-grid {
    gap: 1.15rem !important;
  }

  .project-card {
    border-radius: 30px;
    overflow: hidden;
    background: rgba(8, 20, 38, .76);
    backdrop-filter: blur(16px);
    box-shadow: 0 24px 80px rgba(0,0,0,.30);
  }

  .project-card img {
    aspect-ratio: 16 / 11;
    max-height: 250px !important;
    object-fit: contain !important;
    background: linear-gradient(145deg, rgba(245,248,252,.97), rgba(220,232,240,.98));
  }

  .project-body {
    padding: 1rem;
  }

  .project-body h3 {
    font-size: 1.28rem;
    line-height: 1.12;
    letter-spacing: -.035em;
  }

  .project-footer {
    display: grid !important;
    grid-template-columns: 1fr;
  }

  .small-btn {
    width: 100%;
    border-radius: 16px;
    justify-content: center;
  }

  .filters,
  .code-tabs,
  .tag-row {
    display: flex;
    flex-wrap: nowrap !important;
    gap: .45rem;
    overflow-x: auto;
    padding: .15rem .05rem .6rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .filter-btn,
  .code-tab,
  .tag {
    flex: 0 0 auto;
    scroll-snap-align: start;
    border-radius: 999px;
  }

  .code-shell {
    margin-inline: -1rem;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  pre,
  code,
  .code-output,
  .code-panel pre {
    font-size: .72rem;
    line-height: 1.7;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
    background: rgba(2, 6, 14, .62);
  }

  .modal {
    width: 100vw;
    max-height: 90vh;
    border-radius: 30px 30px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    animation: mobileSheetUp .52s var(--ease-apple) both;
  }

  @keyframes mobileSheetUp {
    from { opacity: 0; transform: translateY(38px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .modal-close {
    top: .85rem;
    right: 1rem;
    width: 48px;
    height: 48px;
    z-index: 10;
    background: rgba(7, 17, 31, .88);
    backdrop-filter: blur(16px);
  }

  .modal-hero {
    padding: 1rem 1rem .35rem;
    border-radius: 30px 30px 0 0;
  }

  .modal-hero img {
    max-height: 32vh !important;
    border-radius: 18px;
  }

  .modal-body {
    padding: 1rem 1rem 1.5rem;
  }

  .modal-body h2 {
    font-size: clamp(1.65rem, 8vw, 2.4rem);
    line-height: 1.02;
    letter-spacing: -.055em;
  }

  .detail-box {
    border-radius: 22px;
    padding: 1.05rem;
  }

  .site-footer {
    padding-bottom: 6rem;
  }
}

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

