/* ========================================
   CSS Variables (Design Tokens)
   ======================================== */
:root {
  /* Colors - Light Mode */
  --background: hsl(40, 20%, 96%);
  --foreground: hsl(30, 10%, 12%);
  --card: hsl(40, 15%, 94%);
  --card-foreground: hsl(30, 10%, 12%);
  --primary: hsl(25, 25%, 35%);
  --primary-foreground: hsl(40, 20%, 96%);
  --secondary: hsl(35, 10%, 88%);
  --secondary-foreground: hsl(30, 10%, 25%);
  --muted: hsl(35, 10%, 90%);
  --muted-foreground: hsl(30, 8%, 45%);
  --accent: hsl(35, 12%, 85%);
  --accent-foreground: hsl(30, 10%, 20%);
  --destructive: hsl(0, 65%, 50%);
  --destructive-foreground: hsl(40, 20%, 96%);
  --border: hsl(35, 12%, 85%);
  --input: hsl(35, 12%, 88%);
  --ring: hsl(25, 25%, 35%);
  --radius: 0.25rem;

  /* Fonts */
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
}

/* Dark Mode removed for now */

/* ========================================
   Base Styles
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
  border-color: var(--border);
}

html {
  font-family: var(--font-sans);
}

body {
  margin: 0;
  background-color: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background-color: hsl(25, 25%, 35%, 0.2);
}

/* ========================================
   Layout
   ======================================== */
.main {
  min-height: 100vh;
  padding: 3rem 1.5rem;
}

@media (min-width: 768px) {
  .main {
    padding: 4rem 1.5rem;
  }
}

@media (min-width: 1024px) {
  .main {
    padding: 5rem 1.5rem;
  }
}

.container {
  max-width: 72rem;
  margin: 0 auto;
}

/* ========================================
   Header
   ======================================== */
.header {
  max-width: 36rem;
  margin-bottom: 2.5rem;
}

@media (min-width: 768px) {
  .header {
    margin-bottom: 3.5rem;
  }
}

@media (min-width: 1024px) {
  .header {
    margin-bottom: 4rem;
  }
}

.title {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--foreground);
  margin: 0 0 0.5rem 0;
}

@media (min-width: 768px) {
  .title {
    font-size: 1.875rem;
  }
}

.subtitle {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin: 0;
}

/* ========================================
   Content Grid
   ======================================== */
.content-grid {
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
  .content-grid {
    flex-direction: row;
    gap: 4rem;
  }
}

@media (min-width: 1280px) {
  .content-grid {
    gap: 6rem;
  }
}

/* ========================================
   Input Section
   ======================================== */
.input-section {
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .input-section {
    width: 380px;
  }
}

@media (min-width: 1280px) {
  .input-section {
    width: 420px;
  }
}

.textarea {
  display: block;
  width: 100%;
  min-height: 120px;
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--foreground);
  background-color: var(--background);
  border: 1px solid var(--input);
  border-radius: var(--radius);
  resize: vertical;
  transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}

@media (min-width: 1024px) {
  .textarea {
    min-height: 160px;
  }
}

.textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px hsl(25, 25%, 35%, 0.1);
}

.textarea::placeholder {
  color: var(--muted-foreground);
}

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
}

.trust-note {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.analyze-button {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--primary-foreground);
  background-color: var(--primary);
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  height: 2.5rem;
  cursor: pointer;
  transition: opacity 0.2s ease-out;
}

.analyze-button:hover {
  opacity: 0.9;
}

.analyze-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================
   Analysis Section
   ======================================== */
.analysis-section {
  flex: 1;
  min-width: 0;
  max-width: 32rem;
  margin-top: 3.5rem;
  font-family: var(--font-display);
}

@media (min-width: 1024px) {
  .analysis-section {
    margin-top: 0;
  }
}

.empty-state {
  display: none;
  color: hsl(30, 8%, 45%, 0.3);
  font-size: 0.875rem;
}

.loading-state {
  display: none;
  margin-top: 1rem;
  animation: fade-in 0.2s ease-out forwards;
}

.loading-header {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.loading-card {
  height: 48px;
  border-radius: calc(var(--radius) - 2px);
  margin-bottom: 0.75rem;
  background: linear-gradient(
    90deg,
    hsl(35, 10%, 90%, 0.35) 0%,
    hsl(35, 10%, 90%, 0.6) 50%,
    hsl(35, 10%, 90%, 0.35) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.loading-card--light {
  height: 52px;
}

.loading-card--medium {
  height: 64px;
}

.loading-card--heavy {
  height: 92px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (min-width: 1024px) {
  .empty-state {
    display: block;
  }
}

.analysis-results {
  animation: fade-in 0.3s ease-out forwards;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   Insight Blocks
   ======================================== */
.insights {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.insight-block {
  border-radius: calc(var(--radius) - 2px);
  padding: 1rem 1.25rem;
}

.insight-block--light {
  background-color: hsl(35, 10%, 90%, 0.3);
}

.insight-block--medium {
  background-color: hsl(35, 10%, 90%, 0.4);
}

.insight-block--heavy {
  background-color: hsl(35, 10%, 90%, 0.6);
  padding: 1.25rem;
  margin-top: 0.5rem;
}

.insight-text {
  color: var(--foreground);
  font-size: 1rem;
  line-height: 1.4;
  letter-spacing: -0.025em;
  margin: 0;
}

@media (min-width: 768px) {
  .insight-text {
    font-size: 1.125rem;
  }
}

.insight-text--prominent {
  font-size: 1.125rem;
  font-weight: 500;
}

@media (min-width: 768px) {
  .insight-text--prominent {
    font-size: 1.25rem;
  }
}

.insight-label {
  display: block;
  font-size: 0.625rem;
  color: hsl(30, 8%, 45%, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.625rem;
}

.insight-label--heavy {
  color: hsl(30, 8%, 45%, 0.6);
  margin-top: 0.75rem;
}

/* ========================================
   Tweak Link
   ======================================== */
.tweak-link {
  display: block;
  margin-top: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  letter-spacing: -0.025em;
  color: var(--muted-foreground);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease-out;
}

.tweak-link:hover {
  color: var(--foreground);
}

/* ========================================
   Rewrite Section
   ======================================== */
.rewrite-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid hsl(35, 12%, 85%, 0.4);
  animation: fade-in 0.3s ease-out forwards;
}

.rewrite-note {
  margin-top: 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.rewrite-framing {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0 0 0.75rem 0;
}

.rewrite-container {
  background-color: hsl(40, 20%, 96%, 0.6);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.rewrite-text {
  color: hsl(30, 10%, 12%, 0.9);
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre-wrap;
  margin: 0;
}

.rewrite-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
}

.action-link {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: -0.025em;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease-out;
}

.action-link--primary {
  color: hsl(30, 8%, 45%, 0.7);
}

.action-link--primary:hover {
  color: var(--muted-foreground);
}

.action-link--secondary {
  color: hsl(30, 8%, 45%, 0.5);
}

.action-link--secondary:hover {
  color: hsl(30, 8%, 45%, 0.7);
}

/* ========================================
   Reset Section
   ======================================== */
.reset-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.reset-button {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  margin-left: -1rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: color 0.2s ease-out, background-color 0.2s ease-out;
}

.reset-button:hover {
  color: var(--foreground);
  background-color: var(--accent);
}

/* ========================================
   Footer
   ======================================== */
.footer {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

@media (min-width: 768px) {
  .footer {
    margin-top: 8rem;
  }
}

.footer-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: hsl(30, 8%, 45%, 0.5);
  margin: 0;
}
