/* ============================================================
   9UY.COM — Shared Stylesheet
   Covers: page chrome, homepage grid, contact form, content pages.
   Companion to assets/css/api.css (feedback widget / captcha).
   ============================================================ */

/* ── Design Tokens ── */
:root {
  --bg:          #0a0a0a;
  --bg-card:     #111111;
  --bg-card-alt: rgba(23, 23, 23, 0.5);
  --fg:          #d4d4d8;
  --fg-muted:    #71717a;
  --fg-dim:      #3f3f46;
  --border:      #262626;
  --border-mid:  #3f3f46;
  --border-hi:   #52525b;
  --accent:      #ffffff;
  --green:       #22c55e;
  --red:         #ef4444;
  --font-mono:   ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
                 "Liberation Mono", "Courier New", monospace;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  color: var(--fg);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 30px 30px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Selection */
::selection {
  background: #ffffff;
  color: #000000;
}

/* ── Scanline overlay ── */
.scanline {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 50%,
    rgba(0,0,0,0.2) 50%
  );
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.25;
}

/* ── Layout shell ── */
.page-wrap {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 72rem;   /* ~1152px */
  margin-inline: auto;
  padding-inline: 1.5rem;
}

main {
  flex-grow: 1;
}

/* ── Header ── */
.site-header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}

.site-header .page-wrap {
  padding-top: 4rem;
  padding-bottom: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .site-header .page-wrap {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
  }
}

.site-logo {
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #fff;
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  line-height: 1;
}

.logo-cursor {
  display: inline-block;
  width: 0.35em;
  height: 0.85em;
  background: #fff;
  animation: blink-cursor 1.1s step-end infinite;
  vertical-align: middle;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.site-tagline {
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1.8;
  margin: 0;
}

.system-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--red);
  font-size: 0.6rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  align-self: flex-start;
}

@media (min-width: 768px) {
  .system-badge { align-self: auto; }
}

/* ── Sub-page header (contact etc.) ── */
.sub-header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}

.sub-header .page-wrap {
  padding-top: 3rem;
  padding-bottom: 2rem;
}

.sub-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  text-decoration: none;
  margin-bottom: 2rem;
  transition: color 0.2s;
}
.sub-header .back-link:hover { color: #fff; }
.sub-header .back-link svg  { width: 1rem; height: 1rem; }

.sub-header h1 {
  font-size: clamp(2.5rem, 7vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #fff;
  margin: 0 0 1rem;
}

.sub-header p {
  font-size: 0.7rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1.8;
  margin: 0;
  max-width: 30rem;
}

/* ── Section headings ── */
.section-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.section-heading h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0;
  white-space: nowrap;
}

.section-heading .rule {
  height: 1px;
  background: var(--border);
  flex-grow: 1;
}

.section-heading .badge {
  font-size: 0.65rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* ── App grid ── */
.app-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .app-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  .app-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
  .app-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ── App card ── */
.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--bg-card-alt);
  text-decoration: none;
  color: var(--fg);
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  cursor: pointer;
  gap: 0;
}

.app-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hi);
  background: var(--bg-card);
  color: #fff;
  box-shadow: 0 10px 40px -10px rgba(255,255,255,0.08);
}

.app-card.offline {
  opacity: 0.28;
  filter: grayscale(1);
  cursor: not-allowed;
  pointer-events: none;
}

.card-dot {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: rgba(34,197,94,0.5);
}

.card-dot.offline {
  background: var(--border);
}

.card-icon {
  color: var(--fg-muted);
  transition: color 0.2s;
  margin-bottom: 1rem;
}
.app-card:hover .card-icon { color: #fff; }
.card-icon svg {
  width: 2rem;
  height: 2rem;
  display: block;
}

.card-name {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  color: inherit;
  margin: 0;
}

.card-desc {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--fg-muted);
  margin: 0.4rem 0 0;
  opacity: 0;
  transition: opacity 0.2s;
}
.app-card:hover .card-desc { opacity: 1; }

.card-desc.always-show {
  opacity: 1;
  color: var(--fg-dim);
}

/* ── Main sections ── */
.deck-section {
  position: relative;
  z-index: 10;
  padding: 4rem 0;
}

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

/* ── Footer ── */
.site-footer {
  position: relative;
  z-index: 10;
  border-top: 1px solid var(--border);
  background: rgba(10,10,10,0.8);
  backdrop-filter: blur(4px);
  margin-top: auto;
}

.site-footer .page-wrap {
  padding-top: 2rem;
  padding-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  text-align: center;
}

@media (min-width: 768px) {
  .site-footer .page-wrap {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.65rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.footer-links a,
.footer-links button {
  color: inherit;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  transition: color 0.2s;
}

.footer-links a:hover,
.footer-links button:hover { color: var(--fg-muted); }

.footer-disclaimer {
  font-size: 0.65rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
  max-width: 32rem;
}

/* ── Contact page specific ── */
.contact-wrap {
  max-width: 40rem;
  padding-top: 3rem;
  padding-bottom: 4rem;
  position: relative;
  z-index: 10;
}

.form-notice {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.01);
  border-radius: 0.375rem;
  font-size: 0.65rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.6;
}
