/* css/main.css */
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@100;200;300;400;500;600;700;800;900&display=swap');

/* =========================================================================
   Design System & Tokens
   ========================================================================= */
:root {
  /* Colors */
  --color-primary: #af1c2e;
  --color-secondary: #111111;
  --color-tertiary: #f7f4f4;
  --color-neutral: #ffffff;
  --color-surface: #ffffff;
  --color-on-surface: #111111;
  --color-background: #f7f4f4;
  --color-text: #111111;
  --color-accent: #af1c2e;
  --color-border: rgba(17, 17, 17, 0.12);
  /* #1111111f */
  --color-muted: #6d6d6d;

  /* Spacing */
  --space-xs: 10px;
  --space-sm: 18px;
  --space-md: 32px;
  --space-lg: 40px;
  --space-xl: 64px;
  --space-gutter: 32px;

  /* Border Radius */
  --radius-none: 0px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
}

/* =========================================================================
   Base & Resets
   ========================================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Lexend', 'Anek Kannada', system-ui, -apple-system, sans-serif;
  background-color: var(--color-background);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-gutter);
  padding-right: var(--space-gutter);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-secondary);
  font-weight: 700;
  line-height: 1.2;
}

h1.headline-display {
  font-size: 3.5rem;
  /* Fallback for mobile, will scale on desktop */
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

h1.headline-lg {
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

h2.headline-md {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

h3.headline-sm {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

p.body-lg {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: var(--space-sm);
}

p.body-md,
div.body-md {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text);
}

p.body-sm,
span.body-sm {
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-muted);
}

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

.text-primary {
  color: var(--color-primary);
}

/* =========================================================================
   Components
   ========================================================================= */

/* Cards */
.card {
  background-color: var(--color-surface);
  color: var(--color-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: var(--space-md);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Lexend', 'Anek Kannada', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  height: 52px;
  padding: 9.6px 24px;
  border: 1px solid transparent;
  outline: none;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-neutral);
}

.btn-primary:hover {
  background-color: var(--color-secondary);
  color: var(--color-neutral);
}

.btn-secondary {
  background-color: var(--color-neutral);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn-secondary:hover {
  background-color: var(--color-primary);
  color: var(--color-neutral);
}

.btn-link {
  background-color: transparent;
  color: var(--color-secondary);
  height: auto;
  padding: 0;
  border: none;
  text-decoration: underline;
  font-weight: 400;
}

.btn-link:hover {
  color: var(--color-primary);
}

/* Chips */
.chip {
  display: inline-block;
  background-color: var(--color-tertiary);
  color: var(--color-primary);
  font-size: 0.75rem;
  /* 12px */
  font-weight: 700;
  border-radius: var(--radius-full);
  padding: 6px 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chip.active {
  background-color: var(--color-primary);
  color: var(--color-neutral);
  border-color: var(--color-primary);
}

/* Form Inputs */
.form-input {
  width: 100%;
  background-color: var(--color-neutral);
  color: var(--color-secondary);
  font-family: 'Lexend', 'Anek Kannada', sans-serif;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  border-color: var(--color-primary);
}

textarea.form-input {
  min-height: 120px;
  resize: vertical;
}

/* Table styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  margin-bottom: var(--space-md);
}

.font-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.font-table th,
.font-table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.font-table tr:last-child td {
  border-bottom: none;
}

.font-table th {
  background-color: var(--color-tertiary);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.font-table td.font-preview-cell {
  font-size: 1.5rem;
  line-height: 1.2;
  white-space: nowrap;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  margin-bottom: var(--space-sm);
  font-size: 0.875rem;
}

.breadcrumbs a {
  color: var(--color-muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
  color: var(--color-primary);
}

.breadcrumbs .separator {
  color: var(--color-muted);
}

.breadcrumbs .current {
  color: var(--color-secondary);
  font-weight: 600;
}

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

/* Navigation / Header */
header {
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-surface);
  padding: var(--space-sm) 0;
}

header .nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header .logo {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-secondary);
  text-decoration: none;
}

header .logo span {
  color: var(--color-primary);
}

header nav a {
  color: var(--color-secondary);
  text-decoration: none;
  font-weight: 500;
  margin-left: var(--space-sm);
}

header nav a:hover {
  color: var(--color-primary);
}

/* Hero Section */
.hero {
  padding: 24px 0 0 0;
  text-align: left;
  background-color: transparent;
  margin-bottom: 24px;
}

.hero-content {
  max-width: 800px;
  margin: 0;
}

.hero-subtitle {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hero-description {
  margin-bottom: var(--space-sm);
  color: var(--color-text);
}

/* Detail Page Layout */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

/* Metadata List */
.meta-list {
  list-style: none;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.meta-item:last-child {
  border-bottom: none;
}

.meta-label {
  font-weight: 700;
  color: var(--color-muted);
}

.meta-value {
  text-align: right;
  color: var(--color-secondary);
  font-weight: 500;
}

.meta-value a {
  color: var(--color-primary);
  text-decoration: none;
}

.meta-value a:hover {
  text-decoration: underline;
}

/* Type Tester */
.tester-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.tester-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: var(--color-tertiary);
  padding: 16px;
  border-radius: var(--radius-md);
  width: 100%;
}

.control-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
}

.control-row label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-muted);
  width: 140px;
  flex-shrink: 0;
}

.tester-slider {
  flex-grow: 1;
  accent-color: var(--color-primary);
  height: 6px;
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

/* License Block */
.license-block {
  background-color: var(--color-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  font-family: monospace;
  font-size: 0.875rem;
  white-space: pre-wrap;
  max-height: 400px;
  overflow-y: auto;
  margin-top: var(--space-xs);
  color: var(--color-secondary);
}

/* Footer */
footer {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-xl) 0 var(--space-md) 0;
  margin-top: var(--space-xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.footer-col h4 {
  margin-bottom: var(--space-xs);
}

.footer-col p {
  color: var(--color-muted);
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--color-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-sm);
  text-align: center;
}

/* Accessibility visible focus states */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* =========================================================================
   Media Queries & Responsiveness
   ========================================================================= */

@media (min-width: 768px) {
  h1.headline-display {
    font-size: 4.5rem;
    /* Scale up towards 144px but keep responsive */
  }

  h1.headline-lg {
    font-size: 3.5rem;
  }

  .detail-grid {
    grid-template-columns: 1fr 1.5fr;
  }

  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

@media (min-width: 1024px) {

  /* Match large desktop typography from design.md */
  h1.headline-display {
    font-size: 6.5rem;
    /* Large display scale */
  }

  h1.headline-lg {
    font-size: 4rem;
  }
}

/* ---------------------------------------
   Fonts listing (card style layout)
   ---------------------------------------- */
.fonts-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 16px;
  margin-bottom: 16px;
}

.font-item-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.font-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: background-color 0.15s ease, transform 0.15s ease;
  font-weight: 600;
}

.font-item:hover {
  transform: translateY(-2px);
  background-color: rgba(175, 28, 46, 0.02);
  border-color: var(--color-primary);
}

.font-left {
  flex: 1 1 auto;
  min-width: 0;
}

.font-right {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

.font-name {
  display: block;
  margin: 0;
}

.specimen-name {
  display: inline-block;
  font-size: 5rem;
  /* 48px */
  line-height: 1.1;
  font-weight: normal;
  margin-bottom: 8px;
  color: var(--color-secondary);
}

.font-desc {
  margin: 8px 0 12px 0;
  color: var(--color-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.font-desc strong {
  color: var(--color-secondary);
  font-weight: 700;
}

.font-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-weight: 400;
}

.badge {
  display: inline-block;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background-color: rgba(175, 28, 46, 0.05);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Make layout wrap better on small screens */
@media (max-width: 768px) {
  .font-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px;
  }

  .font-right {
    width: 100%;
    justify-content: flex-start;
    margin-top: 12px;
  }

  .specimen-name {
    font-size: 2.25rem;
  }
}