/* EDHDeckBuilder.com — dark fantasy MTG aesthetic
   Cinzel for headers, Outfit for body, deep purple + gold palette */

:root {
  --bg-base: #110e18;
  --bg-surface: #1a1525;
  --bg-surface-elevated: #241d33;
  --bg-surface-hover: #2d2440;

  --accent-gold: #d4af37;
  --accent-gold-bright: #eadd84;
  --accent-gold-dim: #997d24;
  --accent-glow: #b888ff;
  --accent-glow-soft: rgba(184, 136, 255, 0.15);
  --accent-glow-strong: rgba(184, 136, 255, 0.35);

  --text-main: #fcfbfd;
  --text-muted: #a49ab5;
  --text-faint: #6b6280;
  --text-dark: #110e18;

  --border-subtle: #2a2240;
  --border-mid: #3a2f55;
  --border-glow: #56457a;

  --mana-w: #f8f6d8;
  --mana-u: #c1d8e9;
  --mana-b: #cbc8c6;
  --mana-r: #f6a58b;
  --mana-g: #c3d6a4;
  --mana-c: #ccc9c5;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Outfit', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-main);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 50% 0%, rgba(45, 36, 64, 0.55) 0%, transparent 60%),
    radial-gradient(circle at 100% 30%, rgba(184, 136, 255, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 0% 70%, rgba(212, 175, 55, 0.04) 0%, transparent 50%);
  min-height: 100vh;
}

h1, h2, h3, h4, .brand, .logo {
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0;
}
h1 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.1; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.2; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent-glow); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-gold); }

.container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }

/* ---------- Header / Footer ---------- */
.site-header {
  border-bottom: 1px solid var(--border-subtle);
  padding: 1.25rem 0;
  background: rgba(17, 14, 24, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.logo {
  font-size: 1.35rem;
  color: var(--text-main);
  display: inline-flex;
  align-items: baseline;
  gap: 0;
}
.logo::after {
  content: ".com";
  color: var(--accent-gold);
  font-weight: 600;
}
.logo a { color: inherit; }
.logo a:hover { color: var(--text-main); }
.site-nav { display: flex; gap: 1.75rem; font-size: 0.95rem; }
.site-nav a {
  color: var(--text-muted);
  font-weight: 500;
}
.site-nav a:hover { color: var(--accent-glow); }

.site-footer {
  border-top: 1px solid var(--border-subtle);
  margin-top: 5rem;
  padding: 3rem 0 2rem;
  background: rgba(17, 14, 24, 0.4);
  font-size: 0.9rem;
  color: var(--text-muted);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.footer-logo {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}
.footer-grid h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  margin-bottom: 0.85rem;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 0.4rem; }
.footer-bottom {
  max-width: 1280px;
  margin: 2.5rem auto 0;
  padding: 1.5rem 1.5rem 0;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-faint);
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr; gap: 1.75rem; }
}

/* ---------- Buttons ---------- */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: var(--transition);
  border: 1px solid transparent;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-dim));
  color: var(--text-dark);
  padding: 0.85rem 1.5rem;
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, var(--accent-gold-bright), var(--accent-gold));
  box-shadow: 0 0 28px rgba(212, 175, 55, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: var(--text-dark);
}
.btn-primary[disabled],
.btn-primary.is-loading {
  opacity: 0.85;
  cursor: progress;
  transform: none;
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-mid);
  color: var(--text-main);
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-glow);
  color: var(--accent-glow);
}
.btn-block { display: flex; width: 100%; }

/* ---------- Surfaces ---------- */
.card-surface {
  background: rgba(26, 21, 37, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent-gold);
  margin-bottom: 1rem;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  border: 1px solid;
}
.alert-error {
  background: rgba(220, 60, 60, 0.1);
  border-color: rgba(220, 60, 60, 0.4);
  color: #ffb4b4;
}
.alert-warning {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.35);
  color: var(--accent-gold-bright);
}

/* ---------- Page shell ---------- */
.page-shell { display: block; }

/* ---------- Hero (home) ---------- */
.hero {
  padding: 4.5rem 0 3.5rem;
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3rem;
  align-items: center;
}
.hero-copy h1 {
  background: linear-gradient(180deg, #ffffff 0%, #d8cef5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 4px 30px rgba(184, 136, 255, 0.15);
  margin-bottom: 1.25rem;
}
.hero-lede {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 540px;
  margin-bottom: 1.75rem;
}
.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.8rem;
}
.hero-points span {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-muted);
}

.hero-panel {
  padding: 1.5rem;
}

@media (max-width: 900px) {
  .hero { padding: 3rem 0 2rem; }
  .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
}

/* ---------- Build form ---------- */
.build-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.build-form label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-muted);
}
.build-form textarea,
.build-form input,
.build-form select {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 0.85rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}
.build-form textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.5;
}
.build-form textarea::placeholder { color: var(--text-faint); }
.build-form textarea:focus,
.build-form input:focus,
.build-form select:focus {
  border-color: var(--border-glow);
  box-shadow: 0 0 0 3px var(--accent-glow-soft);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.form-help {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin: 0.25rem 0 0;
  line-height: 1.5;
}

/* loading state */
.build-progress {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 0.5rem;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(184, 136, 255, 0.06);
  border: 1px solid rgba(184, 136, 255, 0.25);
}
.build-progress[hidden] { display: none; }
.build-progress-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(184, 136, 255, 0.25);
  border-top-color: var(--accent-glow);
  animation: edh-spin 0.9s linear infinite;
  flex-shrink: 0;
}
@keyframes edh-spin { to { transform: rotate(360deg); } }
.build-progress-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  line-height: 1.4;
}
.build-progress-text strong {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}
.build-progress-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---------- Sections ---------- */
.section { padding: 3rem 0; }
.section-tight { padding: 1rem 0; }
.section-prose { padding: 4rem 0 5rem; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.section-head h2 { font-size: 1.5rem; color: var(--text-main); }
.section-head a {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.section-head a:hover { color: var(--accent-glow); }

.prose-block {
  max-width: 760px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.75;
}
.prose-block h2 {
  color: var(--text-main);
  margin-bottom: 1.25rem;
  text-align: center;
}
.prose-block strong { color: var(--accent-gold); font-weight: 600; }
.prose-block p { margin-bottom: 1.25rem; }

/* ---------- Recent decks grid (home) ---------- */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.deck-grid a {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0;
  overflow: hidden;
  transition: var(--transition);
  color: inherit;
}
.deck-grid a:hover {
  transform: translateY(-3px);
  border-color: var(--border-glow);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
.deck-grid img,
.deck-grid .image-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: linear-gradient(135deg, #2d2440, #1a1525);
}
.deck-grid .deck-summary-body {
  padding: 1rem 1.1rem 1.15rem;
}
.deck-grid h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  color: var(--text-main);
}
.deck-grid .deck-summary-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.deck-grid .deck-summary-kicker {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  font-weight: 600;
}

.empty-state {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-subtle);
}

/* ---------- Deck page hero ---------- */
.hero-deck {
  padding: 3rem 0 1.5rem;
}
.hero-grid-deck {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.5rem;
  align-items: flex-start;
}
.hero-art {
  width: 240px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--border-mid);
  background: linear-gradient(145deg, #3d2a5e, #1a1525);
}
.hero-art img {
  display: block;
  width: 100%;
  height: auto;
}
.hero-deck .hero-copy h1 {
  background: none;
  -webkit-text-fill-color: var(--accent-gold);
  color: var(--accent-gold);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 0.5rem;
}
.hero-deck .hero-lede {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.deck-prompt {
  background: rgba(0, 0, 0, 0.25);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent-glow);
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}
.deck-prompt strong {
  color: var(--text-main);
  font-weight: 600;
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
.meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.meta-chips span {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-mid);
  color: var(--text-muted);
}
.meta-chips span:first-child {
  color: var(--accent-gold);
  border-color: rgba(212, 175, 55, 0.4);
  background: rgba(212, 175, 55, 0.08);
  font-weight: 600;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

@media (max-width: 820px) {
  .hero-grid-deck { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero-art { width: 180px; margin: 0 auto; }
}

/* ---------- Deck list ---------- */
.deck-groups {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  padding: 1.5rem 0 3rem;
}
.deck-group {
  padding: 1.25rem 1.5rem 1.5rem;
}
.deck-group .section-head {
  margin: 0 0 0.85rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
}
.deck-group .section-head h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-main);
  margin: 0;
}
.deck-group .section-head > span {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}

/* card row — 3-column layout: thumb / main / aside */
.deck-card-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.95rem;
  padding: 0.6rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.025);
}
.deck-card-row:hover { background: rgba(184, 136, 255, 0.05); }
.deck-card-row:last-child { border-bottom: none; }

.deck-card-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
  position: relative;
}
.deck-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  display: block;
}
.deck-card-thumb-empty {
  background: linear-gradient(135deg, #2d2440, #1a1525);
}

.deck-card-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.deck-card-top {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-width: 0;
}
.deck-card-row .deck-card-main h3 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  letter-spacing: 0;
  text-transform: none;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.type-line {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
  margin: 0;
}
.deck-card-main .reason {
  font-size: 0.78rem;
  color: var(--text-faint);
  font-style: italic;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.deck-card-aside {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.mana-cost {
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
}

.price {
  font-family: 'Outfit', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: var(--accent-gold);
  font-weight: 600;
  text-align: right;
  min-width: 60px;
}

.buy-link,
a.buy-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-mid);
  color: var(--text-main);
  font-weight: 500;
  transition: var(--transition);
}
.buy-link:hover {
  background: var(--accent-gold);
  color: var(--text-dark);
  border-color: var(--accent-gold);
}

/* ---------- Deck page summary sidebar ---------- */
.deck-card-aside,
.deck-summary {
  /* used as sticky right rail on deck page when present */
}

.deck-summary {
  position: sticky;
  top: 90px;
  padding: 1.5rem;
  align-self: start;
}
.deck-summary-art {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #2d2440, #1a1525);
}
.deck-summary-art img { display: block; width: 100%; height: auto; }
.deck-summary-body { color: var(--text-main); }
.deck-summary-kicker {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.deck-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* deck-card-* layout when used as a top-level row container (deck page) */
.deck-card-top {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2.5rem;
  align-items: start;
}
@media (max-width: 1024px) {
  .deck-card-top { grid-template-columns: 1fr; }
  .deck-summary { position: static; }
}

.image-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #3d2a5e, #1a1525);
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 2.5rem;
  font-size: 0.9rem;
}
.pagination a,
.pagination span {
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.pagination a:hover {
  border-color: var(--accent-glow);
  color: var(--accent-glow);
}
.pagination .current,
.pagination [aria-current="page"] {
  background: var(--accent-glow-soft);
  border-color: var(--border-glow);
  color: var(--text-main);
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 720px) {
  .container { padding: 0 1.1rem; }
  .form-row { grid-template-columns: 1fr; }
  .section { padding: 2.25rem 0; }
  .section-prose { padding: 2.5rem 0 3rem; }
  .deck-card-row {
    grid-template-columns: 40px 1fr auto;
    gap: 0.6rem;
  }
  .deck-card-row .mana-cost,
  .deck-card-row .buy-link { display: none; }
  .price { min-width: auto; }
  .meta-chips span { font-size: 0.72rem; }
}
