← back to Goodquestion Ai

src/styles/global.css

648 lines

/* === goodquestion.ai — Global Styles === */
/* Modern indie-hacker / developer-blog aesthetic — 2024 refresh */

/* ─── Design tokens ─────────────────────────────────────────── */
:root {
  /* Dark-mode palette (default) */
  --bg-primary:       #0C0C0E;
  --bg-secondary:     #13131A;
  --bg-tertiary:      #1C1C28;
  --bg-glass:         rgba(19, 19, 26, 0.80);

  --text-primary:     #F0EEF8;
  --text-secondary:   #9B99B5;
  --text-muted:       #6B6985;

  --accent:           #E85D26;
  --accent-hover:     #FF7540;
  --accent-subtle:    rgba(232, 93, 38, 0.10);
  --accent-subtle-hover: rgba(232, 93, 38, 0.18);

  --border:           rgba(255, 255, 255, 0.07);
  --border-strong:    rgba(255, 255, 255, 0.14);

  --code-bg:          #0F0F18;
  --code-inline-bg:   #1A1A28;

  --success:          #4ade80;
  --warning:          #fbbf24;
  --danger:           #f87171;

  /* Typography */
  --font-body:   'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-display:'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-mono:   'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;

  /* Layout */
  --max-width:      740px;
  --content-width:  65ch;
  --header-height:  60px;

  /* Motion */
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 140ms;
  --duration-base: 220ms;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg:  0 12px 40px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-accent: 0 0 0 3px rgba(232, 93, 38, 0.35);

  /* Border radius */
  --radius-sm:  5px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  22px;
}

/* Light mode — graceful degradation if user has light preference */
@media (prefers-color-scheme: light) {
  :root {
    --bg-primary:    #FAFAF9;
    --bg-secondary:  #F4F3F0;
    --bg-tertiary:   #EEEDE9;
    --bg-glass:      rgba(250, 250, 249, 0.88);

    --text-primary:   #16141E;
    --text-secondary: #595470;
    --text-muted:     #8B88A6;

    --border:        rgba(0, 0, 0, 0.07);
    --border-strong: rgba(0, 0, 0, 0.14);

    --code-bg:          #F0EFF8;
    --code-inline-bg:   #ECEAF6;

    --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg:  0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.08);
  }
}

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

/* ─── Base ───────────────────────────────────────────────────── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: clamp(17px, 2.5vw, 19px);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* subtle gradient wash behind everything */
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(232, 93, 38, 0.06) 0%, transparent 70%);
  background-attachment: fixed;
}

/* ─── Focus states (WCAG AA) ─────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ─── Layout ─────────────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ─── Header ─────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.site-logo {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.3px;
  transition: color var(--duration-fast) var(--ease-out),
              opacity var(--duration-fast) var(--ease-out);
}

.site-logo:hover {
  color: var(--accent-hover);
  opacity: 0.92;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.site-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}

.site-nav a:hover {
  color: var(--text-primary);
  background: var(--border);
  text-decoration: none;
}

.site-nav a.active {
  color: var(--accent);
  background: var(--accent-subtle);
}

.site-nav a[target="_blank"] {
  color: var(--text-muted);
}
.site-nav a[target="_blank"]:hover {
  color: var(--text-secondary);
}

/* ─── Footer ─────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  margin-top: 5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration-fast);
}

.site-footer a:hover {
  color: var(--accent);
}

/* ─── Main Content ───────────────────────────────────────────── */
main {
  padding: 2.5rem 0 4rem;
  min-height: calc(100vh - var(--header-height) - 140px);
}

/* ─── Links ──────────────────────────────────────────────────── */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(232, 93, 38, 0.35);
  text-underline-offset: 3px;
  transition: color var(--duration-fast) var(--ease-out),
              text-decoration-color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: var(--accent-hover);
}

/* ─── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-primary);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-top: 2em;
  margin-bottom: 0.6em;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 900;
  margin-top: 0;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.3rem, 3vw, 1.65rem);
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--border);
}

h3 { font-size: clamp(1.1rem, 2.5vw, 1.3rem); }
h4 { font-size: 1.1rem; }

p {
  margin-bottom: 1.2em;
}

blockquote {
  border-left: 3px solid var(--accent);
  margin: 2em 0;
  padding: 1rem 1.25rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
}

blockquote p:last-child {
  margin-bottom: 0;
}

blockquote strong {
  color: var(--text-primary);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

ul, ol {
  padding-left: 1.5em;
  margin-bottom: 1.2em;
}

li {
  margin-bottom: 0.4em;
  line-height: 1.65;
}

strong {
  color: var(--text-primary);
  font-weight: 600;
}

em {
  color: var(--text-secondary);
}

/* ─── Code ───────────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

:not(pre) > code {
  background: var(--code-inline-bg);
  color: var(--accent);
  padding: 0.15em 0.45em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  font-size: 0.875em;
}

pre {
  background: var(--code-bg) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.4rem 1.5rem;
  overflow-x: auto;
  margin: 1.75em 0;
  line-height: 1.6;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 1em;
}

/* ─── Post card list (shared across pages) ───────────────────── */
.post-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Base .post-card — overrides from index.astro scoped styles build on this */
.post-card {
  display: block;
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  text-decoration: none;
  transition: border-color var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
}

.post-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}

.post-card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.post-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.post-card-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.post-card-tags {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

/* ─── Tags ───────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.2em 0.65em;
  border-radius: 999px;
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid rgba(232, 93, 38, 0.2);
  transition: background var(--duration-fast), border-color var(--duration-fast);
}

.tag:hover {
  background: var(--accent-subtle-hover);
}

/* ─── Post layout (reading view) ────────────────────────────── */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 5vw, 2.75rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
  letter-spacing: 0.02em;
}

/* Separator dots — applied in PostLayout scoped styles for specificity */

/* Reading column — capped at comfortable measure */
.post-content {
  font-size: clamp(1rem, 2vw, 1.1rem);
  max-width: var(--content-width);
}

.post-content img {
  max-width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin: 2em 0;
  box-shadow: var(--shadow-md);
}

.post-content a {
  font-weight: 500;
}

/* In-post headings — slightly smaller than page h1 */
.post-content h2 {
  font-size: clamp(1.25rem, 2.8vw, 1.5rem);
  margin-top: 2.5em;
}

.post-content h3 {
  font-size: clamp(1.05rem, 2.3vw, 1.2rem);
  margin-top: 2em;
}

/* ─── About page ─────────────────────────────────────────────── */
.about-content {
  max-width: 600px;
}

.about-content h1 {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  margin-bottom: 0.5rem;
}

.about-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 2rem;
  font-style: italic;
}

/* ─── Hero / Index ───────────────────────────────────────────── */
/* Kept for backward compat (used by pages that render a .hero div) */
.hero {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  margin-bottom: 0.6rem;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* ─── Section heading ────────────────────────────────────────── */
.section-heading {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 2.5rem 0 1.25rem;
  padding-bottom: 0;
  border-bottom: none;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .container {
    padding: 0 1.1rem;
  }

  .post-meta {
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
  }

  .post-meta span + span::before {
    display: none;
  }

  .site-nav {
    gap: 0;
  }

  .site-nav a {
    padding: 0.35rem 0.5rem;
    font-size: 0.83rem;
  }

  pre {
    font-size: 0.82rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
  }
}

/* ─── Video embeds ───────────────────────────────────────────── */
.video-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.video-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1rem;
  border-bottom: none;
  padding-bottom: 0;
}

.video-wrapper {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.video-wrapper video,
.video-wrapper iframe {
  width: 100%;
  display: block;
  border-radius: var(--radius-md);
  aspect-ratio: 16 / 9;
}

.video-wrapper video {
  background: #000;
}

.youtube-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}

.youtube-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-embed {
  margin: 1.75rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.video-embed video {
  width: 100%;
  display: block;
  background: #000;
  aspect-ratio: 16 / 9;
}

/* ─── Utilities ──────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}