/* =============================================================================
   components.css — Reusable UI components: nav, footer, cards, buttons, tags
   ============================================================================= */


/* ── Site Navigation ─────────────────────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-bg-border);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--content-padding);
  height: 3.5rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-monogram {
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-link {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  white-space: nowrap;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-link:hover {
  color: var(--color-text);
  background: rgba(var(--color-accent-rgb), 0.1);
}

.nav-link.active {
  color: var(--color-accent-2);
  background: rgba(var(--color-accent-rgb), 0.12);
}

/* ── Theme Toggle ────────────────────────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-left: auto;
  flex-shrink: 0;
  border: 1px solid var(--color-bg-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast),
    background var(--transition-fast);
}

.theme-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-bg-border-hover);
  background: rgba(var(--color-accent-rgb), 0.08);
}


/* ── Site Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--color-bg-border);
  padding-block: var(--space-8);
  margin-top: var(--space-16);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--content-padding);
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.footer-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}

.footer-meta {
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--color-accent-2);
}

.footer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
}

.footer-copy {
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
}


/* ── Section ─────────────────────────────────────────────────────────────────── */
.section {
  padding-block: var(--space-16);
}

.section + .section {
  padding-top: 0;
}

section[id] {
  scroll-margin-top: 4.5rem;
}

.section-label {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent-1);
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl));
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.section-desc {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 52ch;
  margin-bottom: var(--space-10);
  line-height: 1.7;
}


/* ── Page Header ─────────────────────────────────────────────────────────────── */
.page-header {
  padding-block: var(--space-12) var(--space-8);
  border-bottom: 1px solid var(--color-bg-border);
  margin-bottom: var(--space-10);
}

.page-header-label {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent-1);
  margin-bottom: var(--space-3);
}

.page-header-title {
  font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl));
  font-weight: 800;
  margin-bottom: var(--space-4);
}

.page-header-desc {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 56ch;
  line-height: 1.7;
}


/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
  gap: var(--space-5);
}

.card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-bg-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    transform var(--transition-base);
}

.card:hover {
  border-color: var(--color-bg-border-hover);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.card-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.card-year {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-text-subtle);
  padding: var(--space-1) var(--space-2);
  background: var(--color-year-bg);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.card-title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin: 0;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--color-accent-2);
  font-weight: 500;
  margin-top: calc(-1 * var(--space-2));
}

.card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.65;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-bg-border);
}


/* ── Feature (internship highlight on home page) ─────────────────────────────── */
.feature {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-bg-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: box-shadow var(--transition-base);
}

.feature:hover {
  box-shadow: var(--shadow-glow);
}

.feature-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
  .feature-inner {
    grid-template-columns: 1fr;
  }
}

.feature-body {
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.feature-company {
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  color: var(--color-accent-2);
}

.feature-title {
  font-size: clamp(var(--text-xl), 2.5vw, var(--text-3xl));
  font-weight: 800;
  line-height: 1.15;
}

.feature-desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
  flex: 1;
}

.feature-media {
  background: var(--color-bg);
  border-left: 1px solid var(--color-bg-border);
  padding: var(--space-6);
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 768px) {
  .feature-media {
    border-left: none;
    border-top: 1px solid var(--color-bg-border);
    grid-template-rows: auto;
    grid-template-columns: 1fr 1fr;
  }
}


/* ── Image Placeholder ───────────────────────────────────────────────────────── */
.img-placeholder {
  aspect-ratio: 4 / 3;
  background: var(--color-bg-surface);
  border: 1px dashed var(--color-bg-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  text-align: center;
  padding: var(--space-3);
  overflow: hidden;
}

.img-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.img-placeholder-label {
  opacity: 0.6;
  line-height: 1.4;
}

/* Wide placeholder for the drone detail page */
.img-placeholder-wide {
  aspect-ratio: 16 / 9;
}


/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-sans);
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.btn-primary {
  background: var(--gradient-accent);
  color: #fff;
  border-color: transparent;
}

.btn-primary:hover {
  color: #fff;
  box-shadow: var(--shadow-glow-strong);
  filter: brightness(1.08);
}

.btn-outline {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-bg-border);
}

.btn-outline:hover {
  color: var(--color-text);
  border-color: var(--color-bg-border-hover);
  background: rgba(var(--color-accent-rgb), 0.06);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  color: var(--color-text);
  background: var(--color-bg-surface-hover);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}


/* ── Tags ────────────────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--color-accent-2);
  background: rgba(var(--color-accent-rgb), 0.1);
  border: 1px solid rgba(var(--color-accent-rgb), 0.2);
  border-radius: 999px;
  white-space: nowrap;
}

.tag-neutral {
  color: var(--color-text-muted);
  background: var(--color-year-bg);
  border-color: var(--color-bg-border);
}

/* ── WASM Badge ──────────────────────────────────────────────────────────────── */
.wasm-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-wasm);
  background: rgba(var(--color-wasm-rgb), 0.08);
  border: 1px solid rgba(var(--color-wasm-rgb), 0.2);
  border-radius: 999px;
  padding: var(--space-1) var(--space-3);
  white-space: nowrap;
}

.wasm-badge::before {
  content: '▶';
  font-size: 0.6em;
}


/* ── Link List (for links page) ──────────────────────────────────────────────── */
.link-group {
  margin-bottom: var(--space-10);
}

.link-group-title {
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-subtle);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-bg-border);
}

.link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-bg-border);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.link-item:last-child {
  border-bottom: none;
}

.link-item-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.link-item-icon {
  font-size: 1.25rem;
  width: 2rem;
  text-align: center;
  flex-shrink: 0;
}

.link-item-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  transition: color var(--transition-fast);
}

.link-item-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.link-item-arrow {
  color: var(--color-text-subtle);
  font-size: var(--text-lg);
  transition: transform var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.link-item:hover .link-item-name {
  color: var(--color-accent-2);
}

.link-item:hover .link-item-arrow {
  color: var(--color-accent-2);
  transform: translateX(3px);
}


/* ── Divider ─────────────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--color-bg-border);
  margin-block: var(--space-12);
}


/* ── Interactive Embed (WFC game embed on demo/index page) ───────────────────── */
.interactive-embed {
  max-width: 52rem;
  margin-inline: auto;
}

.interactive-embed-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-bg-border);
  margin-bottom: var(--space-4);
}

.interactive-embed-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Shared restart control for any embedded game iframe (interactive-embed on
   demo.html, game-frame-wrap on wfc.html) — reloading the iframe regenerates
   the map without a full page reload. */
.restart-btn {
  display: none;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  cursor: pointer;
  backdrop-filter: blur(4px);
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  z-index: 10;
  transition: background var(--transition-fast);
}

.restart-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

.restart-btn.visible {
  display: inline-flex;
}

.interactive-embed-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background: var(--color-bg-surface);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.interactive-embed-placeholder:hover {
  background: var(--color-bg-surface-hover);
}

.placeholder-hint {
  font-size: var(--text-sm);
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
}

.interactive-embed-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}


/* ── Case Study (full narrative layout on drone.html) ────────────────────────── */
.case-study-narrative {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

@media (max-width: 640px) {
  .case-study-narrative {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
}

.case-study-block {
  padding: var(--space-5);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-bg-border);
  border-radius: var(--radius-lg);
}

.case-study-block-label {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent-1);
  margin-bottom: var(--space-3);
}

.case-study-block-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.7;
}

.case-study-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

@media (max-width: 480px) {
  .case-study-images {
    grid-template-columns: 1fr;
  }
}

.case-study-tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.tech-block {
  padding: var(--space-5);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-bg-border);
  border-radius: var(--radius-lg);
}

.tech-block-label {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-subtle);
  margin-bottom: var(--space-2);
}

.tech-block-value {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}


/* ── Forms (contact) ─────────────────────────────────────────────────────────── */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 38rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.form-input,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-bg-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-textarea {
  resize: vertical;
  min-height: 8rem;
  line-height: 1.6;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-subtle);
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-accent-1);
  box-shadow: 0 0 0 3px rgba(var(--color-accent-rgb), 0.25);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
}

.form-error {
  font-size: var(--text-sm);
  color: #f87171;
}

.form-notice {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.form-notice-success {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.25);
  color: var(--color-text);
}

.form-notice-error {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--color-text);
}

/* Honeypot: off-screen, not display:none (keeps it "fillable" to simple bots) */
.form-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}


/* ── Admin table (contact submissions) ───────────────────────────────────────── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.admin-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-subtle);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-bg-border);
}

.admin-table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-bg-border);
  color: var(--color-text-muted);
  vertical-align: top;
}

.admin-table td.msg-name {
  color: var(--color-text);
  font-weight: 600;
  white-space: nowrap;
}


/* ── Empty State ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  background: var(--color-bg-surface);
  border: 1px dashed var(--color-bg-border);
  border-radius: var(--radius-xl);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 36ch;
  margin-inline: auto;
}
