/**
 * public/css/examples.css — Examples gallery page styles.
 * Owns: layout, cards, syntax preview, responsive grid.
 * Does NOT own: global nav, analytics, editor behaviour.
 */

:root {
  --cream:       #FDF6EC;
  --ink:         #2A2118;
  --warm:        #E8A04C;
  --warm-light:  #F5D5A0;
  --sketch:      #4A3A2E;
  --soft:        #6B5745;
  --editor-bg:   #1E1A16;
  --editor-bdr:  #3A2E24;
  --card-bg:     #FFFFFF;
  --card-bdr:    rgba(42,33,24,0.12);
}

/* ── Dark mode ───────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --cream:      #1A1410;
    --ink:        #F0E8DA;
    --warm:       #E8A04C;
    --warm-light: #3A2C1A;
    --sketch:     #C4B09A;
    --soft:       #9A8272;
    --card-bg:    #241E18;
    --card-bdr:   rgba(255,255,255,0.08);
  }
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--cream);
  color: var(--ink);
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── Nav ─────────────────────────────────────────────────────── */
.ex-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 2rem;
  background: rgba(253,246,236,0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(42,33,24,0.08);
}
@media (prefers-color-scheme: dark) {
  .ex-nav { background: rgba(26,20,16,0.88); }
}
.nav-logo {
  font-family: 'Caveat', cursive;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.nav-links a {
  color: var(--soft);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.nav-active { color: var(--ink); font-weight: 600; }
.nav-cta {
  background: var(--ink) !important;
  color: var(--cream) !important;
  padding: 0.45rem 1.1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem !important;
}

/* ── Page header ─────────────────────────────────────────────── */
.ex-header {
  padding: 7rem 2rem 3rem;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.ex-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--warm-light);
  color: var(--sketch);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  margin-bottom: 1.2rem;
}

.ex-header h1 {
  font-family: 'Caveat', cursive;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 1rem;
}

.ex-header h1 em {
  font-style: normal;
  position: relative;
  display: inline;
}
.ex-header h1 em::after {
  content: '';
  position: absolute;
  bottom: 3px; left: -2px; right: -2px;
  height: 8px;
  background: var(--warm);
  opacity: 0.3;
  border-radius: 4px;
  z-index: -1;
  transform: rotate(-0.4deg);
}

.ex-header p {
  color: var(--soft);
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto;
}

/* ── Gallery grid ─────────────────────────────────────────────── */
.ex-gallery {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 2rem 5rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.75rem;
}

/* ── Example card ─────────────────────────────────────────────── */
.ex-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-bdr);
  border-radius: 18px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  /* Pencil-sketch feel: slight box shadow + hand-drawn border-radius variance */
  box-shadow: 0 3px 14px rgba(42,33,24,0.07), 0 1px 4px rgba(42,33,24,0.05);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.ex-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 40px rgba(42,33,24,0.13), 0 4px 12px rgba(232,160,76,0.08);
  border-color: var(--warm-light);
}
.ex-card:focus-within {
  outline: 2px solid var(--warm);
  outline-offset: 2px;
}

/* Code preview block */
.ex-code-preview {
  background: var(--editor-bg);
  position: relative;
  overflow: hidden;
}

/* Fake titlebar */
.ex-titlebar {
  background: #252018;
  padding: 0.55rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid var(--editor-bdr);
}
.ex-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
}
.ex-dot-r { background: #FF5F57; }
.ex-dot-y { background: #FEBC2E; }
.ex-dot-g { background: #28C840; }
.ex-titlebar-name {
  margin-left: auto;
  color: rgba(255,255,255,0.3);
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* Code lines */
.ex-code-lines {
  padding: 0.9rem 1rem;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.75rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.72);
  white-space: pre;
  overflow: hidden;
  display: flex;
  gap: 0;
}
.ex-gutter {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-right: 0.7rem;
  flex-shrink: 0;
  user-select: none;
}
.ex-gutter span {
  color: rgba(255,255,255,0.18);
  font-size: 0.7rem;
  line-height: 1.7;
}
.ex-code-body { flex: 1; overflow: hidden; }

/* Syntax colour tokens */
.s-kw  { color: #E8A04C; }
.s-fn  { color: #98D8C0; }
.s-str { color: #A8D86C; }
.s-num { color: #82CFEE; }
.s-cm  { color: rgba(255,255,255,0.3); font-style: italic; }
.s-err { background: rgba(255,80,80,0.12); border-left: 2px solid #FF5050; padding-left: 0.4rem; }

/* Cat reaction badge overlay */
.ex-cat-badge {
  position: absolute;
  bottom: 0.5rem; right: 0.75rem;
  font-size: 1.4rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.ex-card:hover .ex-cat-badge { transform: scale(1.3) rotate(-8deg); }

/* Card body */
.ex-card-body {
  padding: 1.2rem 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.ex-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ex-lang-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: var(--warm-light);
  color: var(--sketch);
  font-family: 'JetBrains Mono', monospace;
}
.ex-lang-badge.lang-py  { background: #D4EDFF; color: #1A4A70; }
.ex-lang-badge.lang-html{ background: #FFE8D4; color: #7A3000; }
@media (prefers-color-scheme: dark) {
  .ex-lang-badge.lang-py  { background: #1A3A52; color: #82CFEE; }
  .ex-lang-badge.lang-html{ background: #3A1E0A; color: #E8A04C; }
}

.ex-card-title {
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.ex-card-desc {
  font-size: 0.88rem;
  color: var(--soft);
  line-height: 1.55;
  flex: 1;
}

.ex-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding: 0.6rem 1.1rem;
  background: var(--ink);
  color: var(--cream);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  transition: background 0.15s, transform 0.15s;
  align-self: flex-start;
}
.ex-card-cta:hover { background: #3D3026; transform: translateY(-1px); }
.ex-card-cta:active { transform: translateY(0); }

/* Arrow: animated on hover */
.ex-card-cta .cta-arrow {
  display: inline-block;
  transition: transform 0.2s;
}
.ex-card-cta:hover .cta-arrow { transform: translateX(3px); }

/* ── Bottom CTA bar ────────────────────────────────────────────── */
.ex-bottom {
  text-align: center;
  padding: 1rem 2rem 5rem;
}
.ex-bottom p {
  color: var(--soft);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}
.ex-bottom-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2rem;
  background: var(--warm);
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}
.ex-bottom-cta:hover { background: #D4912F; transform: translateY(-2px); }

/* ── Footer ────────────────────────────────────────────────────── */
footer {
  border-top: 1px dashed rgba(139,113,96,0.3);
  padding: 2rem;
  text-align: center;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
  margin-bottom: 0.75rem;
}
.footer-links a {
  color: var(--soft);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--ink); }
.footer-copy {
  font-family: 'Caveat', cursive;
  font-size: 0.95rem;
  color: rgba(139,113,96,0.6);
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ex-gallery { grid-template-columns: 1fr; }
  .nav-links a:not(.nav-cta) { display: none; }
}
@media (max-width: 480px) {
  .ex-nav { padding: 0.7rem 1rem; }
  .ex-header { padding: 6rem 1.25rem 2.5rem; }
  .ex-gallery { padding: 0 1.25rem 4rem; gap: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
