/**
 * Typography Base Styles
 * Defines all text-related styling
 * Path: /themes/custom/default/css/base/typography.css
 */

/* ===================================
   Headings
   =================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  margin-top: 0;
  margin-bottom: var(--space-md);
}

h1 {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-xl);
}

h2 {
  font-size: var(--font-size-3xl);
}

h3 {
  font-size: var(--font-size-2xl);
}

h4 {
  font-size: var(--font-size-xl);
}

h5 {
  font-size: var(--font-size-lg);
}

h6 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

/* Responsive headings */
@media (min-width: 768px) {
  h1 {
    font-size: var(--font-size-5xl);
  }

  h2 {
    font-size: var(--font-size-4xl);
  }

  h3 {
    font-size: var(--font-size-3xl);
  }
}

/* ===================================
   Paragraphs & Text
   =================================== */

p {
  margin-top: 0;
  margin-bottom: var(--space-md);
  line-height: var(--line-height-relaxed);
}

p:last-child {
  margin-bottom: 0;
}

/* Lead text - larger introductory paragraph */
.lead,
.text-lead {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-light);
  line-height: var(--line-height-relaxed);
}

/* Small text */
small,
.text-small {
  font-size: var(--font-size-sm);
}

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

/* ===================================
   Links
   =================================== */

a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-link-hover);
}

a:visited {
  color: var(--color-link-visited);
}

a:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Remove underline from linked images */
a img {
  border: none;
}

/* External links indicator (optional) */
a[href^="http"]:not([href*="yourdomain.com"])::after {
  content: " ↗";
  font-size: 0.875em;
}

/* ===================================
   Lists
   =================================== */

/* Reset list styles are in normalize.css */
/* Apply styles only when needed */

.list-styled,
.content ul,
.content ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-xl);
}

.list-styled ul,
.content ul {
  list-style-type: disc;
}

.list-styled ol,
.content ol {
  list-style-type: decimal;
}

.list-styled li,
.content li {
  margin-bottom: var(--space-sm);
  line-height: var(--line-height-relaxed);
}

.list-styled ul ul,
.content ul ul {
  list-style-type: circle;
}

.list-styled ul ul ul,
.content ul ul ul {
  list-style-type: square;
}

/* Definition lists */
dl {
  margin-top: 0;
  margin-bottom: var(--space-lg);
}

dt {
  font-weight: var(--font-weight-bold);
  margin-top: var(--space-md);
}

dd {
  margin-left: var(--space-xl);
  margin-bottom: var(--space-sm);
}

/* ===================================
   Inline text elements
   =================================== */

strong,
b {
  font-weight: var(--font-weight-bold);
}

em,
i {
  font-style: italic;
}

mark {
  background-color: #fff3cd;
  padding: 0.125em 0.25em;
}

del {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

ins {
  text-decoration: none;
  border-bottom: 2px solid var(--color-success);
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
  border-bottom: 1px dotted currentColor;
}

/* ===================================
   Code & Pre
   =================================== */

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 0.125em 0.375em;
  background-color: var(--color-gray-100);
  border-radius: var(--border-radius-sm);
}

kbd {
  background-color: var(--color-gray-800);
  color: var(--color-white);
  padding: 0.125em 0.5em;
  border: 1px solid var(--color-gray-700);
  border-radius: var(--border-radius-base);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

pre {
  display: block;
  margin-top: 0;
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  color: var(--color-text);
  background-color: var(--color-gray-100);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-base);
  overflow-x: auto;
}

pre code {
  padding: 0;
  background-color: transparent;
  border-radius: 0;
  font-size: inherit;
}

/* ===================================
   Blockquotes
   =================================== */

blockquote {
  margin: var(--space-xl) 0;
  padding: var(--space-md) var(--space-xl);
  border-left: 4px solid var(--color-primary);
  background-color: var(--color-bg-alt);
  font-size: var(--font-size-lg);
  font-style: italic;
  color: var(--color-text-light);
}

blockquote p:last-child {
  margin-bottom: 0;
}

blockquote cite {
  display: block;
  margin-top: var(--space-sm);
  font-size: var(--font-size-base);
  font-style: normal;
  color: var(--color-text-muted);
}

blockquote cite::before {
  content: "— ";
}

/* ===================================
   Horizontal Rules
   =================================== */

hr {
  margin: var(--space-2xl) 0;
  border: 0;
  border-top: var(--border-width) solid var(--color-border);
}

/* ===================================
   Text Utilities
   =================================== */

/* Alignment */
.text-left {
  text-align: left;
}

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

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

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

/* Transform */
.text-lowercase {
  text-transform: lowercase;
}

.text-uppercase {
  text-transform: uppercase;
}

.text-capitalize {
  text-transform: capitalize;
}

/* Weight */
.text-light {
  font-weight: var(--font-weight-light);
}

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

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

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

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

/* Size */
.text-xs {
  font-size: var(--font-size-xs);
}

.text-sm {
  font-size: var(--font-size-sm);
}

.text-base {
  font-size: var(--font-size-base);
}

.text-lg {
  font-size: var(--font-size-lg);
}

.text-xl {
  font-size: var(--font-size-xl);
}

/* Truncate */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Line clamp - limit to n lines */
.text-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===================================
   Reading Experience
   =================================== */

/* Optimal line length for reading */
.content,
.text-content {
  max-width: var(--content-max-width, 65ch);
}

/* Better text rendering */
.text-render-optimize {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===================================
   Selection
   =================================== */

::selection {
  background-color: var(--color-primary);
  color: var(--color-white);
  text-shadow: none;
}

::-moz-selection {
  background-color: var(--color-primary);
  color: var(--color-white);
  text-shadow: none;
}