/* =================================================================
   Tokens
   ================================================================= */
:root {
  --paper:        #f3ede1;
  --paper-deep:   #ece4d3;
  --ink:          #181613;
  --ink-soft:     #3a342c;
  --rule:         #c9bfa9;
  --rule-soft:    #ddd3bd;
  --accent:       #c5311c;
  --accent-deep:  #8e1f0f;
  --accent-soft:  #fbe3dd;
  --highlight:    #f4d35e;
  --success:      #2d6a4f;
  --error-bg:     #fde0db;
  --error-fg:     #8e1f0f;

  --font-display: 'Fraunces', 'Iowan Old Style', 'Georgia', serif;
  --font-body:    'Inter Tight', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  --max-w:        1240px;
  --pad-x:        clamp(20px, 4vw, 56px);
  --radius:       6px;
  --shadow-card:  0 1px 0 var(--rule), 0 12px 28px -22px rgba(24, 22, 19, .45);
}

/* =================================================================
   Reset / base
   ================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(at 10% 0%, rgba(197, 49, 28, .04) 0px, transparent 50%),
    radial-gradient(at 90% 100%, rgba(24, 22, 19, .04) 0px, transparent 50%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; }
button { font-family: inherit; }

::selection {
  background: var(--accent);
  color: var(--paper);
}

/* Subtle paper grain via SVG noise, applied as a pseudo-element so it
   doesn't intercept clicks. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  mix-blend-mode: multiply;
  z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.4   0 0 0 0 0.35   0 0 0 0 0.25   0 0 0 0.08 0'/></filter><rect width='240' height='240' filter='url(%23n)'/></svg>");
}

.main { flex: 1; position: relative; z-index: 1; }

/* =================================================================
   Topbar
   ================================================================= */
.topbar {
  border-bottom: 1px solid var(--rule);
  background: rgba(243, 237, 225, .85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px var(--pad-x);
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -.01em;
}
.brand__mark {
  color: var(--accent);
  transform: rotate(45deg);
  display: inline-block;
}
.topbar__crumb {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.topbar__crumb-slash { color: var(--accent); }
.topbar__nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
}
.topbar__link {
  text-decoration: none;
  font-size: 15px;
  color: var(--ink-soft);
  transition: color .15s ease;
}
.topbar__link:hover { color: var(--accent); }
.topbar__form { margin: 0; }

/* =================================================================
   Buttons
   ================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .01em;
  text-decoration: none;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .12s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.btn--solid {
  background: var(--ink);
  color: var(--paper);
}
.btn--solid:hover { background: var(--accent); transform: translateY(-1px); }
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.btn--ghost:hover { border-color: var(--ink); }
.btn--block { width: 100%; padding: 14px 20px; font-size: 15px; }
.btn--lg { padding: 14px 22px; font-size: 15px; }

/* =================================================================
   Hero
   ================================================================= */
.hero {
  border-bottom: 1px solid var(--rule);
}
.hero__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(48px, 8vw, 96px) var(--pad-x) clamp(40px, 6vw, 64px);
  position: relative;
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-deep);
  margin-bottom: 28px;
}
.hero__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.25); }
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(40px, 7vw, 88px);
  line-height: 1.02;
  letter-spacing: -.025em;
  margin: 0 0 24px;
  max-width: 14ch;
}
.hero__title em {
  font-style: italic;
  font-weight: 400;
  color: var(--ink-soft);
}
.hero__accent {
  color: var(--accent);
  position: relative;
  white-space: nowrap;
}
.hero__accent::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: .08em;
  height: .12em;
  background: var(--highlight);
  z-index: -1;
  transform: skewX(-8deg);
}
.hero__lede {
  font-size: clamp(17px, 1.6vw, 20px);
  max-width: 60ch;
  color: var(--ink-soft);
  margin: 0;
}
.hero__link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

/* =================================================================
   Grid of subdomain cards
   ================================================================= */
.grid-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(40px, 6vw, 72px) var(--pad-x);
}
.grid-wrap__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 12px;
  margin-bottom: 32px;
}
.grid-wrap__label {
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  font-size: 28px;
}
.grid-wrap__count {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.grid {
  list-style: none;
  padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.grid--compact { gap: 14px; }

.card {
  opacity: 0;
  transform: translateY(8px);
  animation: cardIn .55s cubic-bezier(.2,.7,.2,1) forwards;
  animation-delay: var(--delay, 0ms);
}
@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}
.card__link {
  display: block;
  height: 100%;
  text-decoration: none;
  color: inherit;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
  position: relative;
  overflow: hidden;
}
.card__link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, var(--accent-soft) 130%);
  opacity: 0;
  transition: opacity .25s ease;
}
.card__link:hover {
  transform: translateY(-3px);
  border-color: var(--ink);
  box-shadow: var(--shadow-card);
}
.card__link:hover::before { opacity: 1; }
.card__link > * { position: relative; }
.card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}
.card__icon {
  width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 12px;
  font-size: 22px;
  font-family: var(--font-display);
  font-weight: 900;
}
.card__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -.01em;
  margin: 0 0 8px;
}
.card__desc {
  margin: 0 0 24px;
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px dashed var(--rule);
}
.card__url {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}
.card__arrow {
  font-size: 18px;
  transition: transform .2s ease;
}
.card__link:hover .card__arrow { transform: translateX(4px); color: var(--accent); }

.card--compact .card__link { padding: 18px; }
.card--compact .card__title { font-size: 17px; }
.card--compact .card__desc { font-size: 13.5px; margin-bottom: 0; }

/* =================================================================
   Pills
   ================================================================= */
.pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--rule);
}
.pill--open  { background: var(--paper); color: var(--success); border-color: rgba(45,106,79,.3); }
.pill--gated { background: var(--paper); color: var(--accent-deep); border-color: rgba(142,31,15,.3); }

/* =================================================================
   CTA
   ================================================================= */
.cta {
  border-top: 1px solid var(--rule);
  background: var(--ink);
  color: var(--paper);
}
.cta__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(48px, 7vw, 96px) var(--pad-x);
  text-align: center;
}
.cta__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(32px, 5vw, 56px);
  margin: 0 0 16px;
  letter-spacing: -.02em;
}
.cta__lede { margin: 0 auto 28px; color: rgba(243,237,225,.75); max-width: 50ch; }
.cta__actions { display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.cta .btn--solid { background: var(--paper); color: var(--ink); }
.cta .btn--solid:hover { background: var(--accent); color: var(--paper); }
.cta .btn--ghost { color: var(--paper); border-color: rgba(243,237,225,.3); }
.cta .btn--ghost:hover { border-color: var(--paper); }

/* =================================================================
   Auth pages
   ================================================================= */
.auth {
  max-width: 520px;
  margin: 0 auto;
  padding: clamp(40px, 6vw, 80px) var(--pad-x);
}
.auth__panel {
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(28px, 4vw, 44px);
  box-shadow: var(--shadow-card);
}
.auth__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.auth__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -.02em;
  margin: 0 0 8px;
}
.auth__lede { color: var(--ink-soft); margin: 0 0 24px; }
.auth__divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.auth__divider::before, .auth__divider::after {
  content: ''; flex: 1; height: 1px; background: var(--rule);
}
.auth__providers { display: grid; gap: 10px; }
.auth__providers--top { margin-bottom: 4px; }
.auth__alt {
  margin-top: 22px;
  font-size: 14px;
  color: var(--ink-soft);
  text-align: center;
}
.auth__alt a { color: var(--accent); }

/* =================================================================
   Forms
   ================================================================= */
.form { display: grid; gap: 16px; }
.form__field { display: grid; gap: 6px; }
.form__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.form__hint { text-transform: none; letter-spacing: 0; color: var(--ink-soft); opacity: .8; }
.form__input {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form__input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(24,22,19,.08);
}

/* =================================================================
   OAuth provider buttons
   ================================================================= */
.provider {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 500;
  font-size: 14.5px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  transition: border-color .15s ease, transform .12s ease;
}
.provider:hover { border-color: var(--ink); transform: translateY(-1px); }
.provider--google .provider__name::before {
  content: 'G'; display: inline-block; margin-right: 8px;
  font-family: var(--font-display); font-weight: 900;
  color: #4285F4;
}
.provider--github .provider__name::before {
  content: '⌥'; display: inline-block; margin-right: 8px;
  font-family: var(--font-mono); font-weight: 700;
}

/* =================================================================
   Flash messages
   ================================================================= */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14.5px;
  margin-bottom: 18px;
  border: 1px solid var(--rule);
}
.flash--error { background: var(--error-bg); color: var(--error-fg); border-color: rgba(142,31,15,.25); }
.flash--info  { background: var(--paper-deep); color: var(--ink-soft); }

/* =================================================================
   Account page
   ================================================================= */
.account {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(32px, 5vw, 64px) var(--pad-x);
}
.account__panel { display: grid; gap: 28px; }
.account__h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  font-size: 24px;
  margin: 0;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 8px;
}
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 0;
  font-size: 15px;
}
.kv dt {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
  align-self: center;
}
.kv dd { margin: 0; }

/* =================================================================
   Subdomain placeholder
   ================================================================= */
.sub-hero {
  min-height: 70vh;
  display: grid;
  place-items: center;
  padding: clamp(40px, 6vw, 80px) var(--pad-x);
}
.sub-hero__inner {
  max-width: 720px;
  text-align: center;
}
.sub-hero__crumb {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 32px;
}
.sub-hero__crumb a { color: var(--ink-soft); text-decoration: none; }
.sub-hero__crumb a:hover { color: var(--accent); }
.sub-hero__icon {
  font-size: 56px;
  font-family: var(--font-display);
  font-weight: 900;
  margin-bottom: 16px;
}
.sub-hero__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(36px, 5vw, 64px);
  letter-spacing: -.02em;
  margin: 0 0 14px;
}
.sub-hero__desc {
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--ink-soft);
  margin: 0 0 16px;
}
.sub-hero__extra {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--paper-deep);
  padding: 10px 14px;
  border-radius: 8px;
  display: inline-block;
}
.sub-hero__meta {
  margin-top: 28px;
  display: inline-flex;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--paper-deep);
}
.mono { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); }

/* =================================================================
   Error pages
   ================================================================= */
.error {
  min-height: 70vh;
  display: grid;
  place-items: center;
  padding: 40px var(--pad-x);
}
.error__inner { text-align: center; max-width: 520px; }
.error__code {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  font-size: clamp(120px, 18vw, 220px);
  line-height: 1;
  color: var(--accent);
  letter-spacing: -.05em;
}
.error__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -.02em;
  margin: 0 0 12px;
}
.error__lede { color: var(--ink-soft); margin: 0 0 28px; }
.error__id { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); margin-bottom: 20px; }

/* =================================================================
   Footer
   ================================================================= */
.footer {
  border-top: 1px solid var(--rule);
  padding: 24px var(--pad-x);
  position: relative;
  z-index: 1;
}
.footer__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
}
.footer__mark { font-family: var(--font-display); font-weight: 900; }
.footer__meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }

/* =================================================================
   Responsive tweaks
   ================================================================= */
@media (max-width: 600px) {
  .topbar__inner { flex-wrap: wrap; }
  .topbar__crumb { order: 3; flex-basis: 100%; padding-top: 4px; }
  .footer__inner { flex-direction: column; gap: 8px; }
  .hero__title { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .card { opacity: 1; transform: none; animation: none; }
  .hero__dot { animation: none; }
}

/* =================================================================
   Ad slots — provider-agnostic. Specific providers/sizes are added
   via the slot wrapper class (.ad-slot--home_top, .ad-slot--adsense)
   if you need finer control.
   ================================================================= */
.ad-slot {
  margin: 28px auto;
  max-width: 728px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ad-slot::before {
  content: 'sponsored';
  position: absolute;
  top: -18px;
  left: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: .65;
}

/* House ads — your own promotional content. */
.house-ad {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 90px;
  padding: 18px 22px;
  background: var(--paper-deep);
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s ease, background .15s ease;
}
a.house-ad:hover { border-color: var(--ink); background: var(--paper); }
.house-ad__body { font-family: var(--font-display); font-size: 18px; font-weight: 600; text-align: center; }
.house-ad__placeholder {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
