/* ==========================================================================
   SMK Web Design — Premium Base Styles
   Editorial luxury × technical precision
   ========================================================================== */

/* ——— CSS Reset & Normalization ——— */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 16px;
  line-height: 1.6;
}

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

body {
  min-height: 100vh;
  background: var(--surface-ground);
  color: var(--text-base);
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--leading-normal);
  overflow-x: hidden;
  position: relative;
}

/* ——— Editorial Grain Texture ——— */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px;
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    opacity: 0.02;
  }
}

@media (prefers-contrast: more) {
  body::before {
    display: none;
  }
}

/* ——— Media ——— */
img,
svg,
video,
canvas,
picture {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  image-rendering: auto;
}

picture > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ——— Form Elements ——— */
input,
button,
textarea,
select,
optgroup {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

input:disabled,
textarea:disabled,
select:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ——— Links ——— */
a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

/* ——— Lists ——— */
ul,
ol {
  list-style: none;
}

/* ——— Selection ——— */
::selection {
  background: var(--signal);
  color: var(--ink);
}

::-moz-selection {
  background: var(--signal);
  color: var(--ink);
}

/* ——— Scrollbar ——— */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--surface-ground);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
  border: 2px solid var(--surface-ground);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}

::-webkit-scrollbar-corner {
  background: var(--surface-ground);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--surface-ground);
}

/* ——— Focus Visible ——— */
:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

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

/* ——— Skip Link ——— */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--gutter);
  z-index: 10000;
  padding: var(--space-3) var(--space-5);
  background: var(--signal);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  white-space: nowrap;
  transition: top var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ——— Container System ——— */
.container {
  width: 100%;
  max-width: var(--container-default);
  margin: 0 auto;
  padding: 0 var(--gutter);
  position: relative;
  z-index: 1;
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--wide {
  max-width: var(--container-wide);
}

/* ——— Main Content Offset ——— */
.main-content {
  padding-top: calc(var(--nav-height) + var(--space-10));
  padding-bottom: var(--space-16);
  position: relative;
  z-index: 1;
}

@media (max-width: 768px) {
  .main-content {
    padding-top: calc(var(--nav-height-mobile) + var(--space-8));
  }
}

main {
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   TYPOGRAPHY UTILITIES
   ========================================================================== */

/* ——— Display ——— */
.display-serif {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tighter);
  color: var(--text-base);
}

.display-sans {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--text-base);
}

/* ——— Heading Scale ——— */
.heading-1 { font-size: var(--text-hero); }
.heading-2 { font-size: var(--text-display); }
.heading-3 { font-size: var(--text-h1); }
.heading-4 { font-size: var(--text-h2); }
.heading-5 { font-size: var(--text-h3); }
.heading-6 { font-size: var(--text-lead); }

/* ——— Overline / Label ——— */
.overline {
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  font-weight: 500;
  letter-spacing: var(--tracking-mega-wide);
  text-transform: uppercase;
  color: var(--signal);
}

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

/* ——— Body ——— */
.lead {
  font-size: var(--text-lead);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
  max-width: 42ch;
}

.body {
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  color: var(--text-base);
}

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

.body--subtle {
  color: var(--text-subtle);
}

/* ——— Small / Caption ——— */
.caption {
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-muted);
}

.caption--strong {
  font-weight: 500;
}

.micro {
  font-size: var(--text-micro);
  line-height: var(--leading-snug);
  color: var(--text-subtle);
}

/* ——— Code / Mono ——— */
.code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--surface-hover);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--signal);
}

.code-block {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  overflow-x: auto;
  color: var(--text-muted);
}

/* ——— Quote ——— */
blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-h3);
  line-height: var(--leading-snug);
  color: var(--text-base);
  border-left: 2px solid var(--signal);
  padding-left: var(--space-5);
  margin: var(--space-6) 0;
}

/* ==========================================================================
   LAYOUT UTILITIES
   ========================================================================== */

/* ——— Grid ——— */
.grid {
  display: grid;
  gap: var(--gap, var(--space-6));
}

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

@media (max-width: 1024px) {
  .grid--4, .grid--5, .grid--6 { grid-template-columns: repeat(3, 1fr); }
  .grid--12 { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 768px) {
  .grid--2, .grid--3, .grid--4, .grid--5, .grid--6, .grid--12 {
    grid-template-columns: 1fr;
  }
}

/* ——— Flex ——— */
.flex { display: flex; }
.flex--center { align-items: center; justify-content: center; }
.flex--between { align-items: center; justify-content: space-between; }
.flex--start { align-items: flex-start; }
.flex--end { align-items: flex-end; }
.flex--col { flex-direction: column; }
.flex--wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.flex-auto { flex: 1 1 auto; }
.flex-initial { flex: 0 1 auto; }
.flex-none { flex: none; }

/* ——— Gap ——— */
.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-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.gap-10 { gap: var(--space-10); }

/* ——— Spacing ——— */
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.p-10 { padding: var(--space-10); }

.py-1 { padding-block: var(--space-1); }
.py-2 { padding-block: var(--space-2); }
.py-3 { padding-block: var(--space-3); }
.py-4 { padding-block: var(--space-4); }
.py-5 { padding-block: var(--space-5); }
.py-6 { padding-block: var(--space-6); }
.py-8 { padding-block: var(--space-8); }
.py-10 { padding-block: var(--space-10); }
.py-12 { padding-block: var(--space-12); }
.py-16 { padding-block: var(--space-16); }

.px-1 { padding-inline: var(--space-1); }
.px-2 { padding-inline: var(--space-2); }
.px-3 { padding-inline: var(--space-3); }
.px-4 { padding-inline: var(--space-4); }
.px-5 { padding-inline: var(--space-5); }
.px-6 { padding-inline: var(--space-6); }
.px-8 { padding-inline: var(--space-8); }
.px-10 { padding-inline: var(--space-10); }

.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-5 { margin-bottom: var(--space-5); }
.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-auto { margin-top: auto; }
.mb-auto { margin-bottom: auto; }
.mx-auto { margin-inline: auto; }

/* ——— Position ——— */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { inset: 0; }
.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* ——— Visibility ——— */
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.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;
}

/* ——— Overflow ——— */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-hidden { overflow-x: hidden; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   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;
  }

  [data-reveal],
  [data-split] {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  .preloader {
    display: none !important;
  }

  html.is-loading {
    overflow: auto !important;
  }
}

/* ==========================================================================
   HIGH CONTRAST MODE
   ========================================================================== */
@media (prefers-contrast: more) {
  .btn {
    border-width: 2px !important;
  }

  .form-input,
  .form-textarea,
  .form-select {
    border-width: 2px !important;
  }

  .card {
    border-width: 2px !important;
  }
}