/**
 * layout.css
 * Sandigan Colleges — Base Reset, Typography, Layout Primitives
 */

/* ─── CSS Reset ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-height-relaxed);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip; /* 'clip' preserves position:sticky; 'hidden' blocks it */
}
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
ul[role="list"], ol[role="list"] { list-style: none; }
a { color: var(--color-link); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--color-link-hover); }

/* ─── Focus Visible ──────────────────────────────── */
:focus-visible {
  outline: 3px solid var(--color-primary-dark);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--color-white);
  border-radius: var(--radius-sm);
}

/* ─── Skip Link ──────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-toast);
  padding: var(--space-2) var(--space-6);
  background: var(--color-secondary);
  color: var(--color-primary-dark);
  font-weight: var(--font-weight-bold);
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: top var(--transition-fast);
}
.skip-link:focus { top: var(--space-4); }

/* ─── Container ──────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--space-4);
  box-sizing: border-box;
}
@media (min-width: 768px) {
  .container {
    padding-inline: var(--space-6);
  }
}

.container--sm  { max-width: var(--container-sm); }
.container--md  { max-width: var(--container-md); }
.container--lg  { max-width: var(--container-lg); }
.container--2xl { max-width: var(--container-2xl); }

/* ─── Grid ───────────────────────────────────────── */
.grid { display: grid; }
.grid > * { min-width: 0; }
.grid-feature-wide { grid-column: 1 / -1; }
.grid--1 { grid-template-columns: minmax(0, 1fr); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1023px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .grid--4 { grid-template-columns: minmax(0, 1fr); }
  .grid--3 { grid-template-columns: minmax(0, 1fr); }
  .grid--2 { grid-template-columns: minmax(0, 1fr); }
}
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-5  { gap: var(--space-5); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.gap-10 { gap: var(--space-10); }
.gap-12 { gap: var(--space-12); }

/* ─── Flex Helpers ───────────────────────────────── */
.flex         { display: flex; }
.flex-wrap    { flex-wrap: wrap; }
.flex-center  { align-items: center; justify-content: center; }
.flex-between { align-items: center; justify-content: space-between; }
.items-center { align-items: center; }

/* ─── Section Spacing ────────────────────────────── */
.section {
  padding-block: clamp(3rem, 5vw, 4.5rem);
}
.section--sm {
  padding-block: var(--space-8);
}
.section--lg {
  padding-block: clamp(4rem, 6vw, 5rem);
}

/* ─── Main Content ───────────────────────────────── */
main { flex: 1; min-width: 0; }
.page-content { padding-block: var(--space-12); }

/* ─── Section Header ─────────────────────────────── */
.section-header {
  text-align: center;
  margin-bottom: var(--space-12);
}
.section-header .section-label {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-widest);
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-3);
}
.section-header h2,
.section-header h3 {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-4);
}
.section-header h3 {
  font-size: var(--text-2xl);
}
.section-header p {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  max-width: 60ch;
  margin-inline: auto;
  line-height: var(--line-height-relaxed);
}

/* Left-aligned Section Header */
.section-header--left,
.section-header.text-left,
.section-header[style*="text-align:left"],
.section-header[style*="text-align: left"] {
  text-align: left;
}
.section-header--left p,
.section-header.text-left p,
.section-header[style*="text-align:left"] p,
.section-header[style*="text-align: left"] p {
  margin-inline: 0;
  margin-left: 0;
  max-width: none; /* Remove character-width cap for left-aligned headers */
}

/* ─── Typography ─────────────────────────────────── */
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-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-lg); }
h6 { font-size: var(--text-md); }

.prose h1, .prose h2, .prose h3,
.prose h4, .prose h5, .prose h6 { margin-top: 1.5em; margin-bottom: 0.5em; }
.prose p  { margin-bottom: var(--space-4); }
.prose ul, .prose ol { margin-bottom: var(--space-4); padding-left: var(--space-6); }
.prose li { margin-bottom: var(--space-2); }
.prose blockquote {
  border-left: 4px solid var(--color-secondary);
  padding-left: var(--space-6);
  margin-bottom: var(--space-6);
  color: var(--color-text-secondary);
  font-style: italic;
}

/* ─── Breadcrumb ─────────────────────────────────── */
.breadcrumb {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding-block: var(--space-3);
}
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.breadcrumb ol li + li::before {
  content: '/';
  margin-right: var(--space-2);
  color: var(--color-border);
}
.breadcrumb a { color: var(--color-primary); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-secondary-dark); text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--color-text-muted); }

/* ─── Page Hero Banner ───────────────────────────── */
.page-hero {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 60%, var(--color-primary-light) 100%);
  color: var(--color-text-inverse);
  padding-block: var(--space-16) var(--space-12);
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.page-hero .container { position: relative; }
.page-hero h1 {
  font-size: var(--text-4xl);
  color: var(--color-white);
  margin-bottom: var(--space-4);
}
.page-hero p {
  font-size: var(--text-lg);
  color: rgb(255 255 255 / 0.85);
  max-width: 60ch;
}

/* ─── Divider ────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-8);
}
