/* =========================================================
   Seiri Tech: stylesheet
   Edit the colors and fonts in :root to re-theme the site.
   Background images live in the /images folder. Replace them
   with your own photos by changing the url(...) values below.
   ========================================================= */

   :root {
    --midnight: #0a1230;
    --navy: #0f1b45;
    --blue: #2f66f0;
    --blue-bright: #5b8cff;
    --cyan: #22d3ee;
    --violet: #8b7cff;
  
    --mist: #e7edfb;
    --paper: #f3f6fc;
    --white: #ffffff;
    --ink: #0d1633;
    --muted: #4f5f82;
    --muted-dark: #a9b6d6;
    --line: #d3dbec;
    --line-dark: rgba(140, 165, 255, 0.22);
  
    --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
    --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  
    --header-h: 4rem;     /* header height */
    --logo-h: 4.5rem;     /* logo height. Change this number to resize the logo */
  }
  
  *,
  *::before,
  *::after { box-sizing: border-box; }
  
  /* Big screens: everything is sized in rem, so raising the root size
     scales the whole site up instead of leaving empty space at the sides */
  @media (min-width: 1600px) { html { font-size: 112.5%; } }
  @media (min-width: 1920px) { html { font-size: 125%; } }
  @media (min-width: 2560px) { html { font-size: 150%; } }
  
  html {
    scroll-padding-top: var(--header-h);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  
  @media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
  }
  
  body {
    margin: 0;
    overflow-x: clip; /* stops accidental sideways scrolling on phones */
    -webkit-tap-highlight-color: transparent;
    background: var(--midnight);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }
  
  h1, h2, h3, h4 {
    font-family: var(--font-display);
    line-height: 1.12;
    margin: 0;
    letter-spacing: -0.02em;
  }
  
  p { margin: 0; }
  a { color: inherit; }
  ul, ol { margin: 0; padding: 0; list-style: none; }
  
  :focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 3px;
    border-radius: 4px;
  }
  
  .container {
    width: min(76rem, 100% - 2.5rem);
    margin-inline: auto;
  }
  
  .sr-only {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  
  /* ---------- Buttons ---------- */
  .btn {
    display: inline-block;
    padding: 0.8rem 1.4rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    border: 2px solid transparent;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
  }
  .btn-primary { background: var(--blue); color: #fff; }
  .btn-primary:hover { background: #1f52d6; box-shadow: 0 0 24px rgba(47, 102, 240, 0.55); }
  .btn-outline { border-color: rgba(231, 237, 251, 0.4); color: var(--mist); }
  .btn-outline:hover { border-color: var(--cyan); color: var(--cyan); }
  
  /* ---------- Scroll reveal (applies only when JS is running) ---------- */
  .js .reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: calc(var(--d, 0) * 100ms);
  }
  .js .reveal.is-visible { opacity: 1; transform: none; }
  
  .js .project.reveal {
    transform: none;
    transition: opacity 0.7s ease, border-color 0.25s, box-shadow 0.25s;
    transition-delay: calc(var(--d, 0) * 100ms), 0s, 0s;
  }
  
  /* ---------- Header ---------- */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    background: #000c3dcc;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line-dark);
    color: var(--mist);
  }
  
  .nav {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: #fff;
  }
  .brand-mark { width: 1.875rem; height: 1.875rem; color: var(--cyan); }
  
  /* NEW: the Seiri logo image in the nav bar. Resize it with --logo-h in :root */
  .brand-logo {
    height: var(--logo-h);
    width: auto;
    display: block;
  }
  
  .brand-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.03em;
  }
  
  .nav-links { display: flex; gap: 0.3rem; }
  
  .nav-link {
    padding: 0.5rem 0.95rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    color: var(--muted-dark);
    transition: color 0.2s, background-color 0.2s;
  }
  .nav-link:hover { color: #fff; background: rgba(91, 140, 255, 0.14); }
  .nav-link.is-active { color: #fff; background: rgba(91, 140, 255, 0.24); }
  
  .menu-toggle {
    display: none;
    width: 44px; height: 44px;
    border: 1px solid var(--line-dark);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    align-items: center;
    justify-content: center;
  }
  .menu-bars,
  .menu-bars::before,
  .menu-bars::after {
    display: block;
    width: 20px; height: 2px;
    background: var(--mist);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
  }
  .menu-bars { position: relative; }
  .menu-bars::before,
  .menu-bars::after { content: ""; position: absolute; left: 0; }
  .menu-bars::before { top: -6px; }
  .menu-bars::after { top: 6px; }
  
  .nav-open .menu-bars { background: transparent; }
  .nav-open .menu-bars::before { top: 0; transform: rotate(45deg); }
  .nav-open .menu-bars::after { top: 0; transform: rotate(-45deg); }
  
  /* Reading progress line under the header */
  .progress {
    position: absolute;
    left: 0; bottom: -1px;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, var(--blue-bright), var(--cyan));
    transform-origin: left;
    transform: scaleX(0);
  }
  
  /* ---------- Hero ---------- */
  .hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(4rem, 9vw, 7rem);
    background: var(--midnight) url("images/hero-bg.svg") center / cover no-repeat;
    color: var(--mist);
  }
  
  /* Slowly drifting glows */
  .hero::before,
  .hero::after {
    content: "";
    position: absolute;
    z-index: 0;
    width: 460px; height: 460px;
    border-radius: 50%;
    pointer-events: none;
  }
  .hero::before {
    top: -140px; left: -120px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.22), transparent 65%);
    animation: drift 16s ease-in-out infinite alternate;
  }
  .hero::after {
    right: -140px; bottom: -160px;
    background: radial-gradient(circle, rgba(139, 124, 255, 0.28), transparent 65%);
    animation: drift 20s ease-in-out infinite alternate-reverse;
  }
  @keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(90px, 60px) scale(1.2); }
  }
  
  #network {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    z-index: 1;
    pointer-events: none;
  }
  
  .hero-grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
  }
  
  .hero h1 {
    font-size: clamp(2.3rem, 5vw, 4.1rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.06;
    color: #fff;
    max-width: 17ch;
  }
  
  .lead {
    margin-top: 1.4rem;
    max-width: 46ch;
    font-size: 1.2rem;
    color: var(--muted-dark);
  }
  
  .typed-line {
    margin-top: 1.4rem;
    font-family: var(--font-mono);
    font-size: 1.05rem;
    color: var(--mist);
    min-height: 1.7em;
  }
  .typed { color: var(--cyan); }
  .caret {
    display: inline-block;
    width: 2px; height: 1.1em;
    margin-left: 3px;
    vertical-align: text-bottom;
    background: var(--cyan);
    animation: blink 1s steps(1) infinite;
  }
  @keyframes blink { 50% { opacity: 0; } }
  
  .hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 2rem;
  }
  
  /* Terminal */
  .terminal {
    background: rgba(8, 14, 38, 0.82);
    border: 1px solid var(--line-dark);
    border-radius: 12px;
    box-shadow: 0 0 0 1px rgba(91, 140, 255, 0.08), 0 30px 70px -20px rgba(47, 102, 240, 0.55);
    backdrop-filter: blur(6px);
    animation: float 7s ease-in-out infinite;
  }
  @keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }
  
  .term-bar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--line-dark);
  }
  .dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(169, 182, 214, 0.35); }
  .term-title {
    margin-left: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted-dark);
  }
  
  .term-body {
    min-height: 15rem;
    padding: 1.25rem 1.25rem 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    line-height: 1.9;
    color: var(--mist);
  }
  .t-prompt { color: var(--blue-bright); }
  .t-ok { color: var(--cyan); }
  
  /* ---------- Sections ---------- */
  .section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
  
  .section-head { margin-bottom: 2rem; }
  .section-head h2,
  .about-intro h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
  }
  
  /* ---------- About ---------- */
  .about,
  .contact {
    background: var(--paper) url("images/circuit-tile.svg") top left / 240px 240px repeat;
    color: var(--ink);
  }
  
  .about-intro {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: clamp(1.5rem, 5vw, 4rem);
    align-items: end;
    margin-bottom: clamp(2rem, 5vw, 3rem);
  }
  .about-text p { color: var(--muted); max-width: 60ch; }
  .about-text p + p { margin-top: 0.9rem; }
  .about-text strong { color: var(--ink); }
  
  .acronym {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
    gap: 1rem;
  }
  .acro {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.5rem 1.25rem 1.6rem;
    transition: border-color 0.25s, box-shadow 0.25s;
  }
  .acro:hover {
    border-color: var(--blue-bright);
    box-shadow: 0 16px 36px -16px rgba(47, 102, 240, 0.45);
  }
  .acro-letter {
    display: block;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 3.6rem;
    line-height: 1;
    color: var(--blue);
    margin-bottom: 0.9rem;
  }
  .acro h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }
  .acro p { font-size: 0.97rem; color: var(--muted); }
  
  /* Contact + map */
  .find-us {
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: 1.5rem;
    align-items: stretch;
  }
  .contact .section-head p { margin-top: 0.6rem; color: var(--muted); }
  
  .contact-card {
    background: var(--midnight) url("images/hero-bg.svg") center / cover no-repeat;
    color: var(--mist);
    border-radius: 14px;
    padding: clamp(1.5rem, 3vw, 2.25rem);
  }
  .contact-card h3 { color: #fff; font-size: 1.6rem; margin-bottom: 1.5rem; }
  
  .contact-list { display: grid; gap: 1.1rem; }
  .contact-list li { display: flex; gap: 0.9rem; align-items: flex-start; }
  .contact-list strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--muted-dark);
  }
  .contact-list span,
  .contact-list a { color: #fff; text-decoration: none; word-break: break-word; }
  .contact-list a:hover { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }
  
  .ci {
    flex: none;
    width: 40px; height: 40px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(91, 140, 255, 0.16);
    color: var(--cyan);
  }
  .ci svg {
    width: 20px; height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  
  .contact-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.75rem; }
  
  .map-wrap {
    min-height: 23.75rem;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--white);
    box-shadow: 0 24px 50px -28px rgba(13, 22, 51, 0.5);
  }
  .map-wrap iframe {
    display: block;
    width: 100%; height: 100%;
    min-height: 23.75rem;
    border: 0;
  }
  
  /* ---------- Projects ---------- */
  .projects {
    background: var(--midnight) url("images/projects-bg.svg") center / cover no-repeat;
    color: var(--mist);
  }
  .projects .section-head h2 { color: #fff; }
  .projects .section-head p { margin-top: 0.6rem; color: var(--muted-dark); }
  
  .toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-width: 0;
  }
  
  /* Prev / next arrows */
  .arrows { display: flex; gap: 0.5rem; margin-left: auto; }
  .arrows[hidden] { display: none; }
  .arrow {
    width: 44px; height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-dark);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--mist);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, opacity 0.2s;
  }
  .arrow svg {
    width: 20px; height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .arrow:hover:not(:disabled) { background: var(--blue); border-color: var(--blue); color: #fff; }
  .arrow:disabled { opacity: 0.35; cursor: default; }
  .filter {
    padding: 0.45rem 1rem;
    border: 1px solid var(--line-dark);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--mist);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
  }
  .filters[hidden] { display: none; }
  .filter:hover { border-color: var(--blue-bright); }
  .filter[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
  
  .project-grid {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 0.5rem 0.25rem 1.5rem;
    margin-inline: -0.25rem;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--blue) rgba(255, 255, 255, 0.08);
  }
  .project-grid::-webkit-scrollbar { height: 8px; }
  .project-grid::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.06); border-radius: 8px; }
  .project-grid::-webkit-scrollbar-thumb { background: var(--blue); border-radius: 8px; }
  
  .project {
    flex: 0 0 min(21.25rem, 86%);
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    background: rgba(15, 27, 69, 0.78);
    border: 1px solid var(--line-dark);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.25s, box-shadow 0.25s;
  }
  .project.is-clickable { cursor: pointer; }
  .project:hover {
    border-color: var(--blue-bright);
    box-shadow: 0 0 0 1px rgba(91, 140, 255, 0.35), 0 22px 44px -20px rgba(47, 102, 240, 0.7);
  }
  
  .project-visual {
    aspect-ratio: 16 / 7;
    display: grid;
    place-items: center;
    overflow: hidden;
    background-image:
      linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 26px 26px;
    color: #fff;
  }
  .project-visual img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .project:hover .project-visual img,
  .project:hover .tile-letter { transform: scale(1.1); }
  
  .tile-letter {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 4.5rem;
    letter-spacing: -0.04em;
    text-shadow: 0 0 36px rgba(255, 255, 255, 0.45);
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .v0 { background-color: #1e47b8; }
  .v1 { background-color: #5a3fd0; }
  .v2 { background-color: #0b7f8c; }
  .v3 { background-color: #1b2c6b; }
  
  .project-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.25rem 1.25rem 1.4rem;
  }
  .project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
    color: var(--muted-dark);
  }
  .status {
    padding: 0.1rem 0.65rem;
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.14);
    color: var(--cyan);
    font-size: 0.82rem;
    font-weight: 700;
  }
  .project h3 { font-size: 1.35rem; color: #fff; margin-bottom: 0.5rem; }
  .project-desc { color: var(--muted-dark); font-size: 1rem; }
  
  .tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1rem;
  }
  .tech li {
    padding: 0.15rem 0.55rem;
    border: 1px solid var(--line-dark);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted-dark);
  }
  
  /* Button that opens the key features popup (sits at the bottom so every card lines up) */
  .features-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-height: 48px;
    margin-top: auto;
    padding: 0;
    border: 0;
    border-top: 1px solid var(--line-dark);
    background: none;
    color: var(--cyan);
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: color 0.2s;
  }
  .features-btn::after {
    content: "+";
    display: grid;
    place-items: center;
    width: 28px; height: 28px;
    border: 1px solid var(--line-dark);
    border-radius: 50%;
    font-size: 1.15rem;
    line-height: 1;
    transition: background-color 0.2s, color 0.2s, transform 0.3s;
  }
  .features-btn:hover { color: #fff; }
  .features-btn:hover::after { background: var(--blue); border-color: var(--blue); transform: rotate(90deg); }
  .tech { margin-bottom: 1.1rem; }
  .features-btn ~ .project-link { margin-top: 0; }
  
  .project-link { margin-top: 0; }
  .features summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
    cursor: pointer;
    list-style: none;
    font-weight: 700;
    color: var(--cyan);
  }
  .features summary::-webkit-details-marker { display: none; }
  .features summary::after {
    content: "+";
    font-size: 1.4rem;
    line-height: 1;
  }
  .features[open] summary::after { content: "\2212"; }
  .features summary:hover { color: #fff; }
  .features ul {
    display: grid;
    gap: 0.9rem;
    padding: 0.4rem 0 0.5rem;
  }
  .features li {
    position: relative;
    padding-left: 1.3rem;
    font-size: 0.93rem;
    line-height: 1.5;
    color: var(--mist);
  }
  .features li strong {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.98rem;
    color: #fff;
  }
  .features li span { display: block; color: var(--muted-dark); }
  .features li::before {
    content: "";
    position: absolute;
    left: 0; top: 0.55em;
    width: 8px; height: 8px;
    border-radius: 2px;
    background: var(--cyan);
  }
  
  .project-link {
    margin-top: auto;
    padding-top: 1.1rem;
    font-weight: 700;
    color: var(--cyan);
    text-underline-offset: 3px;
  }
  .project-link:hover { color: #fff; }
  
  .empty { color: var(--muted-dark); padding: 2rem 0; }
  
  /* ---------- Footer ---------- */
  .site-footer {
    background: #070d24;
    color: var(--mist);
    padding: clamp(2.5rem, 6vw, 3.5rem) 0 2rem;
    border-top: 1px solid var(--line-dark);
  }
  .footer-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 3rem;
    justify-content: space-between;
    align-items: flex-start;
  }
  .footer-brand { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; color: #fff; }
  .footer-sub { margin-top: 0.3rem; color: var(--muted-dark); font-size: 0.95rem; max-width: 34ch; }
  .footer-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; }
  .footer-links a { color: var(--muted-dark); text-decoration: none; font-weight: 600; }
  .footer-links a:hover { color: var(--cyan); }
  .copyright { flex-basis: 100%; padding-top: 1.5rem; border-top: 1px solid var(--line-dark); color: var(--muted-dark); font-size: 0.9rem; }
  
  /* ---------- Key features popup ---------- */
  html.modal-open { overflow: hidden; }
  
  .modal {
    width: 100%; height: 100%;
    max-width: none; max-height: none;
    margin: 0; padding: 0;
    border: 0;
    background: transparent;
    color: var(--mist);
  }
  @supports (height: 100dvh) {
    .modal { height: 100dvh; } /* follows the phone's collapsing browser bars */
  }
  .modal[open] {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
  }
  .modal::backdrop {
    background: rgba(5, 9, 26, 0.74);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
  .modal[open]::backdrop { animation: fade-in 0.3s ease both; }
  .modal.is-closing::backdrop { animation: fade-out 0.28s ease both; }
  
  .modal-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(53.75rem, 100%);
    max-height: min(100%, 46rem);
    background: #0c1636;
    border: 1px solid var(--line-dark);
    border-radius: 18px;
    box-shadow: 0 0 0 1px rgba(91, 140, 255, 0.12), 0 40px 90px -20px rgba(47, 102, 240, 0.6);
    overflow: hidden;
  }
  .modal[open] .modal-panel { animation: panel-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .modal.is-closing .modal-panel { animation: panel-out 0.28s ease-in both; }
  
  /* A line of light sweeps across the top edge as the popup opens */
  .modal-panel::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 2;
    background: linear-gradient(90deg, var(--blue-bright), var(--cyan), var(--violet));
    transform-origin: left;
    animation: sweep 0.9s 0.15s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  
  .modal-close {
    position: absolute;
    top: 0.9rem; right: 0.9rem;
    z-index: 3;
    width: 44px; height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-dark);
    border-radius: 50%;
    background: rgba(10, 18, 48, 0.7);
    color: var(--mist);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, transform 0.3s;
  }
  .modal-close svg {
    width: 20px; height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }
  .modal-close:hover { background: var(--blue); border-color: var(--blue); color: #fff; transform: rotate(90deg); }
  
  .modal-head {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.6rem 4.5rem 1.4rem 1.6rem;
    background: var(--midnight) url("images/hero-bg.svg") center / cover no-repeat;
    border-bottom: 1px solid var(--line-dark);
  }
  .modal-badge {
    flex: none;
    width: 52px; height: 52px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.6rem;
    color: #fff;
  }
  .modal-cat { font-size: 0.88rem; font-weight: 700; color: var(--cyan); }
  .modal-head h3 {
    margin: 0.15rem 0 0.5rem;
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    color: #fff;
  }
  .modal-desc { max-width: 62ch; font-size: 0.98rem; color: var(--muted-dark); }
  
  .modal-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 1.4rem 1.6rem 1.7rem;
  }
  .modal-grip { display: none; }
  .modal-label { margin-bottom: 1rem; font-size: 1.05rem; color: #fff; }
  
  .modal-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }
  .mf {
    display: flex;
    gap: 0.8rem;
    padding: 1rem;
    border: 1px solid var(--line-dark);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
  }
  .mf:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .modal[open] .mf {
    animation: rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 70ms + 220ms);
  }
  .mf-icon {
    flex: none;
    width: 28px; height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(34, 211, 238, 0.14);
    color: var(--cyan);
  }
  .mf-icon svg {
    width: 16px; height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .mf-text strong { display: block; margin-bottom: 0.15rem; font-size: 0.98rem; color: #fff; }
  .mf-text span { display: block; font-size: 0.92rem; line-height: 1.5; color: var(--muted-dark); }
  
  .modal-tech { margin: 1.4rem 0 0; }
  
  @keyframes fade-in  { from { opacity: 0; } to { opacity: 1; } }
  @keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
  @keyframes panel-in  { from { opacity: 0; transform: translateY(28px) scale(0.95); } to { opacity: 1; transform: none; } }
  @keyframes panel-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(18px) scale(0.97); } }
  @keyframes rise  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
  @keyframes sweep { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  @keyframes sheet-in  { from { transform: translateY(100%); } to { transform: none; } }
  @keyframes sheet-out { from { transform: none; } to { transform: translateY(100%); } }
  
  /* Phones: the popup slides up from the bottom like a sheet.
     Swipe down on the header (or tap outside) to close it. */
  @media (max-width: 560px) {
    .modal[open] { align-items: flex-end; padding: 0; }
    .modal-panel {
      width: 100%;
      max-height: 92%;
      border-radius: 20px 20px 0 0;
      border-bottom: 0;
    }
    .modal[open] .modal-panel { animation-name: sheet-in; animation-duration: 0.5s; }
    .modal.is-closing .modal-panel { animation-name: sheet-out; }
  
    .modal-grip {
      display: block;
      position: absolute;
      top: 8px; left: 50%;
      z-index: 3;
      width: 44px; height: 5px;
      border-radius: 5px;
      background: rgba(231, 237, 251, 0.35);
      transform: translateX(-50%);
    }
    .modal-head {
      gap: 0.8rem;
      padding: 1.6rem 3.8rem 1.1rem 1.1rem;
      touch-action: none; /* lets a downward swipe on the header close the sheet */
    }
    .modal-close { top: 0.75rem; right: 0.75rem; }
    .modal-badge { width: 44px; height: 44px; font-size: 1.35rem; }
    .modal-desc { font-size: 0.95rem; }
  
    .modal-features { grid-template-columns: 1fr; gap: 0.7rem; }
    .mf { padding: 0.9rem; }
    .modal-body { padding: 1.1rem 1.1rem calc(1.5rem + env(safe-area-inset-bottom, 0px)); }
  }
  
  /* Very small phones */
  @media (max-width: 380px) {
    .modal-badge { display: none; }
    .modal-head { padding-right: 3.6rem; }
    .mf-icon { width: 24px; height: 24px; }
    .mf strong { font-size: 0.95rem; }
    .mf span { font-size: 0.88rem; }
  }
  
  /* Phones turned sideways: very little height, so tighten the spacing */
  @media (max-height: 520px) {
    .modal[open] { padding: 0.5rem; }
    .modal-head { padding-block: 1rem; }
    .modal-desc { display: none; }
    .modal-body { padding-block: 1rem; }
  }
  
  /* =========================================================
     Responsive
     900px  tablets: single-column layouts
     720px  phones: hamburger menu
     560px  small phones: compact cards, full-width buttons
     380px  very small phones: tighter spacing
     ========================================================= */
  @media (max-width: 900px) {
    .hero-grid,
    .about-intro,
    .find-us { grid-template-columns: 1fr; }
  
    .hero h1 { max-width: 20ch; }
    .terminal { max-width: 560px; width: 100%; }
    .about-intro { align-items: start; }
    .map-wrap, .map-wrap iframe { min-height: 340px; }
  }
  
  @media (max-width: 720px) {
    :root { --header-h: 5rem; --logo-h: 3.5rem; } /* mobile header and logo size */
  
    .menu-toggle { display: inline-flex; }
  
    .nav-links {
      position: absolute;
      top: var(--header-h);
      left: 0; right: 0;
      flex-direction: column;
      gap: 0;
      padding: 0.5rem 1.25rem 1rem;
      background: var(--midnight);
      border-bottom: 1px solid var(--line-dark);
      box-shadow: 0 24px 40px -20px rgba(0, 0, 0, 0.6);
      display: none;
    }
    .nav-open .nav-links { display: flex; }
    .nav-link { padding: 0.95rem 0.6rem; font-size: 1.05rem; }
  
    .hero::before, .hero::after { width: 300px; height: 300px; }
    .arrows { display: none; }
    .footer-grid { flex-direction: column; gap: 1.25rem; }
  }
  
  @media (max-width: 560px) {
    body { font-size: 1rem; }
    .container { width: calc(100% - 2rem); }
  
    .hero { padding: 2.5rem 0 3.25rem; }
    .lead { font-size: 1.08rem; }
    .typed-line { font-size: 0.95rem; }
  
    /* Buttons fill the width so they are easy to tap */
    .hero-actions,
    .contact-actions { flex-direction: column; }
    .hero-actions .btn,
    .contact-actions .btn { width: 100%; text-align: center; padding: 0.95rem 1.2rem; }
  
    .term-body { min-height: 13rem; padding: 1rem; font-size: 0.8rem; line-height: 1.8; }
  
    /* Acronym cards become compact rows: letter on the left, text on the right */
    .acro {
      display: grid;
      grid-template-columns: 3.4rem 1fr;
      column-gap: 1rem;
      align-items: start;
      padding: 1.1rem 1rem;
    }
    .acro-letter { grid-row: 1 / span 2; font-size: 2.8rem; margin: 0; }
    .acro h3 { font-size: 1.1rem; margin-bottom: 0.2rem; }
  
    .contact-card { border-radius: 12px; }
    .map-wrap { border-radius: 12px; }
    .map-wrap, .map-wrap iframe { min-height: 300px; }
  
    /* Filter chips scroll sideways in one row instead of stacking */
    .toolbar { margin-bottom: 1.1rem; }
    .filters {
      flex-wrap: nowrap;
      overflow-x: auto;
      margin-inline: -1rem;
      padding: 0 1rem 0.4rem;
      scrollbar-width: none;
    }
    .filters::-webkit-scrollbar { display: none; }
    .filter { flex: none; padding: 0.6rem 1.1rem; }
  
    .project-grid { gap: 1rem; margin-inline: -1rem; padding-inline: 1rem; scroll-padding-inline: 1rem; }
    .project { flex-basis: 84%; }
    .tile-letter { font-size: 3.6rem; }
  }
  
  @media (max-width: 380px) {
    :root { --logo-h: 3rem; } /* very small phones: slightly smaller logo */
  
    .hero h1 { font-size: 2rem; }
    .brand-name { font-size: 1.15rem; }
    .brand-mark { width: 26px; height: 26px; }
    .section { padding: 3rem 0; }
  }
  
  /* ---------- Reduced motion ---------- */
  @media (prefers-reduced-motion: reduce) {
    .modal[open] .modal-panel,
    .modal[open] .mf,
    .modal[open]::backdrop,
    .modal-panel::before { animation: none; }
    .hero::before,
    .hero::after,
    .terminal,
    .caret { animation: none; }
    .js .reveal { opacity: 1; transform: none; transition: none; }
    .project-visual img,
    .tile-letter { transition: none; }
  }