/*
 * jessewang.com — shared styles
 *
 * Typography system (matches background-agents.com):
 *   Display / headings : Playfair Display
 *   Body text          : Source Serif Pro
 *   UI chrome          : Inter
 *   Code / tech tags   : JetBrains Mono
 */

/* ================================================================
   Theme tokens
   ================================================================ */

:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --text: #e2e8f0;
  --text-heading: #ffffff;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-bg: rgba(56, 189, 248, 0.1);
  --accent-border: rgba(56, 189, 248, 0.2);
  --green: #4ade80;
  --green-bg: rgba(74, 222, 128, 0.1);
  --green-border: rgba(74, 222, 128, 0.3);
  --green-bg-hover: rgba(74, 222, 128, 0.2);
  --border: #334155;
  --form-submit-text: #0f172a;
  color-scheme: dark light;
}

/*
 * Light palette — single source of truth.
 * Applied via system preference OR manual toggle.
 */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f5f0;
    --bg-card: #ffffff;
    --text: #3a3a3a;
    --text-heading: #1a1a1a;
    --text-muted: #6b7280;
    --accent: #0c7cc4;
    --accent-hover: #0a6aab;
    --accent-bg: rgba(12, 124, 196, 0.08);
    --accent-border: rgba(12, 124, 196, 0.2);
    --green: #16a34a;
    --green-bg: rgba(22, 163, 74, 0.08);
    --green-border: rgba(22, 163, 74, 0.25);
    --green-bg-hover: rgba(22, 163, 74, 0.15);
    --border: #d4d4cd;
    --form-submit-text: #ffffff;
  }
}

[data-theme="light"] {
  --bg: #f5f5f0;
  --bg-card: #ffffff;
  --text: #3a3a3a;
  --text-heading: #1a1a1a;
  --text-muted: #6b7280;
  --accent: #0c7cc4;
  --accent-hover: #0a6aab;
  --accent-bg: rgba(12, 124, 196, 0.08);
  --accent-border: rgba(12, 124, 196, 0.2);
  --green: #16a34a;
  --green-bg: rgba(22, 163, 74, 0.08);
  --green-border: rgba(22, 163, 74, 0.25);
  --green-bg-hover: rgba(22, 163, 74, 0.15);
  --border: #d4d4cd;
  --form-submit-text: #ffffff;
}

/* ================================================================
   Reset & base
   ================================================================ */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Source Serif Pro', Georgia, serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ================================================================
   Theme toggle
   ================================================================ */

.theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 100;
  padding: 0;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun  { display: none;  }
.theme-toggle .icon-moon { display: block; }

[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none;  }

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-sun  { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: none;  }
}

/* ================================================================
   Header
   ================================================================ */

.header {
  padding: 80px 0 0 0;
  margin-bottom: 0;
}

.name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 42px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.name .accent {
  color: var(--accent);
}

.tagline {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 16px;
  font-style: italic;
  font-weight: 400;
  color: var(--text-muted);
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

/* ================================================================
   Sections
   ================================================================ */

.section {
  padding: 48px 0;
  border-bottom: 1px solid var(--border);
}

.section:last-of-type {
  border-bottom: none;
}

.section-label {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
}

.section p {
  font-family: 'Source Serif Pro', Georgia, serif;
  color: var(--text);
  font-size: 18px;
  line-height: 1.7;
  margin-bottom: 16px;
}

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

.section a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 400;
  transition: color 0.2s;
}

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

/* ================================================================
   Availability badge
   ================================================================ */

.availability-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  color: var(--green);
  padding: 10px 18px;
  border-radius: 6px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: all 0.2s;
  margin-bottom: 24px;
}

.availability-badge:hover {
  background: var(--green-bg-hover);
  border-color: var(--green);
}

.availability-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ================================================================
   Services
   ================================================================ */

.service {
  margin-bottom: 24px;
}

.service:last-child {
  margin-bottom: 0;
}

.service-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 500;
  color: var(--text-heading);
  font-size: 18px;
  margin-bottom: 6px;
}

.service-desc {
  font-family: 'Source Serif Pro', Georgia, serif;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.65;
}

/* ================================================================
   Tech tags
   ================================================================ */

.tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
}

.tech span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  padding: 4px 12px;
  border-radius: 4px;
}

/* ================================================================
   Lists (example-items & detail-items)
   ================================================================ */

.example-items,
.detail-items {
  list-style: none;
  margin: 16px 0;
}

.example-items li,
.detail-items li {
  padding: 8px 0;
  padding-left: 20px;
  position: relative;
  font-family: 'Source Serif Pro', Georgia, serif;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.65;
}

.detail-items li {
  padding: 12px 0 12px 20px;
  border-bottom: 1px solid var(--border);
}

.detail-items li:last-child {
  border-bottom: none;
}

.example-items li::before,
.detail-items li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.example-items strong,
.detail-items strong {
  color: var(--text-heading);
  font-weight: 600;
}

/* ================================================================
   Contact form
   ================================================================ */

.contact-form {
  margin: 24px 0 32px 0;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--text);
  font-family: 'Source Serif Pro', Georgia, serif;
  font-size: 15px;
  line-height: 1.5;
  transition: border-color 0.2s, background-color 0.3s, color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-submit {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--form-submit-text);
  background: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 10px 24px;
  cursor: pointer;
  transition: all 0.2s;
}

.form-submit:hover {
  background: var(--accent-hover);
}

.form-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-status {
  margin-top: 12px;
  font-size: 14px;
  min-height: 20px;
}

.form-status.success { color: var(--green); }
.form-status.error   { color: #f87171; }

/* ================================================================
   Back nav (case-study pages)
   ================================================================ */

.back {
  display: inline-block;
  padding: 80px 0 0 0;
  margin-bottom: 48px;
}

.back a {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* ================================================================
   Case-study headings (h1 used outside .name)
   ================================================================ */

h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 32px;
  font-weight: 400;
  color: var(--text-heading);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.subtitle {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 48px;
}

/* Case-study p (outside .section context) */
p {
  font-family: 'Source Serif Pro', Georgia, serif;
  color: var(--text);
  font-size: 18px;
  line-height: 1.7;
  margin-bottom: 16px;
}

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

/* ================================================================
   Footer
   ================================================================ */

.footer {
  padding: 40px 0;
  text-align: center;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text-muted);
  font-size: 13px;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
}

.footer-social a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

.footer-social svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* ================================================================
   Responsive
   ================================================================ */

@media (max-width: 640px) {
  .header {
    padding-top: 48px;
  }

  .name {
    font-size: 34px;
  }

  .back {
    padding-top: 48px;
  }

  h1 {
    font-size: 26px;
  }

  .section {
    padding: 36px 0;
  }
}
