/* ============================================================
   COMPONENTS.CSS - Reusable UI Components
   ============================================================

   This file contains pre-built, reusable component classes that
   leverage tokens.css. Use these in sections to maintain visual
   consistency and reduce code duplication.

   PHILOSOPHY:
   - components.css defines the WHAT (visual appearance)
   - Section BEM styles define the WHERE (layout/positioning)

   USAGE IN SECTIONS:
   Combine component classes with section-specific BEM classes:
   <div class="card my-section__card">...</div>

   TABLE OF CONTENTS:
   1. Reset & Base
   2. Layout (Container, Section)
   3. Typography
   4. Buttons
   5. Badges
   6. Cards
   7. Section Headers
   8. Icon Boxes
   9. Grids
   10. Lists
   11. Links
   12. Form Elements
   13. Images & Media
   14. Dividers
   15. Icons (Lucide)

   ============================================================ */

/* ============================================================
   1. RESET & BASE
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Honor the HTML hidden attribute even when author CSS sets display */
[hidden] {
    display: none !important;
}

/* Global scrollbar styling — Firefox + WebKit, brand-tinted */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-40) transparent;
}
*::-webkit-scrollbar {
    width: 0.8rem;
    height: 0.8rem;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background-color: var(--primary-30);
    border-radius: var(--radius-full);
    border: 0.2rem solid transparent;
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-60);
}
*::-webkit-scrollbar-corner {
    background: transparent;
}

html {
    font-size: 62.5%; /* 1rem = 10px */
    scroll-behavior: smooth;
    scroll-padding-top: 9rem; /* sticky header (~5.4rem) + breathing room */
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

body {
    font-family: var(--font-secondary);
    font-size: var(--text-m);
    line-height: 1.6;
    color: var(--text-body);
    background: var(--bg-body);
}

/* ============================================================
   2. LAYOUT
   ============================================================ */

/* Section wrapper - provides consistent vertical rhythm */
section,
.section {
    width: 100%;
    padding: var(--section-padding-y) var(--section-padding-x);
}

/* Header/Footer base padding */
header,
footer {
    padding-inline: var(--section-padding-x);
}

/* Container - centers and constrains content */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
}

/* Container variants */
.container--narrow {
    max-width: 80rem;
}

.container--wide {
    max-width: 160rem;
}

.container--full {
    max-width: 100%;
}

/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--weight-semibold);
    line-height: 1.2;
    color: var(--text-title);
    font-family: var(--font-primary);
}

h1 {
    font-size: var(--text-4xl);
}
h2 {
    font-size: var(--text-3xl);
}
h3 {
    font-size: var(--text-2xl);
}
h4 {
    font-size: var(--text-xl);
}
h5 {
    font-size: var(--text-l);
}
h6 {
    font-size: var(--text-m);
}

/* Body text */
p,
span {
    font-family: var(--font-secondary);
}

/* Utilities */
/* Text colors */
.text-primary {
    color: var(--primary);
}
.text-secondary {
    color: var(--secondary);
}
.text-muted {
    color: var(--text-body);
    opacity: 0.7;
}
.text-title {
    color: var(--text-title);
}
.text-body {
    color: var(--text-body);
}
.text-light {
    color: var(--text-light);
}
.text-dark {
    color: var(--text-dark);
}
.text-success {
    color: var(--success);
}
.text-error {
    color: var(--error);
}

/* Text sizes */
.text-xs {
    font-size: var(--text-xs);
}
.text-s {
    font-size: var(--text-s);
}
.text-m {
    font-size: var(--text-m);
}
.text-l {
    font-size: var(--text-l);
}
.text-xl {
    font-size: var(--text-xl);
}
.text-2xl {
    font-size: var(--text-2xl);
}

/* Text weights */
.text-light {
    font-weight: var(--weight-light);
}
.text-regular {
    font-weight: var(--weight-regular);
}
.text-medium {
    font-weight: var(--weight-medium);
}
.text-semibold {
    font-weight: var(--weight-semibold);
}
.text-bold {
    font-weight: var(--weight-bold);
}

/* Lead text - larger intro paragraphs */
.lead {
    font-size: var(--text-l);
    line-height: 1.5;
    color: var(--text-body);
}

/* ============================================================
   4. BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-s) var(--space-xl);
    font-family: var(--font-primary);
    font-size: var(--text-s);
    font-weight: var(--weight-semibold);
    text-decoration: none;
    border-radius: var(--radius-s);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    white-space: nowrap;
}

/* Primary button */
.btn--primary {
    background: var(--primary);
    color: var(--always-light);
}

.btn--primary:hover {
    background: var(--primary-d-1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-m);
}

/* Secondary button */
.btn--secondary {
    background: var(--secondary);
    color: var(--always-light);
}

.btn--secondary:hover {
    background: var(--secondary-d-1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-m);
}

/* Outline button */
.btn--outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn--outline:hover {
    background: var(--primary);
    color: var(--always-light);
}

/* Ghost button - subtle, no border */
.btn--ghost {
    background: transparent;
    color: var(--text-body);
}

.btn--ghost:hover {
    background: var(--dark-10);
}

/* Light button - for dark backgrounds */
.btn-light {
    background: var(--always-light);
    color: var(--always-dark);
}

.btn--light:hover {
    background: var(--light-90);
    transform: translateY(-2px);
    box-shadow: var(--shadow-m);
}

/* Button sizes */
.btn--s {
    padding: var(--space-xs) var(--space-m);
    font-size: var(--text-xs);
}

.btn--l {
    padding: var(--space-m) var(--space-2xl);
    font-size: var(--text-m);
}

/* Button with icon only */
.btn--icon {
    padding: var(--space-s);
    aspect-ratio: 1;
}

/* ============================================================
   5. BADGES
   ============================================================ */

.badge {
    display: inline-block;
    padding: var(--space-2xs) var(--space-s);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-s);
    background: var(--bg-surface);
    color: var(--text-body);
    border: 1px solid var(--border-primary);
    width: fit-content;
}

.badge-primary {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary-30);
}

.badge-secondary {
    background: var(--secondary-10);
    color: var(--secondary);
    border-color: var(--secondary-30);
}

.badge-tertiary {
    background: var(--tertiary-10);
    color: var(--tertiary);
    border-color: var(--tertiary-30);
}

.badge-success {
    background: var(--success-10);
    color: var(--success);
    border-color: var(--success-30);
}

.badge-error {
    background: var(--error-10);
    color: var(--error);
    border-color: var(--error-30);
}

/* Pill badge - fully rounded */
.badge--pill {
    border-radius: var(--radius-full);
    padding: var(--space-2xs) var(--space-m);
}

/* ============================================================
   6. CARDS
   ============================================================ */

/* Base card */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-l);
    overflow: hidden;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-0.4rem);
    box-shadow: var(--shadow-m);
}

/* Card without hover effect */
.card--static {
    transform: none;
}

.card--static:hover {
    transform: none;
    box-shadow: none;
}

/* Card image container */
.card__image {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card:hover .card__image img {
    transform: scale(1.05);
}

/* Card content area */
.card__content {
    padding: var(--space-l);
}

/* Card title */
.card__title {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--text-title);
    margin-bottom: var(--space-xs);
}

/* Card description */
.card__text {
    font-size: var(--text-m);
    color: var(--text-body);
    line-height: 1.6;
}

/* Card footer - for buttons, links, meta */
.card__footer {
    padding: var(--space-m) var(--space-l);
    border-top: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-m);
}

/* Card variants */
.card--bordered {
    border-width: 2px;
}

.card--shadow {
    border: none;
    box-shadow: var(--shadow-m);
}

.card--shadow:hover {
    box-shadow: var(--shadow-l);
}

/* ============================================================
   7. SECTION HEADERS
   ============================================================

   Centered intro block typically used at the top of sections.
   Contains badge, title, and description.

   Usage:
   <div class="section-header">
     <span class="badge badge-primary section-header__badge">Our Services</span>
     <h2 class="section-header__title">What We Offer</h2>
     <p class="section-header__description">Description text here</p>
   </div>
   ============================================================ */

.section-header {
    text-align: center;
    max-width: 70rem;
    margin-inline: auto;
    margin-bottom: var(--space-3xl);
}

.section-header__badge {
    margin-bottom: var(--space-m);
}

.section-header__title {
    font-size: var(--text-3xl);
    font-weight: var(--weight-medium);
    color: var(--text-title);
    margin-bottom: var(--space-m);
}

.section-header__description {
    font-size: var(--text-l);
    color: var(--text-body);
    line-height: 1.6;
    opacity: 0.85;
}

/* Left-aligned variant */
.section-header--left {
    text-align: left;
    margin-inline: 0;
}

/* Compact variant - less bottom margin */
.section-header--compact {
    margin-bottom: var(--space-xl);
}

/* ============================================================
   8. ICON BOXES
   ============================================================

   Styled containers for icons, commonly used in feature cards.

   Usage:
   <div class="icon-box">
     <i data-lucide="star"></i>
   </div>
   ============================================================ */

.icon-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 5.6rem;
    height: 5.6rem;
    border-radius: var(--radius-m);
    background: var(--primary-10);
    color: var(--primary);
    flex-shrink: 0;
}

.icon-box svg,
.icon-box .lucide {
    width: 2.8rem;
    height: 2.8rem;
}

/* Size variants */
.icon-box--sm {
    width: 4rem;
    height: 4rem;
}

.icon-box--sm svg,
.icon-box--sm .lucide {
    width: 2rem;
    height: 2rem;
}

.icon-box--lg {
    width: 7.2rem;
    height: 7.2rem;
}

.icon-box--lg svg,
.icon-box--lg .lucide {
    width: 3.6rem;
    height: 3.6rem;
}

/* Color variants */
.icon-box--secondary {
    background: var(--secondary-10);
    color: var(--secondary);
}

.icon-box--tertiary {
    background: var(--tertiary-10);
    color: var(--tertiary);
}

.icon-box--success {
    background: var(--success-10);
    color: var(--success);
}

.icon-box--light {
    background: var(--light-20);
    color: var(--always-light);
}

/* Circle variant */
.icon-box--circle {
    border-radius: var(--radius-full);
}

/* Outlined variant */
.icon-box--outline {
    background: transparent;
    border: 2px solid var(--primary-30);
}

/* ============================================================
   9. GRIDS
   ============================================================

   Responsive grid utilities for common layouts.
   Use in combination with section BEM for positioning.

   Usage:
   <div class="grid grid--3">
     <div class="card">...</div>
     <div class="card">...</div>
     <div class="card">...</div>
   </div>
   ============================================================ */

.grid {
    display: grid;
    gap: var(--space-l);
}

.grid--2 {
    grid-template-columns: repeat(2, 1fr);
}
.grid--3 {
    grid-template-columns: repeat(3, 1fr);
}
.grid--4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Auto-fit grids - responsive without media queries */
.grid--auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(28rem, 1fr));
}

.grid--auto-fit-sm {
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
}

/* Gap variants */
.grid--gap-s {
    gap: var(--space-s);
}
.grid--gap-m {
    gap: var(--space-m);
}
.grid--gap-xl {
    gap: var(--space-xl);
}
.grid--gap-2xl {
    gap: var(--space-2xl);
}

/* ============================================================
   10. LISTS
   ============================================================ */

/* Check list - items with check icons */
.list-check {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
}

.list-check__item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-s);
    font-size: var(--text-m);
    color: var(--text-body);
}

.list-check__item::before {
    content: "";
    width: 2rem;
    height: 2rem;
    background: var(--success);
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
    mask-size: contain;
    mask-repeat: no-repeat;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

/* Bullet list - simple styled bullets */
.list-bullet {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.list-bullet__item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-s);
    font-size: var(--text-m);
    color: var(--text-body);
}

.list-bullet__item::before {
    content: "";
    width: 0.6rem;
    height: 0.6rem;
    background: var(--primary);
    border-radius: var(--radius-full);
    flex-shrink: 0;
    margin-top: 0.7rem;
}

/* Inline list - horizontal items */
.list-inline {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-m);
}

/* ============================================================
   11. LINKS
   ============================================================ */

/* Standard link */
.link {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.link:hover {
    color: var(--primary-d-1);
    text-decoration: underline;
}

/* Link with arrow */
.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--primary);
    text-decoration: none;
    font-weight: var(--weight-medium);
    transition: gap 0.2s ease;
}

.link-arrow:hover {
    gap: var(--space-s);
}

.link-arrow::after {
    content: "→";
    transition: transform 0.2s ease;
}

.link-arrow:hover::after {
    transform: translateX(0.3rem);
}

/* Subtle link - less prominent */
.link-subtle {
    color: var(--text-body);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* ============================================================
   12. FORM ELEMENTS
   ============================================================ */

/* Input base */
.input {
    width: 100%;
    padding: var(--space-s) var(--space-m);
    font-family: var(--font-secondary);
    font-size: var(--text-m);
    color: var(--text-body);
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-s);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-20);
}

.input::placeholder {
    color: var(--text-body);
    opacity: 0.5;
}

/* Textarea */
.textarea {
    min-height: 12rem;
    resize: vertical;
}

/* Select */
.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-s) center;
    background-size: 2rem;
    padding-right: var(--space-2xl);
}

/* Label */
.label {
    display: block;
    font-size: var(--text-s);
    font-weight: var(--weight-medium);
    color: var(--text-title);
    margin-bottom: var(--space-xs);
}

/* Form group - label + input combo */
.form-group {
    margin-bottom: var(--space-m);
}

/* Input with icon */
.input-group {
    position: relative;
}

.input-group__icon {
    position: absolute;
    left: var(--space-m);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-body);
    opacity: 0.5;
    pointer-events: none;
}

.input-group .input {
    padding-left: var(--space-3xl);
}

/* ============================================================
   13. IMAGES & MEDIA
   ============================================================ */

/* Responsive image */
.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Image with rounded corners */
.img-rounded {
    border-radius: var(--radius-m);
}

.img-rounded-lg {
    border-radius: var(--radius-l);
}

/* Image cover container */
.img-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Aspect ratio containers */
.aspect-video {
    aspect-ratio: 16/9;
}
.aspect-square {
    aspect-ratio: 1;
}
.aspect-portrait {
    aspect-ratio: 3/4;
}

/* Avatar */
.avatar {
    width: 4.8rem;
    height: 4.8rem;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.avatar--sm {
    width: 3.2rem;
    height: 3.2rem;
}
.avatar--lg {
    width: 6.4rem;
    height: 6.4rem;
}
.avatar--xl {
    width: 9.6rem;
    height: 9.6rem;
}

/* ============================================================
   14. DIVIDERS
   ============================================================ */

.divider {
    width: 100%;
    height: 1px;
    background: var(--border-primary);
    border: none;
    margin: var(--space-xl) 0;
}

.divider--thick {
    height: 2px;
}

.divider--short {
    width: 8rem;
}

.divider--center {
    margin-inline: auto;
}

.divider--primary {
    background: var(--primary);
}

/* ============================================================
   15. ICONS (Lucide)
   ============================================================ */

.lucide {
    width: 2.4rem;
    height: 2.4rem;
    stroke-width: 2;
}

.lucide-xs {
    width: 1.4rem;
    height: 1.4rem;
}

.lucide-sm {
    width: 1.8rem;
    height: 1.8rem;
}

.lucide-lg {
    width: 3.2rem;
    height: 3.2rem;
}

.lucide-xl {
    width: 4.8rem;
    height: 4.8rem;
}
