/* ============================================
   HAIKU NEWS THEME - TYPOGRAPHY STYLES
   ============================================ */

/* ============================================
   FONT LOADING & FALLBACKS
   ============================================ */

/* Google Fonts will be loaded in functions.php */
/* Ensure proper fallbacks during loading */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("/assets/fonts/inter-variable.woff2") format("woff2");
}

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url("/assets/fonts/playfair-display-variable.woff2") format("woff2");
}

/* ============================================
   HEADING STYLES
   ============================================ */

/* H1 - Page Title */
h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-lg);
  text-wrap: balance;
}

h1 strong,
h1 .highlight {
  color: var(--color-accent);
}

/* H2 - Section Title */
h2 {
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--color-text-primary);
  margin-top: var(--spacing-2xl);
  margin-bottom: var(--spacing-lg);
  text-wrap: balance;
}

h2::before {
  content: "";
  display: block;
  width: 60px;
  height: 4px;
  background-color: var(--color-accent);
  margin-bottom: var(--spacing-md);
  border-radius: 2px;
}

/* H3 - Subsection */
h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text-primary);
  margin-top: var(--spacing-xl);
  margin-bottom: var(--spacing-md);
  text-wrap: balance;
}

/* H4 - Small Heading */
h4 {
  font-size: 1.5rem;
  font-weight: 600;
  font-family: var(--font-sans);
  line-height: 1.3;
  color: var(--color-text-primary);
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

/* H5 - Minor Heading */
h5 {
  font-size: 1.125rem;
  font-weight: 600;
  font-family: var(--font-sans);
  line-height: 1.4;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-sm);
}

/* H6 - Small Label */
h6 {
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-sans);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-sm);
}

/* ============================================
   PARAGRAPH & TEXT STYLES
   ============================================ */

p {
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  margin-bottom: var(--spacing-lg);
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
  color: var(--color-text-primary);
}

/* First paragraph of article - larger intro */
.wp-block-post-content > p:first-of-type,
article > p:first-of-type {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  font-style: italic;
  margin-bottom: var(--spacing-2xl);
}

/* Dropcap effect */
.drop-cap::first-letter,
p.drop-cap::first-letter {
  float: left;
  font-family: var(--font-serif);
  font-size: 3.2em;
  line-height: 0.8;
  padding-right: 0.1em;
  margin-bottom: -0.1em;
  color: var(--color-accent);
  font-weight: 700;
}

/* ============================================
   ARTICLE TYPOGRAPHY
   ============================================ */

.haiku-article-content {
  font-size: var(--font-size-base);
}

.haiku-article-content h2 {
  margin-top: var(--spacing-2xl);
}

.haiku-article-content h3 {
  margin-top: var(--spacing-xl);
}

.haiku-article-content p {
  max-width: 70ch;
  margin-left: auto;
  margin-right: auto;
}

.haiku-article-content ul,
.haiku-article-content ol {
  max-width: 70ch;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--spacing-xl);
}

.haiku-article-content li {
  margin-bottom: var(--spacing-md);
  line-height: var(--line-height-relaxed);
}

.haiku-article-content blockquote {
  margin-left: auto;
  margin-right: auto;
  max-width: 65ch;
  font-size: 1.25rem;
  margin-top: var(--spacing-2xl);
  margin-bottom: var(--spacing-2xl);
}

/* ============================================
   TEXT UTILITIES & VARIANTS
   ============================================ */

/* Lead text - larger introductory text */
.lead {
  font-size: 1.25rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
}

/* Muted text */
.text-muted {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
}

/* Small caps variant */
.text-small-caps {
  font-size: 0.9em;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Uppercase text */
.text-uppercase {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Underline effect */
.text-underline {
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* ============================================
   LINE HEIGHT VARIANTS
   ============================================ */

.lh-tight {
  line-height: var(--line-height-tight);
}

.lh-normal {
  line-height: var(--line-height-normal);
}

.lh-relaxed {
  line-height: var(--line-height-relaxed);
}

.lh-loose {
  line-height: var(--line-height-loose);
}

/* ============================================
   FONT WEIGHT VARIANTS
   ============================================ */

.fw-light {
  font-weight: var(--font-weight-light);
}

.fw-normal {
  font-weight: var(--font-weight-regular);
}

.fw-medium {
  font-weight: var(--font-weight-medium);
}

.fw-semibold {
  font-weight: var(--font-weight-semibold);
}

.fw-bold {
  font-weight: var(--font-weight-bold);
}

.fw-heavy {
  font-weight: var(--font-weight-heavy);
}

/* ============================================
   FONT SIZE VARIANTS
   ============================================ */

.fs-xs { font-size: var(--font-size-xs); }
.fs-sm { font-size: var(--font-size-sm); }
.fs-base { font-size: var(--font-size-base); }
.fs-md { font-size: var(--font-size-md); }
.fs-lg { font-size: var(--font-size-lg); }
.fs-xl { font-size: var(--font-size-xl); }
.fs-2xl { font-size: var(--font-size-2xl); }
.fs-3xl { font-size: var(--font-size-3xl); }

/* ============================================
   LETTER SPACING VARIANTS
   ============================================ */

.tracking-tight {
  letter-spacing: var(--letter-spacing-tight);
}

.tracking-normal {
  letter-spacing: var(--letter-spacing-normal);
}

.tracking-wide {
  letter-spacing: var(--letter-spacing-wide);
}

/* ============================================
   TEXT ALIGNMENT
   ============================================ */

.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-justify {
  text-align: justify;
}

/* ============================================
   ARTICLE METADATA
   ============================================ */

/* Author name in article header */
.haiku-article-header-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.haiku-article-author {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.haiku-article-author img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: block;
}

.haiku-article-author-name {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

/* Article meta (date, author, reading time) */
.haiku-article-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
}

.haiku-article-date {
  white-space: nowrap;
}

.haiku-article-read-time {
  white-space: nowrap;
}

/* ============================================
   BREADCRUMB TYPOGRAPHY
   ============================================ */

.haiku-breadcrumb {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
}

.haiku-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  list-style: none;
  margin: 0;
}

.haiku-breadcrumb li {
  margin: 0;
}

.haiku-breadcrumb li::after {
  content: "/";
  margin-left: var(--spacing-sm);
  color: var(--color-text-tertiary);
}

.haiku-breadcrumb li:last-child::after {
  content: "";
  margin-left: 0;
}

/* ============================================
   CODE TYPOGRAPHY
   ============================================ */

.haiku-code-block {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  background-color: var(--color-primary);
  color: var(--color-secondary);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius-md);
  overflow-x: auto;
  margin: var(--spacing-xl) 0;
  line-height: var(--line-height-normal);
}

.haiku-code-block code {
  font-family: var(--font-mono);
  background-color: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* ============================================
   QUOTE TYPOGRAPHY
   ============================================ */

.haiku-blockquote {
  border-left: 4px solid var(--color-accent);
  padding: var(--spacing-lg);
  padding-left: var(--spacing-2xl);
  margin: var(--spacing-xl) 0;
  background-color: var(--color-bg-light);
  font-size: 1.125rem;
  line-height: var(--line-height-relaxed);
  color: var(--color-text-secondary);
  font-style: italic;
  font-family: var(--font-serif);
}

.haiku-blockquote-author {
  margin-top: var(--spacing-md);
  font-size: var(--font-size-base);
  font-style: normal;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.haiku-blockquote-author::before {
  content: "— ";
}

/* ============================================
   EMPHASIS & HIGHLIGHTING
   ============================================ */

mark,
.highlight {
  background-color: rgba(139, 115, 85, 0.2);
  padding: 2px 4px;
  border-radius: var(--border-radius-xs);
}

strong,
.highlight-strong {
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

em,
.highlight-em {
  font-style: italic;
  color: var(--color-text-secondary);
}

/* ============================================
   RESPONSIVE TYPOGRAPHY
   ============================================ */

@media (max-width: 768px) {
  h1 {
    font-size: clamp(2rem, 5vw, 2.5rem);
  }

  h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
  }

  h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
  }

  h4 {
    font-size: 1.25rem;
  }

  p {
    text-align: left;
  }

  /* Remove dropcap on mobile */
  .drop-cap::first-letter,
  p.drop-cap::first-letter {
    float: none;
    font-size: 1em;
    margin-bottom: 0;
    padding-right: 0;
  }

  .lead {
    font-size: 1.125rem;
  }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: more) {
  h1, h2, h3, h4, h5, h6 {
    letter-spacing: 0;
  }

  p {
    letter-spacing: 0.025em;
  }
}

/* ============================================
   DYSLEXIA FRIENDLY (Optional)
   ============================================ */

@media (prefers-color-scheme: light) and (prefers-contrast: more) {
  body {
    font-family: "OpenDyslexic", var(--font-sans);
  }

  p {
    letter-spacing: 0.05em;
    word-spacing: 0.1em;
  }
}
