/* ============================================================
   matthewfacciani.com
   Playfair Display headings · Inter body · navy accent
   Light + dark mode (auto + manual toggle)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600&family=Inter:wght@300;400;500;600&display=swap');

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

/* ── light palette (default) ── */
:root {
  --bg:           #f8f7f3;
  --surface:      #ffffff;
  --surface-alt:  #f3f1ea;
  --border:       #e2dfd6;
  --border-hover: #c5c0b4;
  --text:         #1c1b18;
  --muted:        #57554f;
  --faint:        #9a9790;
  --accent:       #1b3a5c;
  --accent-mid:   #2a5480;
  --accent-bg:    #edf2f7;
  --accent-bdr:   #c2d4e3;
  --gold:         #946d18;
  --gold-bg:      #fbf6ea;
  --gold-bdr:     #e3cd83;
  --shadow:       0 1px 3px rgba(27,58,92,0.06), 0 4px 14px rgba(27,58,92,0.06);
  --shadow-hover: 0 8px 30px rgba(27,58,92,0.15);
  --dot:          rgba(27,58,92,0.07);

  --max-w:        720px;
  --font:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif:   'Playfair Display', Georgia, serif;
  --radius:       12px;
  --radius-sm:    7px;
  --transition:   0.22s ease;
}

/* ── dark palette ── */
:root[data-theme="dark"] {
  --bg:           #0f141a;
  --surface:      #181f29;
  --surface-alt:  #1e2733;
  --border:       #2a3441;
  --border-hover: #3a4757;
  --text:         #ebe9e3;
  --muted:        #a3aab5;
  --faint:        #6a7280;
  --accent:       #7fb0d8;
  --accent-mid:   #9cc4e6;
  --accent-bg:    #18242f;
  --accent-bdr:   #2c4258;
  --gold:         #d9b76a;
  --gold-bg:      #251f12;
  --gold-bdr:     #43391f;
  --shadow:       0 1px 3px rgba(0,0,0,0.3), 0 4px 14px rgba(0,0,0,0.3);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.45);
  --dot:          rgba(127,176,216,0.10);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:           #0f141a;
    --surface:      #181f29;
    --surface-alt:  #1e2733;
    --border:       #2a3441;
    --border-hover: #3a4757;
    --text:         #ebe9e3;
    --muted:        #a3aab5;
    --faint:        #6a7280;
    --accent:       #7fb0d8;
    --accent-mid:   #9cc4e6;
    --accent-bg:    #18242f;
    --accent-bdr:   #2c4258;
    --gold:         #d9b76a;
    --gold-bg:      #251f12;
    --gold-bdr:     #43391f;
    --shadow:       0 1px 3px rgba(0,0,0,0.3), 0 4px 14px rgba(0,0,0,0.3);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.45);
    --dot:          rgba(127,176,216,0.10);
  }
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}
body { min-height: 100vh; }

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

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

/* ── layout ── */
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 1.75rem; }

/* ── nav ── */
nav {
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner { display: flex; justify-content: space-between; align-items: center; padding: 1.05rem 0; gap: 1rem; }
.nav-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
  text-decoration: none;
}
.nav-name:hover { color: var(--accent); text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 1.4rem; }
.nav-links { display: flex; gap: 1.6rem; list-style: none; flex-wrap: wrap; }
.nav-links a {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  position: relative;
  transition: color var(--transition);
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -5px;
  width: 0; height: 1.5px;
  background: var(--accent);
  transition: width var(--transition);
}
.nav-links a:hover, .nav-links a.active { color: var(--accent); text-decoration: none; }
.nav-links a.active::after, .nav-links a:hover::after { width: 100%; }

/* ── theme toggle ── */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent-bdr); background: var(--accent-bg); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline-flex; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline-flex; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: inline-flex; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ── hero ── */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2.25rem;
  align-items: center;
  padding: 4rem 0 3.25rem;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: -1px;
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1.4px);
  background-size: 20px 20px;
  -webkit-mask-image: radial-gradient(ellipse 80% 100% at 30% 50%, #000 40%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 100% at 30% 50%, #000 40%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}
.hero-photo-wrap { position: relative; z-index: 1; flex-shrink: 0; }
.hero-photo {
  width: 120px; height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent-bdr), var(--shadow);
  display: block;
}
.hero-text { position: relative; z-index: 1; border-left: 2px solid var(--accent); padding-left: 1.5rem; }
.hero-text h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.hero-text .tagline { font-size: 15px; color: var(--muted); line-height: 1.6; max-width: 470px; }
.hero-text .credentials {
  margin-top: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── sections ── */
.section { padding: 2.25rem 0; border-top: 1px solid var(--border); }
.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 1.1rem;
}
.section-heading {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

/* ── card grid ── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.3rem;
  text-decoration: none;
  display: block;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-bdr);
  text-decoration: none;
}
.card-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
  line-height: 1.3;
}
.card-desc { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.card-link { font-size: 12px; color: var(--accent); margin-top: 10px; display: block; font-weight: 500; }

/* ── award badges ── */
.award-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.award-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid var(--gold-bdr);
  border-radius: 5px;
  padding: 3px 8px;
  white-space: nowrap;
}

/* ── featured book card ── */
.book-feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex;
  gap: 1.4rem;
  align-items: flex-start;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  text-decoration: none;
  grid-column: 1 / -1;
}
.book-feature:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-bdr);
  text-decoration: none;
}
.book-cover { width: 84px; flex-shrink: 0; border-radius: 5px; overflow: hidden; box-shadow: 0 3px 14px rgba(0,0,0,0.22); }
.book-cover img { width: 100%; display: block; }
.book-cover-placeholder {
  width: 84px; min-height: 122px;
  background: var(--accent);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-family: var(--font-serif);
  font-size: 12px;
  text-align: center;
  padding: 0.75rem;
  line-height: 1.4;
  flex-shrink: 0;
}
.book-feature-text { flex: 1; }
.book-feature-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 6px;
}
.book-feature-title { font-family: var(--font-serif); font-size: 19px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.book-feature-sub { font-size: 12.5px; color: var(--muted); font-style: italic; margin-bottom: 7px; }
.book-feature-desc { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ── prose ── */
.prose { font-size: 15px; color: var(--muted); line-height: 1.8; max-width: 610px; }
.prose p + p { margin-top: 1rem; }
.prose a { color: var(--accent); }
.prose strong { color: var(--text); font-weight: 600; }

/* ── research domains ── */
.domain { padding: 1.4rem 0; }
.domain + .domain { border-top: 1px solid var(--border); }
.domain h3 {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.domain p { font-size: 14px; color: var(--muted); line-height: 1.75; max-width: 610px; }

/* ── publications ── */
.pub-list { list-style: none; display: flex; flex-direction: column; gap: 1.15rem; }
.pub-list li {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.65;
  padding-left: 1.1rem;
  border-left: 2px solid var(--accent-bdr);
}
.pub-list li .pub-title { color: var(--text); font-weight: 600; }
.pub-list li .pub-venue { font-style: italic; }
.pub-list li a { color: var(--accent); }

/* ── badge pill ── */
.badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent-bdr);
  border-radius: 5px;
  padding: 4px 10px;
  margin-bottom: 0.7rem;
}

/* ── page hero ── */
.page-hero { padding: 2.75rem 0 2.25rem; border-bottom: 1px solid var(--border); }
.page-hero h1 { font-family: var(--font-serif); font-size: 30px; font-weight: 600; margin-bottom: 6px; color: var(--text); letter-spacing: -0.01em; }
.page-hero p { font-size: 14.5px; color: var(--muted); max-width: 560px; }

/* ── audio card ── */
.audio-card {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  background: var(--accent-bg);
  border: 1px solid var(--accent-bdr);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin-top: 14px;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow);
}
.audio-card:hover {
  background: color-mix(in srgb, var(--accent-bg) 60%, var(--surface));
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
}
.audio-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
:root[data-theme="dark"] .audio-icon { background: var(--accent); color: var(--bg); }
.audio-text { flex: 1; }
.audio-title { font-family: var(--font-serif); font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.audio-desc { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.audio-cta { flex-shrink: 0; font-size: 13px; font-weight: 500; color: var(--accent); white-space: nowrap; }


.tool-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
}
.tool-preview:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); border-color: var(--accent-bdr); }
.tool-preview-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: top;
  display: block;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.tool-preview-img-placeholder {
  width: 100%;
  height: 180px;
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.tool-preview-body { padding: 1.1rem 1.25rem; flex: 1; display: flex; flex-direction: column; }
.tool-preview-title { font-family: var(--font-serif); font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.tool-preview-desc { font-size: 12.5px; color: var(--muted); line-height: 1.6; flex: 1; }
.tool-preview-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.coming-soon { font-size: 11px; font-weight: 600; color: var(--faint); letter-spacing: 0.05em; }

/* ── tool card grid ── */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }


.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--accent-bdr); }
.tool-card-text { flex: 1; }
.tool-card-title { font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.tool-card-desc { font-size: 13px; color: var(--muted); line-height: 1.6; }
.tool-btn {
  flex-shrink: 0;
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--accent-bdr);
  border-radius: 7px;
  padding: 7px 15px;
  white-space: nowrap;
  text-decoration: none;
  background: var(--accent-bg);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.tool-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }

/* ── contact form ── */
.contact-form { display: flex; flex-direction: column; gap: 1.1rem; max-width: 480px; }
.contact-form label { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 5px; display: block; }
.contact-form input, .contact-form textarea {
  width: 100%; padding: 11px 13px; font-size: 14px; font-family: var(--font);
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface);
  color: var(--text); outline: none; transition: border-color var(--transition), box-shadow var(--transition);
}
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.contact-form textarea { min-height: 130px; resize: vertical; }
.submit-btn {
  align-self: flex-start; background: var(--accent); color: #fff; border: none;
  border-radius: 7px; padding: 11px 24px; font-size: 14px; font-weight: 500;
  cursor: pointer; font-family: var(--font); transition: background var(--transition); letter-spacing: 0.02em;
}
.submit-btn:hover { background: var(--accent-mid); }

/* ── footer ── */
footer { border-top: 1px solid var(--border); margin-top: 3rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem 0; flex-wrap: wrap; gap: 0.75rem; }
.footer-left { font-family: var(--font-serif); font-size: 13px; color: var(--faint); font-style: italic; }
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { font-size: 12.5px; color: var(--muted); text-decoration: none; font-weight: 500; }
.footer-links a:hover { color: var(--accent); }

/* ── responsive ── */
@media (max-width: 540px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding: 2.5rem 0 2rem; }
  .hero::before { -webkit-mask-image: radial-gradient(ellipse 100% 60% at 50% 30%, #000 40%, transparent 75%); mask-image: radial-gradient(ellipse 100% 60% at 50% 30%, #000 40%, transparent 75%); }
  .hero-text { border-left: none; border-top: 2px solid var(--accent); padding-left: 0; padding-top: 1rem; }
  .hero-photo-wrap, .hero-text .tagline { margin-left: auto; margin-right: auto; }
  .nav-inner { flex-wrap: wrap; }
  .nav-links { gap: 1rem; }
  .book-feature, .tool-card { flex-direction: column; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .book-grid { grid-template-columns: 1fr !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { transition: none; }
  *, *::before, *::after { transition: none !important; }
  .card:hover, .book-feature:hover, .tool-card:hover { transform: none; }
}
