/* tramas.css — Visual language for Tramas content pages
   Typography: TASA Orbiter (hero), Instrument Serif (subheads),
   IBM Plex Sans (body), JetBrains Mono (labels/CTA)
   + Background textures from Figma design system */

/* ─── Font Imports ─── */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=Instrument+Serif:ital@1&family=JetBrains+Mono:wght@500;700&family=TASA+Orbiter:wght@500&display=swap');

/* ─── BG Layers (from login page) ─── */

.tramas-bg-dots {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.18;
  background-image: radial-gradient(circle at center, rgba(247,247,247,0.36) 1px, transparent 1.2px);
  background-size: 16px 16px;
}

.tramas-bg-vignette {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 15% -10%, #1f2e5b 0%, transparent 55%),
    radial-gradient(70% 70% at 50% 60%, transparent 0%, rgba(0,0,0,0.5) 76%, rgba(0,0,0,0.75) 100%);
}

/* ─── Texture Patterns (Figma assets) ─── */

.tramas-hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  border-radius: 14px;
  z-index: -1;
}

.tramas-hero-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.22;
}

.tramas-hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(10,10,12,0.95) 100%);
}

/* Feed hero — scattered blocks */
.tramas-hero--feed .tramas-hero-bg img { opacity: 0.18; }

/* Article hero — hexcubes */
.tramas-hero--article .tramas-hero-bg img { opacity: 0.2; }

/* Guide hero — honeycomb */
.tramas-hero--guide .tramas-hero-bg img { opacity: 0.2; }

/* ─── Card Background Textures ─── */

.tramas-feed-card {
  position: relative;
  overflow: hidden;
}

.tramas-feed-card .tramas-card-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.tramas-feed-card .tramas-card-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
}

.tramas-feed-card:hover .tramas-card-bg {
  opacity: 1;
}

.tramas-feed-card > *:not(.tramas-card-bg) {
  position: relative;
  z-index: 1;
}

/* ─── CTA Texture Background ─── */

.tramas-cta-block {
  position: relative;
  overflow: hidden;
}

.tramas-cta-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.tramas-cta-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.08;
}

.tramas-cta-block > *:not(.tramas-cta-bg) {
  position: relative;
  z-index: 1;
}

/* ─── Chapter Nav Texture ─── */

.tramas-chapter-nav-link {
  position: relative;
  overflow: hidden;
}

.tramas-chapter-nav-link .tramas-nav-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tramas-chapter-nav-link .tramas-nav-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.25;
}

.tramas-chapter-nav-link:hover .tramas-nav-bg {
  opacity: 1;
}

.tramas-chapter-nav-link > *:not(.tramas-nav-bg) {
  position: relative;
  z-index: 1;
}

/* ─── Pull Quote / Epigraph Texture ─── */

.tramas-pull-quote {
  position: relative;
  overflow: hidden;
}

.tramas-pull-quote .tramas-quote-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.tramas-pull-quote .tramas-quote-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.06;
}

.tramas-pull-quote > *:not(.tramas-quote-bg):not(.tramas-pull-quote::before) {
  position: relative;
  z-index: 1;
}

/* ─── Article Container ─── */

.tramas-article {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px 80px;
  position: relative;
}

.tramas-breadcrumb {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Hero ─── */

.tramas-hero {
  position: relative;
  padding: 64px 32px 40px;
  border-bottom: 1px solid rgba(154, 155, 156, 0.2);
  margin-bottom: 48px;
  border-radius: 14px;
  overflow: hidden;
}

.tramas-hero[class*="tramas-hero--"] {
  margin-left: -32px;
  margin-right: -32px;
}

.tramas-kicker {
  display: block;
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: uppercase;
  line-height: 1;
  color: rgba(154, 155, 156, 0.9);
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.tramas-title {
  font-family: 'TASA Orbiter', 'Playfair Display', 'Georgia', serif;
  font-style: normal;
  font-weight: 500;
  font-size: clamp(42px, 5vw, 72px);
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  color: rgba(241, 241, 241, 0.99);
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  text-wrap: balance;
  margin: 0 0 20px;
  position: relative;
  z-index: 1;
}

.tramas-subtitle {
  font-family: 'Instrument Serif', 'Playfair Display', 'Georgia', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(18px, 2.5vw, 28px);
  line-height: 1.2;
  letter-spacing: 0;
  color: rgba(207, 208, 210, 0.92);
  max-width: 600px;
  position: relative;
  z-index: 1;
}

/* ─── Epigraph ─── */

.tramas-epigraph {
  margin: 0 0 48px;
  padding: 24px 0 24px 24px;
  border-left: 2px solid rgba(143, 232, 255, 0.3);
}

.tramas-epigraph p {
  font-family: 'Instrument Serif', 'Playfair Display', 'Georgia', serif;
  font-style: italic;
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.2;
  color: rgba(224, 224, 230, 0.88);
}

.tramas-epigraph cite {
  display: block;
  margin-top: 12px;
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-style: normal;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0;
  color: rgba(154, 155, 156, 0.8);
}

/* ─── Sections ─── */

.tramas-section {
  margin-bottom: 56px;
  position: relative;
}

.tramas-section + .tramas-section {
  padding-top: 48px;
  border-top: 1px solid rgba(154, 155, 156, 0.14);
}

.tramas-section-number {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-style: italic;
  font-size: 72px;
  line-height: 1;
  color: rgba(143, 232, 255, 0.12);
  position: absolute;
  top: 36px;
  right: 0;
  pointer-events: none;
  user-select: none;
}

.tramas-section-heading {
  font-family: 'Instrument Serif', 'Playfair Display', 'Georgia', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(28px, 3.5vw, 42px);
  line-height: 1.2;
  letter-spacing: 0;
  color: rgba(233, 233, 234, 0.98);
  margin: 0 0 20px;
  max-width: 85%;
}

.tramas-section-body {
  font-family: 'IBM Plex Sans', 'Inter', -apple-system, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
  color: rgba(207, 208, 210, 0.92);
  font-feature-settings: 'onum' 1, 'pnum' 1;
}

.tramas-section-body p {
  margin-bottom: 20px;
}

.tramas-section-body p:last-child {
  margin-bottom: 0;
}

.tramas-section-body strong {
  color: rgba(241, 241, 241, 0.96);
  font-weight: 600;
}

.tramas-section-body em {
  font-family: 'Instrument Serif', 'Playfair Display', 'Georgia', serif;
  font-size: 1.05em;
  color: rgba(224, 224, 230, 0.95);
}

/* ─── Pull Quote (mid-section epigraph) ─── */

.tramas-pull-quote {
  margin: 36px 0;
  padding: 28px 32px;
  background: linear-gradient(180deg, rgba(20, 20, 22, 0.96), rgba(14, 14, 16, 0.98));
  border: 1px solid rgba(154, 155, 156, 0.2);
  border-radius: 14px;
  position: relative;
}

.tramas-pull-quote::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(102deg, rgba(143, 232, 255, 0.4) 0%, rgba(169, 160, 255, 0.4) 50%, rgba(255, 93, 196, 0.2) 100%);
  border-radius: 14px 14px 0 0;
}

.tramas-pull-quote p {
  font-family: 'Instrument Serif', 'Playfair Display', 'Georgia', serif;
  font-style: italic;
  font-size: 22px;
  line-height: 1.2;
  color: rgba(241, 241, 241, 0.94);
  margin: 0;
  position: relative;
  z-index: 1;
}

/* ─── Crosslinks ─── */

.tramas-crosslinks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.tramas-crosslink-pill {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 12px;
  padding: 6px 14px;
  border: 1px solid rgba(154, 155, 156, 0.28);
  border-radius: 999px;
  color: rgba(194, 195, 196, 0.9);
  transition: border-color 0.2s, color 0.2s;
}

.tramas-crosslink-pill:hover {
  border-color: var(--pub-accent);
  color: var(--pub-accent);
}

/* ─── Language Toggle ─── */

.tramas-lang-toggle {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin: 48px 0 32px;
}

.tramas-lang-active,
.tramas-lang-link {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(154, 155, 156, 0.2);
}

.tramas-lang-active {
  background: rgba(143, 232, 255, 0.12);
  color: rgba(241, 241, 241, 0.95);
  border-color: rgba(143, 232, 255, 0.3);
}

.tramas-lang-link {
  color: rgba(154, 155, 156, 0.8);
  transition: border-color 0.2s, color 0.2s;
}

.tramas-lang-link:hover {
  border-color: rgba(154, 155, 156, 0.5);
  color: rgba(224, 224, 230, 0.9);
}

/* ─── Tables ─── */

.tramas-section-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-family: 'IBM Plex Sans', 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.tramas-section-body thead th {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(154, 155, 156, 0.8);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.tramas-section-body tbody td {
  padding: 10px 16px;
  color: rgba(207, 208, 210, 0.9);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.tramas-section-body tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

.tramas-section-body tbody tr:last-child td {
  border-bottom: 1px solid rgba(255,255,255,0.12);
  font-weight: 600;
  color: rgba(241, 241, 241, 0.95);
}

.tramas-section-body td:last-child,
.tramas-section-body th:last-child {
  text-align: right;
}

@media (max-width: 640px) {
  .tramas-section-body table {
    font-size: 12px;
  }
  .tramas-section-body th,
  .tramas-section-body td {
    padding: 8px 10px;
  }
}

/* ─── Featured Image ─── */

.tramas-featured-image {
  margin: 0 0 32px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}

.tramas-featured-image img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* ─── Author Byline (inline in articles) ─── */

.tramas-byline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(154, 155, 156, 0.14);
}

.tramas-byline-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.tramas-byline-avatar {
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.1);
}

.tramas-byline-name {
  display: block;
  font-family: 'IBM Plex Sans', 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: rgba(241, 241, 241, 0.95);
}

.tramas-byline-role {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: 11px;
  color: rgba(154, 155, 156, 0.7);
}

.tramas-byline-date {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: 12px;
  color: rgba(154, 155, 156, 0.6);
}

/* ─── Author Page ─── */

.tramas-author-header {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 48px 0 40px;
  border-bottom: 1px solid rgba(154, 155, 156, 0.2);
  margin-bottom: 40px;
}

.tramas-author-photo {
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.tramas-author-name {
  font-family: 'TASA Orbiter', 'Playfair Display', serif;
  font-weight: 500;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
  color: rgba(241, 241, 241, 0.99);
  margin: 0 0 8px;
}

.tramas-author-role {
  font-family: 'Instrument Serif', 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.2;
  color: rgba(207, 208, 210, 0.85);
  margin: 0 0 16px;
}

.tramas-author-social {
  display: flex;
  gap: 8px;
}

.tramas-author-social-link {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: 12px;
  padding: 6px 14px;
  border: 1px solid rgba(154, 155, 156, 0.28);
  border-radius: 999px;
  color: rgba(194, 195, 196, 0.9);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.tramas-author-social-link:hover {
  border-color: var(--pub-accent, rgba(143, 232, 255, 0.6));
  color: var(--pub-accent, rgba(143, 232, 255, 0.9));
}

@media (max-width: 640px) {
  .tramas-author-header {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }
  .tramas-author-photo { width: 120px; height: 120px; }
  .tramas-author-social { justify-content: center; }
  .tramas-byline { flex-direction: column; align-items: flex-start; }
}

/* ─── Video Embed ─── */

.tramas-video-wrap {
  margin: 0 0 48px;
}

.tramas-video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(154, 155, 156, 0.2);
  background: rgba(14, 14, 16, 0.95);
}

.tramas-video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.tramas-video-desc {
  margin-top: 14px;
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(154, 155, 156, 0.75);
}

/* ─── Chapter TOC ─── */

.tramas-chapter-toc {
  margin: 48px 0 32px;
  padding: 32px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
}

.tramas-chapter-toc-title {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  color: rgba(154, 155, 156, 0.7);
  margin: 0 0 16px;
}

.tramas-chapter-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tramas-chapter-toc-list li a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(207, 208, 210, 0.8);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  line-height: 1.4;
  transition: background 0.2s, color 0.2s;
}

.tramas-chapter-toc-list li a:hover {
  background: rgba(255,255,255,0.05);
  color: rgba(241, 241, 241, 0.95);
}

.tramas-chapter-toc-active a {
  background: rgba(143, 232, 255, 0.08);
  color: rgba(241, 241, 241, 0.95) !important;
  border-left: 2px solid rgba(143, 232, 255, 0.5);
}

.tramas-chapter-toc-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: 11px;
  color: rgba(143, 232, 255, 0.5);
  min-width: 20px;
}

/* ─── CTA Block ─── */

.tramas-cta-block {
  text-align: center;
  padding: 56px 24px;
  margin-top: 48px;
  border-top: 1px solid rgba(154, 155, 156, 0.14);
}

.tramas-cta-text {
  font-family: 'Instrument Serif', 'Playfair Display', 'Georgia', serif;
  font-style: italic;
  font-size: clamp(20px, 2.5vw, 28px);
  line-height: 1.2;
  color: rgba(224, 224, 230, 0.88);
  margin-bottom: 24px;
}

.tramas-cta-btn {
  display: inline-block;
  padding: 14px 36px;
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0;
  line-height: 1;
  font-feature-settings: 'liga' 0, 'lnum' 1, 'pnum' 1;
  color: #111;
  background: linear-gradient(102deg, rgba(143, 232, 255, 0.18) 0%, #8fe8ff 16%, #a9a0ff 46%, #bb74ff 70%, #ff5dc4 88%, rgba(255, 93, 196, 0.2) 100%);
  background-size: 160% 100%;
  background-position: 52% 50%;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(184, 108, 255, 0.24), 0 2px 10px rgba(255, 93, 196, 0.14);
  transition: transform 0.2s, box-shadow 0.2s;
}

.tramas-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(184, 108, 255, 0.32), 0 4px 14px rgba(255, 93, 196, 0.2);
  color: #111;
}

.tramas-cta-login {
  margin-top: 16px;
  font-size: 14px;
  color: rgba(154, 155, 156, 0.7);
}

.tramas-cta-login a {
  color: var(--pub-accent);
}

/* ─── Feed Grid ─── */

.tramas-feed-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 48px;
}

.tramas-feed-card {
  display: block;
  padding: 32px;
  background: linear-gradient(180deg, rgba(20, 20, 22, 0.96), rgba(14, 14, 16, 0.98));
  border: 1px solid rgba(154, 155, 156, 0.2);
  border-radius: 14px;
  transition: border-color 0.2s, transform 0.2s;
  color: inherit;
}

.tramas-feed-card:hover {
  border-color: rgba(154, 155, 156, 0.4);
  transform: translateY(-2px);
}

.tramas-feed-card-type {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
  line-height: 1;
  color: rgba(143, 232, 255, 0.7);
}

.tramas-feed-card-title {
  font-family: 'Instrument Serif', 'Playfair Display', 'Georgia', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.2;
  letter-spacing: 0;
  color: rgba(241, 241, 241, 0.96);
  margin: 10px 0 12px;
}

.tramas-feed-card-desc {
  font-family: 'IBM Plex Sans', 'Inter', -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(194, 195, 196, 0.8);
}

/* ─── Reveal Animation ─── */

.tramas-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: var(--reveal-delay, 0ms);
}

.tramas-reveal.tramas-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Chapter Prev/Next Nav ─── */

.tramas-chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 48px 0 32px;
  padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.tramas-chapter-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.tramas-chapter-nav-link:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
}

.tramas-chapter-next { text-align: right; }

.tramas-chapter-nav-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.4);
}

.tramas-chapter-nav-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  line-height: 1.3;
}

/* ─── Responsive ─── */

@media (max-width: 640px) {
  .tramas-article { padding: 0 16px 60px; }
  .tramas-hero { padding: 40px 0 28px; }
  .tramas-section-number { display: none; }
  .tramas-pull-quote { padding: 20px; }
  .tramas-feed-card { padding: 24px; }
  .tramas-chapter-nav { grid-template-columns: 1fr; }
}

@media (min-width: 641px) {
  .tramas-feed-grid {
    grid-template-columns: 1fr 1fr;
  }
}
