@import "tailwindcss";
@import "@fontsource/noto-serif-sc/400.css";
@import "@fontsource/noto-serif-sc/500.css";
@import "@fontsource/noto-serif-sc/600.css";
@import "@fontsource/noto-sans-sc/400.css";
@import "@fontsource/noto-sans-sc/500.css";
@import "@fontsource/noto-sans-sc/600.css";
@import "@fontsource/geist-mono";

@theme {
  /* === Brand Colors (Terracotta) === */
  --color-brand: #c96442;
  --color-brand-hover: #b55a3a;
  --color-accent: #c96442;
  --color-accent-hover: #b55a3a;
  --color-accent-light: #d97757;
  --color-accent-bg: rgba(201, 100, 66, 0.08);

  /* === Canvas & Surfaces (Light) === */
  --color-white: #ffffff;
  --color-black: #141413;
  --color-background: #f5f4ed;
  --color-surface: #faf9f5;
  --color-surface-elevated: #faf9f5;
  --color-surface-secondary: #f0eee6;
  --color-surface-panel: #e8e6dc;

  /* === Neutral Scale (Light - warm-toned) === */
  --color-gray-50: #faf9f5;
  --color-gray-100: #f0eee6;
  --color-gray-200: #e8e6dc;
  --color-gray-300: #d1cfc5;
  --color-gray-400: #87867f;
  --color-gray-500: #5e5d59;
  --color-gray-600: #4d4c48;

  /* === Text Colors (Light) === */
  --color-text-primary: #141413;
  --color-text-secondary: #5e5d59;
  --color-text-tertiary: #87867f;
  --color-text-placeholder: #87867f;
  --color-text-inverse: #faf9f5;

  /* === Semantic Colors (Light) === */
  --color-green: #4a7c59;
  --color-green-bg: rgba(74, 124, 89, 0.10);
  --color-red: #b53333;
  --color-red-bg: rgba(181, 51, 51, 0.10);
  --color-yellow: #c49a3c;
  --color-yellow-bg: rgba(196, 154, 60, 0.10);
  --color-purple: #87867f;
  --color-purple-bg: rgba(135, 134, 127, 0.10);
  --color-orange: #c96442;
  --color-orange-bg: rgba(201, 100, 66, 0.10);

  /* === Borders & Dividers (Light) === */
  --color-border: #f0eee6;
  --color-border-light: #faf9f5;
  --color-divider: #e8e6dc;

  /* === Badge Tokens (Light) === */
  --color-badge-blue-bg: rgba(201, 100, 66, 0.10);
  --color-badge-blue-text: #c96442;
  --color-badge-green-bg: rgba(74, 124, 89, 0.10);
  --color-badge-green-text: #4a7c59;
  --color-badge-red-bg: rgba(181, 51, 51, 0.10);
  --color-badge-red-text: #b53333;
  --color-badge-gray-bg: rgba(135, 134, 127, 0.10);
  --color-badge-gray-text: #5e5d59;
  --color-badge-yellow-bg: rgba(196, 154, 60, 0.10);
  --color-badge-yellow-text: #9e7a2e;
  --color-badge-purple-bg: rgba(135, 134, 127, 0.10);
  --color-badge-purple-text: #87867f;
  --color-badge-orange-bg: rgba(201, 100, 66, 0.10);
  --color-badge-orange-text: #c96442;

  /* === Interactive === */
  --color-focus: rgba(56, 152, 236, 0.35);
  --color-ring: rgba(209, 207, 197, 0.5);
  --color-overlay-backdrop: rgba(20, 20, 19, 0.45);
  --color-selection-text: #faf9f5;

  /* === Fonts === */
  --font-serif: 'Noto Serif SC', Georgia, 'Noto Serif', serif;
  --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Geist Mono', 'SF Mono', 'Cascadia Code', ui-monospace, monospace;

  /* === Border Radius === */
  --radius-sm: 6px;
  --radius-button: 8px;
  --radius-card: 8px;
  --radius-card-sm: 6px;
  --radius-pill: 9999px;
  --radius-image: 16px;
  --radius-input: 12px;
  --radius-modal: 12px;
  --radius-language: 8px;

  /* === Shadows (Warm Ring System) === */
  --shadow-subtle: 0 0 0 1px #e8e6dc;
  --shadow-card: 0 0 0 1px #f0eee6;
  --shadow-card-hover: 0 0 0 1px #e8e6dc, rgba(0, 0, 0, 0.05) 0px 4px 24px;
  --shadow-panel: 0 0 0 1px #f0eee6;
  --shadow-elevated: rgba(0, 0, 0, 0.05) 0px 4px 24px, 0 0 0 1px #f0eee6;
  --shadow-modal: rgba(0, 0, 0, 0.08) 0px 8px 32px, 0 0 0 1px #e8e6dc;
  --shadow-button: 0 0 0 0px #d1cfc5, 0 0 0 1px #e8e6dc;
  --shadow-button-hover: 0 0 0 0px #d1cfc5, 0 0 0 1px #d1cfc5;
  --shadow-focus: 0 0 0 3px rgba(56, 152, 236, 0.3);
  --shadow-ring: 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-whisper: rgba(0, 0, 0, 0.05) 0px 4px 24px;

  /* === Typography Tracking === */
  --tracking-display: -0.035em;
  --tracking-heading: -0.025em;
  --tracking-title: -0.015em;
  --tracking-normal: 0;
}

/* ==================== Dark Mode (Warm Charcoal) ==================== */
html.dark {
  --color-white: #141413;
  --color-black: #faf9f5;
  --color-background: #141413;
  --color-surface: #30302e;
  --color-surface-elevated: #30302e;
  --color-surface-secondary: #3d3d3a;
  --color-surface-panel: #30302e;

  --color-brand: #c96442;
  --color-brand-hover: #b55a3a;
  --color-accent: #c96442;
  --color-accent-hover: #b55a3a;
  --color-accent-light: #d97757;
  --color-accent-bg: rgba(201, 100, 66, 0.12);

  --color-gray-50: #141413;
  --color-gray-100: #30302e;
  --color-gray-200: #3d3d3a;
  --color-gray-300: #4d4c48;
  --color-gray-400: #87867f;
  --color-gray-500: #b0aea5;
  --color-gray-600: #d1cfc5;

  --color-text-primary: #faf9f5;
  --color-text-secondary: #b0aea5;
  --color-text-tertiary: #87867f;
  --color-text-placeholder: #5e5d59;
  --color-text-inverse: #141413;

  --color-green: #6b9e7a;
  --color-green-bg: rgba(107, 158, 122, 0.15);
  --color-red: #d45555;
  --color-red-bg: rgba(212, 85, 85, 0.15);
  --color-yellow: #d4a84b;
  --color-yellow-bg: rgba(212, 168, 75, 0.15);
  --color-purple: #87867f;
  --color-purple-bg: rgba(135, 134, 127, 0.15);
  --color-orange: #c96442;
  --color-orange-bg: rgba(201, 100, 66, 0.15);

  --color-border: #30302e;
  --color-border-light: #3d3d3a;
  --color-divider: #30302e;

  --color-badge-blue-bg: rgba(201, 100, 66, 0.15);
  --color-badge-blue-text: #c96442;
  --color-badge-green-bg: rgba(107, 158, 122, 0.15);
  --color-badge-green-text: #6b9e7a;
  --color-badge-red-bg: rgba(212, 85, 85, 0.15);
  --color-badge-red-text: #d45555;
  --color-badge-gray-bg: rgba(135, 134, 127, 0.15);
  --color-badge-gray-text: #87867f;
  --color-badge-yellow-bg: rgba(212, 168, 75, 0.15);
  --color-badge-yellow-text: #d4a84b;
  --color-badge-purple-bg: rgba(135, 134, 127, 0.15);
  --color-badge-purple-text: #87867f;
  --color-badge-orange-bg: rgba(201, 100, 66, 0.15);
  --color-badge-orange-text: #c96442;

  --color-focus: rgba(56, 152, 236, 0.4);
  --color-ring: rgba(176, 174, 165, 0.3);
  --color-overlay-backdrop: rgba(0, 0, 0, 0.65);

  --shadow-subtle: 0 0 0 1px #30302e;
  --shadow-card: 0 0 0 1px #30302e;
  --shadow-card-hover: 0 0 0 1px #3d3d3a;
  --shadow-panel: 0 0 0 1px #30302e;
  --shadow-elevated: 0 0 0 1px #30302e;
  --shadow-modal: 0 0 0 1px #30302e;
  --shadow-button: 0 0 0 0px #30302e, 0 0 0 1px #30302e;
  --shadow-button-hover: 0 0 0 0px #30302e, 0 0 0 1px #4d4c48;
  --shadow-focus: 0 0 0 3px rgba(56, 152, 236, 0.4);
  --shadow-ring: 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-whisper: rgba(0, 0, 0, 0.2) 0px 4px 24px;
}

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

html {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
  scroll-behavior: smooth;
  min-height: 100vh;
  height: 100%;
}

body {
  background: var(--color-background);
  color: var(--color-text-primary);
  min-height: 100vh;
  height: 100%;
  font-size: 16px;
  line-height: 1.6;
}

html.dark body {
  background: var(--color-background);
  color: var(--color-text-primary);
}

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

/* ==================== Typography Utilities ==================== */
.text-display {
  font-family: var(--font-serif);
  font-size: 48px;
  line-height: 1.10;
  font-weight: 500;
  letter-spacing: var(--tracking-display);
}

.text-hero {
  font-family: var(--font-serif);
  font-size: 36px;
  line-height: 1.20;
  font-weight: 500;
  letter-spacing: var(--tracking-heading);
}

.text-heading {
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 1.20;
  font-weight: 500;
  letter-spacing: var(--tracking-heading);
}

.text-title {
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.20;
  font-weight: 500;
  letter-spacing: var(--tracking-title);
}

.text-body-lg {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.60;
  font-weight: 400;
}

.text-body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.60;
  font-weight: 400;
}

.text-body-sm {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.50;
  font-weight: 400;
}

.text-caption {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.43;
  font-weight: 400;
}

.text-label {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.43;
  font-weight: 500;
  letter-spacing: 0.12px;
}

.text-micro {
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.60;
  font-weight: 400;
  letter-spacing: 0.096px;
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-400);
}

/* ==================== Focus ==================== */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* ==================== Animation ==================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-slide-up {
  animation: slideUp 0.4s ease-out;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* ==================== Gradient Backgrounds ==================== */
.bg-gradient-hero {
  background: linear-gradient(180deg, var(--color-surface-secondary) 0%, var(--color-background) 100%);
}

html.dark .bg-gradient-hero {
  background: linear-gradient(180deg, var(--color-surface-secondary) 0%, var(--color-background) 100%);
}

/* ==================== Card Hover Transitions ==================== */
.transition-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.transition-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
}

/* ==================== Button Transitions ==================== */
.transition-button {
  transition: all 0.15s ease;
}

.transition-button:hover {
  transform: translateY(-0.125rem);
}

.transition-button:active {
  transform: scale(0.97);
}

/* ==================== Brand Utilities ==================== */
.bg-gradient-brand {
  background: linear-gradient(135deg, #c96442 0%, #b55a3a 100%);
}

html.dark .bg-gradient-brand {
  background: linear-gradient(135deg, #d97757 0%, #c96442 100%);
}

.text-gradient-brand {
  background: linear-gradient(135deg, #c96442 0%, #d97757 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

html.dark .text-gradient-brand {
  background: linear-gradient(135deg, #d97757 0%, #c96442 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.border-gradient-brand {
  border-color: #c96442;
}

html.dark .border-gradient-brand {
  border-color: #d97757;
}

/* gradient border-bottom trick (border-image doesn't work well with rounded corners) */
.border-gradient-b {
  position: relative;
}
.border-gradient-b::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #c96442;
}

html.dark .border-gradient-b::after {
  background: #d97757;
}

/* ==================== DeepL-style layout ==================== */
.translate-gradient-bar {
  background: #c96442;
  height: 3px;
  width: 40px;
  border-radius: 2px;
  margin: 0 auto;
  transition: width 0.3s ease;
}

html.dark .translate-gradient-bar {
  background: #d97757;
}

.translate-gradient-bar:hover {
  width: 60px;
}

/* Glow effect for translate button */
.translate-btn-glow {
  box-shadow: 0 4px 20px rgba(201, 100, 66, 0.25), 0 0 0 0 rgba(201, 100, 66, 0.15);
}

html.dark .translate-btn-glow {
  box-shadow: 0 4px 20px rgba(201, 100, 66, 0.3), 0 0 0 0 rgba(201, 100, 66, 0.15);
}

.translate-btn-glow:hover {
  box-shadow: 0 6px 28px rgba(201, 100, 66, 0.35), 0 0 0 4px rgba(201, 100, 66, 0.1);
}

html.dark .translate-btn-glow:hover {
  box-shadow: 0 6px 28px rgba(201, 100, 66, 0.4), 0 0 0 4px rgba(201, 100, 66, 0.15);
}

/* Streaming cursor blink */
@keyframes cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.streaming-cursor::after {
  content: '▋';
  animation: cursor-blink 1s ease infinite;
  color: var(--color-accent);
}
