:root {
  --bg: #fbfcfe;
  --surface: #ffffff;
  --surface-strong: #f3f6fa;
  --ink: #172033;
  --muted: #5f6f86;
  --line: #d9e1ec;
  --brand: #1264a3;
  --brand-dark: #0b406f;
  --brand-soft: #e2f1fc;
  --accent: #d44b32;
  --green: #16745f;
  --gold: #b7791f;
  --shadow: 0 14px 34px rgba(23, 32, 51, 0.08);
  --radius: 8px;
  --max: 1160px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
}

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

a {
  color: var(--brand-dark);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid #f0b429;
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 0.75rem;
  z-index: 10;
  transform: translateY(-160%);
  background: var(--ink);
  color: #fff;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.top-actions,
.inline-links,
.contact-actions,
.hero-actions,
.entry-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.text-link {
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  padding: 0.35rem 0.15rem;
}

.text-link[aria-current="page"] {
  color: var(--brand);
  border-bottom: 2px solid var(--brand);
}

.button-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--brand);
  padding: 0.68rem 0.95rem;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.25;
  white-space: normal;
  text-align: center;
}

.primary-action {
  background: var(--brand);
  color: #fff;
}

.primary-action:hover {
  background: var(--brand-dark);
  color: #fff;
}

.secondary-action {
  background: var(--surface);
  color: var(--brand-dark);
}

.secondary-action:hover {
  background: var(--brand-soft);
}

main {
  overflow-x: clip;
}

.hero,
.page-hero,
.case-hero,
.tool-band,
.contact-strip,
.secondary-band,
.network-strip,
.split-section,
.section-heading,
.project-grid,
.resource-layout,
.paper-list,
.case-section,
.case-nav {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.hero {
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  align-items: center;
  gap: 2rem;
  padding-top: 3.25rem;
  padding-bottom: 3.75rem;
}

.portfolio-hero {
  min-height: 590px;
}

.hero-copy,
.page-hero-copy,
.case-hero-copy {
  max-width: 700px;
}

.eyebrow,
.label,
.status-chip {
  margin: 0 0 0.65rem;
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  line-height: 1.12;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.35rem, 4.4vw, 4.65rem);
}

h2 {
  font-size: clamp(1.65rem, 3vw, 2.5rem);
}

h3 {
  font-size: 1.2rem;
}

p {
  margin-top: 0;
}

.hero-lede,
.section-heading p,
.tool-band p,
.contact-strip p,
.page-hero p,
.case-hero p {
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-actions {
  margin-top: 1.4rem;
}

.hero-visual {
  min-height: 430px;
  margin: 0;
  padding: clamp(1.1rem, 2.5vw, 2rem);
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-visual img {
  width: min(78%, 330px);
  max-height: 390px;
  object-fit: contain;
  border: 1px solid rgba(23, 32, 51, 0.14);
  border-radius: 8px;
  box-shadow: 0 16px 30px rgba(23, 32, 51, 0.12);
}

.hero-media,
.hero-panel,
.portfolio-collage,
.product-visual,
.media-frame {
  min-width: 0;
}

.portfolio-collage {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  grid-auto-rows: minmax(190px, auto);
  gap: 0.9rem;
}

.collage-card {
  min-height: 190px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.35rem;
  overflow: hidden;
}

.collage-card-large {
  grid-row: span 2;
  min-height: 400px;
  background: linear-gradient(145deg, #ffffff, #e8f5ff);
}

.collage-card img {
  width: 100%;
  max-height: 230px;
  object-fit: contain;
  margin-bottom: auto;
}

.collage-card strong {
  font-size: 1.1rem;
}

.collage-card span {
  color: var(--muted);
}

.visual-token {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: block;
  margin-bottom: auto;
}

.mas-token {
  background: radial-gradient(circle at 35% 35%, #77d4c6, #1264a3 62%, #172033);
}

.section-heading {
  padding-top: 3.5rem;
  padding-bottom: 1.15rem;
}

.section-heading-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.section-heading-row > div {
  max-width: 760px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding-bottom: 3rem;
}

.featured-grid {
  padding-bottom: 2.25rem;
}

.project-card,
.resource-card,
.feature-card,
.paper-entry,
.paper-index-card,
.featured-paper,
.role-card,
.github-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 18px rgba(23, 32, 51, 0.05);
}

.project-card {
  overflow: hidden;
}

.project-card-link {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
}

.project-card-link:hover h3 {
  color: var(--brand);
}

.project-visual {
  position: relative;
  min-height: 220px;
  height: 220px;
  padding: 1rem;
  background: var(--surface-strong);
  overflow: hidden;
}

.project-card-body {
  padding: 1rem;
}

.project-card-body p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.project-logo {
  width: 62%;
  max-height: 116px;
  object-fit: contain;
}

.project-phone {
  position: absolute;
  right: 0.8rem;
  bottom: 0.8rem;
  width: min(46%, 150px);
  border: 1px solid rgba(23, 32, 51, 0.16);
  border-radius: 8px;
  box-shadow: 0 16px 28px rgba(23, 32, 51, 0.18);
}

.tetracom-card-visual {
  background: linear-gradient(145deg, #eaf7ff, #ffffff 62%);
}

.tournament-card-visual {
  background: #101828;
}

.tournament-card-visual img {
  width: 100%;
  height: 188px;
  object-fit: cover;
  border-radius: 6px;
}

.mas-visual,
.vdm-visual,
.aipm-visual,
.tetracom-visual,
.tournament-visual,
.papers-visual {
  display: grid;
  place-items: center;
}

.mas-visual {
  background:
    linear-gradient(90deg, rgba(18, 100, 163, 0.13) 1px, transparent 1px),
    linear-gradient(0deg, rgba(18, 100, 163, 0.13) 1px, transparent 1px),
    linear-gradient(145deg, #f8fbff, #dff5f0);
  background-size: 28px 28px, 28px 28px, auto;
}

.mas-visual span {
  width: 62%;
  height: 16px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 34px 0 #18a08a, 0 68px 0 #172033;
}

.vdm-visual {
  background: linear-gradient(145deg, #172033, #31425e);
}

.vdm-frame {
  width: 78%;
  aspect-ratio: 16 / 9;
  border: 2px solid #dbeafe;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(255,255,255,0.16), rgba(255,255,255,0.05));
}

.vdm-ruler {
  position: absolute;
  width: 68%;
  height: 4px;
  background: #f0b429;
  transform: rotate(-13deg);
}

.vdm-marker {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--accent);
}

.vdm-marker.one {
  left: 24%;
  top: 45%;
}

.vdm-marker.two {
  right: 23%;
  top: 36%;
}

.aipm-visual {
  background: linear-gradient(145deg, #fff8e8, #e7f0ff);
}

.aipm-node {
  position: absolute;
  width: 74px;
  height: 46px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 24px rgba(23, 32, 51, 0.12);
}

.aipm-node.root {
  top: 42px;
  background: var(--brand);
}

.aipm-node:nth-child(2) {
  left: 22%;
  bottom: 52px;
}

.aipm-node:nth-child(3) {
  right: 22%;
  bottom: 52px;
}

.aipm-line {
  width: 52%;
  height: 2px;
  background: var(--gold);
  transform: translateY(24px);
}

.tool-band,
.contact-strip,
.network-strip {
  margin-top: 1rem;
  margin-bottom: 2.25rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.secondary-band {
  margin-top: 0.5rem;
  margin-bottom: 2.25rem;
  padding-top: 1.35rem;
  padding-bottom: 1.35rem;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1.05fr);
  gap: 1.4rem;
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.secondary-band p {
  color: var(--muted);
  margin-bottom: 0;
}

.compact-link-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem 0.85rem;
}

.compact-link-grid a {
  min-width: 0;
  padding: 0.25rem 0 0.25rem 0.75rem;
  border-left: 2px solid var(--line);
  color: var(--brand-dark);
  font-weight: 700;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.compact-link-grid a:hover {
  border-left-color: var(--accent);
  color: var(--accent);
}

.tool-band > div,
.contact-strip > div {
  max-width: 760px;
}

.resource-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding-bottom: 3rem;
}

.resource-card,
.feature-card,
.paper-entry,
.paper-index-card,
.featured-paper,
.role-card,
.github-card {
  padding: 1.15rem;
}

.resource-card p,
.feature-card p,
.paper-entry p,
.paper-index-card p,
.featured-paper p,
.role-card p,
.github-card p {
  color: var(--muted);
}

.inline-links a,
.entry-links a {
  font-weight: 700;
}

.page-hero,
.case-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1.05fr);
  align-items: center;
  gap: 2rem;
  padding-top: 4rem;
  padding-bottom: 3rem;
}

.case-nav {
  padding-top: 1.1rem;
}

.crumb {
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.case-visual {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  overflow: hidden;
}

.tetracom-hero-visual {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 0.75rem;
  align-items: center;
}

.tetracom-hero-visual .mic {
  object-fit: contain;
  max-height: 360px;
}

.screenshot-stack {
  display: grid;
  gap: 0.6rem;
}

.screenshot-stack img,
.screenshot-grid img,
.media-frame img {
  border: 1px solid rgba(23, 32, 51, 0.15);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(23, 32, 51, 0.12);
}

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.case-section {
  padding-top: 2.4rem;
  padding-bottom: 0.4rem;
}

.case-section > p {
  max-width: 860px;
  color: var(--muted);
  font-size: 1.02rem;
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.case-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-list,
.stack-list {
  margin: 0;
  padding-left: 1.15rem;
}

.summary-list li,
.stack-list li {
  margin-bottom: 0.5rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: var(--brand-soft);
}

.github-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.product-visual {
  background: linear-gradient(145deg, #101828, #28364d);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: 1rem;
}

.product-visual img {
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.18);
}

.feature-list,
.spec-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding-top: 1rem;
}

.split-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr);
  gap: 1.25rem;
  align-items: start;
  padding-top: 2.5rem;
  padding-bottom: 2rem;
}

.media-frame {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem;
}

.legacy-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.legacy-link-row-box {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.paper-list {
  display: grid;
  gap: 1rem;
  padding-bottom: 3rem;
}

.entry-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.paper-index-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 920px) {
  .hero,
  .page-hero,
  .case-hero,
  .split-section {
    grid-template-columns: 1fr;
  }

  .hero,
  .portfolio-hero {
    min-height: auto;
    padding-top: 3rem;
  }

  .project-grid,
  .resource-layout,
  .case-grid,
  .feature-list,
  .spec-grid,
  .case-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-band,
  .contact-strip,
  .secondary-band,
  .network-strip,
  .github-card {
    align-items: stretch;
    flex-direction: column;
  }

  .secondary-band {
    grid-template-columns: 1fr;
  }

  .compact-link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  h1 {
    font-size: 2.4rem;
  }

  .portfolio-collage,
  .project-grid,
  .resource-layout,
  .case-grid,
  .feature-list,
  .spec-grid,
  .case-grid.two,
  .screenshot-grid,
  .tetracom-hero-visual,
  .paper-index-card {
    grid-template-columns: 1fr;
  }

  .collage-card-large {
    min-height: 260px;
  }

  .section-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-visual {
    min-height: 330px;
  }

  .project-visual {
    min-height: 200px;
    height: 200px;
  }

  .compact-link-grid {
    grid-template-columns: 1fr;
  }

  .entry-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
