/* daviddaniels.ai — personal hub (dark theme: blue-gray + amber/gold) */

:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-elevated: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --accent-soft: rgba(245, 158, 11, 0.15);
  --border: #334155;
  --radius: 12px;
  --radius-lg: 20px;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "Fraunces", Georgia, serif;
  --space: 1.5rem;
  --max-width: 42rem;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.4);
}

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, #1e293b 50%, #0f172a 100%);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 52rem;
  margin: 0 auto;
  padding: 0 var(--space);
  position: relative;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space) 0;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  margin: 0 calc(-1 * var(--space));
  padding-left: var(--space);
  padding-right: var(--space);
}

.logo {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

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

/* Main */
main {
  flex: 1;
  padding: 3rem 0 4rem;
}

/* Hero */
.hero {
  margin-bottom: 3.5rem;
  position: relative;
  padding: 2.5rem 0;
}

.hero::before {
  content: "";
  position: absolute;
  top: -20%;
  right: -10%;
  width: 70%;
  max-width: 420px;
  height: 140%;
  background: radial-gradient(ellipse at center, var(--accent-soft) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero-visual {
  position: absolute;
  left: -5%;
  bottom: 0;
  width: 50%;
  max-width: 280px;
  height: 180px;
  background: linear-gradient(135deg, var(--accent-soft) 0%, rgba(245, 158, 11, 0.05) 100%);
  border-radius: var(--radius-lg);
  z-index: 0;
}

.hero-with-photo {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.hero-photo-wrap {
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.hero-photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 22%;
  border: 3px solid var(--accent);
  box-shadow: var(--shadow);
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.hero h1,
.hero .tagline,
.hero-text h1,
.hero-text .tagline {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}

.tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin: 0;
}

/* Sections */
.section {
  margin-bottom: 3rem;
  position: relative;
}

.section h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section h2::before {
  content: "";
  width: 4px;
  height: 1.4em;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  border-radius: 2px;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 1.25rem;
}

/* Cards (demo + Medium) */
.link-section .card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.link-section .card .card-icon {
  color: var(--accent);
}

.link-section .card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.card-primary {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent-soft);
}

.card-primary:hover {
  box-shadow: var(--shadow-hover), 0 0 0 1px var(--accent-soft);
}

.btn-demo {
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  border: 1px solid var(--border);
}

.card-icon {
  font-size: 1.25rem;
  color: var(--accent);
}

.card-title {
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.card-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Demo tiles (square, side by side) */
.demo-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.demo-tiles-single {
  grid-template-columns: 1fr;
  justify-items: center;
  width: 18rem;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.demo-tiles-single .demo-tile {
  width: 100%;
  min-width: 0;
}

.demo-tile {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--accent);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  padding: 0;
}

.demo-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.demo-tile-img {
  flex: 1;
  min-height: 0;
  background-size: cover;
  background-position: center;
}

.demo-tile-img-chat {
  background-color: var(--bg-elevated);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.demo-tile-img-chat:not([style*="background-image"]) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='1.5'%3E%3Cpath d='M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.86 9.86 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z'/%3E%3C/svg%3E");
  background-size: 48px 48px;
}

/* Pitch deck preview: slide-shaped rectangle with first slide + play button */
.deck-preview-wrap {
  width: 100%;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.deck-preview-btn {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

.deck-preview-btn:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.deck-preview-slide {
  position: absolute;
  inset: 0;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #1a1916;
}

.deck-preview-slide:not([style*="background-image"]) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='1.5'%3E%3Cpath d='M9 12h6M9 16h6M7 8h10a2 2 0 012 2v8a2 2 0 01-2 2H7a2 2 0 01-2-2v-8a2 2 0 012-2z'/%3E%3C/svg%3E");
  background-size: 48px 48px;
}

.deck-preview-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: background 0.2s, transform 0.2s;
}

.deck-preview-play::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-40%, -50%);
  border-width: 10px 0 10px 18px;
  border-style: solid;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.95);
}

.deck-preview-btn:hover .deck-preview-play {
  background: rgba(0, 0, 0, 0.75);
  transform: translate(-50%, -50%) scale(1.05);
}

.demo-tile-img-deck {
  background-color: var(--bg-elevated);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.demo-tile-deck .demo-tile-img-deck {
  background-size: cover;
  background-position: left center;
}

.demo-tile-img-deck:not([style*="background-image"]) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='1.5'%3E%3Cpath d='M9 12h6M9 16h6M7 8h10a2 2 0 012 2v8a2 2 0 01-2 2H7a2 2 0 01-2-2v-8a2 2 0 012-2z'/%3E%3C/svg%3E"), linear-gradient(135deg, var(--accent-soft) 0%, var(--bg-elevated) 100%);
  background-size: 48px 48px, cover;
}

.demo-tile-body {
  flex-shrink: 0;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.demo-tile-title {
  font-weight: 600;
  font-size: 1rem;
  display: block;
}

.demo-tile-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.demo-tile-primary {
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent-soft);
}

.demo-tile-primary:hover {
  box-shadow: var(--shadow-hover), 0 0 0 1px var(--accent-soft);
}

/* Writing tiles (3×3 grid, square) */
.writing-grid-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.writing-tile {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--accent);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.writing-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.writing-tile-img {
  flex: 1;
  min-height: 0;
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--bg-elevated) 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Zoom in and crop white: slight top crop */
.writing-tile-hard-part .writing-tile-img {
  background-size: 110%;
  background-position: center 8%;
}

/* Zoom in to remove top/bottom white */
.writing-tile-when-change .writing-tile-img {
  background-size: 130%;
  background-position: center center;
}

/* Zoom in to remove left/right white */
.writing-tile-brain-heart .writing-tile-img {
  background-size: 115%;
  background-position: center center;
}

/* Reorg: zoom in, align to top so head isn't cut off */
.writing-tile-reorg .writing-tile-img {
  background-size: 115%;
  background-position: center 28%;
}

/* Medium icon: light background; icon via img so it shows (path: images/Medium-icon-black-dot.png) */
.writing-tile-more .writing-tile-img {
  background: #f2f2f2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.writing-tile-more .writing-tile-img img {
  width: 65%;
  height: auto;
  max-height: 75%;
  object-fit: contain;
  display: block;
}

/* If Medium icon image fails to load, show an "M" */
.writing-tile-more .writing-tile-img .medium-m-fallback {
  display: none;
  font-size: 3.5rem;
  font-weight: 800;
  color: #000;
  font-family: var(--font-serif), serif;
}
.writing-tile-more .writing-tile-img .medium-m-fallback.show {
  display: block;
}

.writing-tile-title {
  flex-shrink: 0;
  min-height: 4.25em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.75rem 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
  border-top: 1px solid var(--border);
}

/* Social grid */
.connect-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: stretch;
}

.connect-tile {
  width: 10rem;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--accent);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.connect-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.connect-tile-img {
  flex: 1;
  min-height: 0;
  width: 100%;
  background-color: var(--bg-card);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

/* Show only the "in" logo; crop off ® on the right */
.connect-tile-linkedin .connect-tile-img {
  background-size: cover;
  background-position: left center;
  padding: 0;
  box-sizing: border-box;
}

.connect-tile-resume .connect-tile-img {
  background-size: cover;
  background-position: top center;
}

.connect-section .social-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.social-link:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-hover);
}

.social-link .social-arrow {
  color: var(--accent);
}

.social-name {
  font-size: 0.95rem;
}

.social-arrow {
  color: var(--accent);
  font-size: 1rem;
}

/* Footer */
.footer {
  padding: var(--space) 0;
  border-top: 1px solid var(--border);
  text-align: center;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(6px);
  margin: 0 calc(-1 * var(--space));
  padding-left: var(--space);
  padding-right: var(--space);
}

.footer-link {
  color: var(--text-muted);
}

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

/* Writing cards (Medium articles) */
.writing-grid {
  display: grid;
  gap: 1rem;
}

.writing-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.writing-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.writing-card-img {
  display: block;
  width: 100%;
  height: 140px;
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--bg-elevated) 100%);
  background-size: cover;
  background-position: center;
}

.writing-card-body {
  padding: 1rem 1.25rem;
}

.writing-card-title {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.35;
  display: block;
  margin-bottom: 0.25rem;
}

.writing-card-hint {
  font-size: 0.8rem;
  color: var(--accent);
}

/* Chat overlay & panel */
.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.chat-overlay[hidden] {
  display: none;
}

.chat-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 25, 22, 0.4);
  backdrop-filter: blur(4px);
}

.chat-panel {
  position: relative;
  width: 75vw;
  height: 75vh;
  max-width: 75vw;
  max-height: 75vh;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(26, 25, 22, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-demo-warning {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  background: #b91c1c;
  border-bottom: 3px solid #7f1d1d;
  font-size: 0.95rem;
  color: #fff;
  text-align: center;
  font-weight: 500;
}

.chat-demo-warning strong {
  font-weight: 700;
}

.chat-header {
  flex-shrink: 0;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-right: 3rem;
}

.chat-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.chat-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.chat-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: var(--border);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.chat-close:hover {
  background: #ddd;
}

/* Pitch deck overlay & carousel */
.deck-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.deck-overlay[hidden] {
  display: none;
}

.deck-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 25, 22, 0.5);
  backdrop-filter: blur(4px);
}

.deck-panel {
  position: relative;
  width: 90vw;
  max-width: 56rem;
  max-height: 90vh;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-hover);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.5rem 1.5rem 1.25rem;
}

.deck-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: var(--border);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.deck-close:hover {
  background: #ddd;
}

.deck-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin: 0 0 1rem;
  padding-right: 2.5rem;
}

.deck-carousel {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.deck-arrow {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border: 2px solid var(--accent);
  background: var(--bg-elevated);
  color: var(--accent);
  font-size: 2rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.deck-arrow:hover {
  background: var(--accent);
  color: var(--bg);
}

.deck-arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.deck-slide-wrap {
  flex: 1;
  min-width: 0;
  min-height: 20rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: var(--radius);
}

.deck-slide-img {
  max-width: 100%;
  max-height: 60vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.deck-counter {
  margin: 0.75rem 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.deck-pdf-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.deck-pdf-link:hover {
  text-decoration: underline;
}

.chat-audio-controls {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.85rem;
}

.chat-audio-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text);
}

.chat-audio-toggle input {
  width: 1rem;
  height: 1rem;
}

.chat-voice-label {
  margin-left: auto;
  color: var(--text-muted);
}

.chat-voice-error {
  display: none;
  width: 100%;
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: #b91c1c;
  background: rgba(185, 28, 28, 0.1);
  border-radius: 6px;
  flex-basis: 100%;
  order: 99;
}

.chat-voice-select {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  min-width: 10rem;
}

.chat-stop-voice {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.chat-stop-voice:hover {
  background: var(--border);
}
.chat-stop-voice:focus {
  outline: 2px solid var(--focus, #0a84ff);
  outline-offset: 2px;
}

.chat-lang-controls {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.85rem;
}

.chat-lang-label {
  color: var(--text-muted);
}

.chat-lang-controls .chat-voice-select {
  min-width: 8rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 12rem;
}

.chat-welcome {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

.chat-msg {
  max-width: 90%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  line-height: 1.5;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}

.chat-msg.assistant {
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
}

.chat-msg.error {
  align-self: flex-start;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.chat-msg .content {
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-form {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: var(--bg);
}

.chat-input-wrap {
  flex: 1;
  display: flex;
  gap: 0.35rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  font: inherit;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: none;
  min-height: 2.75rem;
  max-height: 8rem;
  background: var(--bg-elevated);
  color: var(--text);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-mic {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}

.chat-mic:hover {
  border-color: var(--accent);
  background: #fef8f6;
}

.chat-mic.chat-mic-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.chat-msg.assistant .chat-listen {
  display: block;
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
}

.chat-msg.assistant .chat-listen:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-send {
  flex-shrink: 0;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: #0f172a;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-send:hover:not(:disabled) {
  background: var(--accent-hover);
}

.chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

/* Responsive */
@media (max-width: 768px) {
  .writing-grid-tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .nav {
    gap: 1rem;
  }

  .demo-tiles {
    grid-template-columns: 1fr;
  }

  .connect-tiles {
    flex-direction: column;
  }

  .connect-tile {
    width: 100%;
    max-width: 12rem;
  }

  .connect-section .social-grid {
    grid-template-columns: 1fr;
  }

  .writing-grid-tiles {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    width: 95vw;
    height: 90vh;
    max-width: 95vw;
    max-height: 90vh;
  }

  .chat-overlay {
    padding: 0.5rem;
  }
}
