/* ==========================================================================
   YPJ Portal — Base Styles (base.css)
   CSS Reset · Typography · Global Utilities
   ========================================================================== */

/* -----------------------------------------------------------------------
   Google Fonts — Inter (body) + Playfair Display (headings)
   ----------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600&display=swap');

/* ==========================================================================
   CSS Reset
   ========================================================================== */

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

/* Remove default list styles */
ul,
ol {
  list-style: none;
}

/* Prevent font size inflation on mobile */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--top-bar-height) + 1rem);
}

/* Set core body defaults */
body {
  min-height: 100vh;
  font-family: var(--font-primary);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Balance text wrapping on headings */
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  overflow-wrap: break-word;
}

/* Avoid orphans on paragraphs */
p {
  text-wrap: pretty;
  overflow-wrap: break-word;
}

/* Make images easier to work with */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Remove built-in form typography styles */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Remove default button styles */
button {
  cursor: pointer;
  background: none;
  border: none;
}

/* Remove default anchor styles */
a {
  text-decoration: none;
  color: inherit;
}

/* Avoid text overflows */
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

/* Remove animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Table reset */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ==========================================================================
   Typography
   ========================================================================== */

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--color-text);
  letter-spacing: var(--ls-tight);
}

h1 {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-extrabold);
}

h2 {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
}

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

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

h5 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
}

h6 {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
}

/* Paragraphs */
p {
  line-height: var(--lh-normal);
  color: var(--color-text);
}

p + p {
  margin-top: var(--space-4);
}

/* Lead text — larger introductory paragraph */
.lead {
  font-size: var(--fs-lg);
  font-weight: var(--fw-light);
  line-height: var(--lh-relaxed);
  color: var(--color-text-secondary);
}

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

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

/* Strong emphasis */
strong,
.fw-bold {
  font-weight: var(--fw-bold);
}

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

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

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

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-dark);
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

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

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

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

/* ==========================================================================
   Focus Styles
   ========================================================================== */

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ==========================================================================
   Layout — Containers
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.container-wide {
  width: 100%;
  max-width: var(--container-wide);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

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

.section {
  padding-top: var(--section-padding);
  padding-bottom: var(--section-padding);
  position: relative;
}

/* Dark section — navy background with light text */
.section-dark {
  background-color: var(--color-primary-dark);
  color: var(--color-text-on-dark);
}

.section-dark h1,
.section-dark h2,
.section-dark h3,
.section-dark h4,
.section-dark h5,
.section-dark h6 {
  color: var(--color-white);
}

.section-dark p {
  color: var(--color-text-on-dark-secondary);
}

/* Gradient section — premium gradient background */
.section-gradient {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, var(--color-primary-light) 100%);
  color: var(--color-text-on-dark);
}

.section-gradient h1,
.section-gradient h2,
.section-gradient h3,
.section-gradient h4,
.section-gradient h5,
.section-gradient h6 {
  color: var(--color-white);
}

.section-gradient p {
  color: var(--color-text-on-dark-secondary);
}

/* Alt background section */
.section-alt {
  background-color: var(--color-bg-alt);
}

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

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

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

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

/* ==========================================================================
   Color Utilities
   ========================================================================== */

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

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

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

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

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

/* ==========================================================================
   Spacing Utilities
   ========================================================================== */

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-10 { margin-bottom: var(--space-10); }
.mb-12 { margin-bottom: var(--space-12); }
.mb-16 { margin-bottom: var(--space-16); }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }

/* ==========================================================================
   Display Utilities
   ========================================================================== */

.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-grid { display: grid; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }
.d-none { display: none; }

.flex-wrap { flex-wrap: wrap; }
.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.align-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ==========================================================================
   Misc Utilities
   ========================================================================== */

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Image responsive (already done via reset, but explicit utility) */
.img-responsive {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Object fit cover for image containers */
.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

/* Line-clamp for multi-line truncation */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

/* Relative positioning context */
.relative {
  position: relative;
}

/* Overflow hidden */
.overflow-hidden {
  overflow: hidden;
}

/* Width 100% */
.w-full {
  width: 100%;
}
