/* ==========================================================================
   base.css — design tokens, reset, typography, utilities
   Dr Hossein Mohammadifar — Portfolio (placeholder build)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand */
  --brand-500: #2f4f8f;
  --brand-600: #27407a;
  --brand-400: #4a6cb0;
  --accent-500: #80501f;
  --accent-400: #d29356;

  /* Surfaces (light theme default) */
  --bg: #f7f5f1;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f0ede7;
  --border: #dcd7cd;
  --border-strong: #c4bdae;

  /* Text */
  --text: #1b1f26;
  --text-soft: #4b5361;
  --text-muted: #596273;
  --on-brand: #ffffff;

  /* Feedback */
  --ok: #2f7d5d;
  --warn: #a8762a;

  /* Accent wash */
  --wash: rgba(47, 79, 143, 0.08);
  --wash-accent: rgba(180, 118, 60, 0.12);

  /* Typography */
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua",
    Palatino, Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --step--2: clamp(0.72rem, 0.7rem + 0.1vw, 0.78rem);
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.08rem);
  --step-1: clamp(1.15rem, 1.08rem + 0.35vw, 1.33rem);
  --step-2: clamp(1.35rem, 1.22rem + 0.65vw, 1.72rem);
  --step-3: clamp(1.6rem, 1.36rem + 1.2vw, 2.3rem);
  --step-4: clamp(2rem, 1.55rem + 2.2vw, 3.2rem);
  --step-5: clamp(2.4rem, 1.6rem + 4vw, 4.4rem);

  /* Space scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4.5rem;
  --sp-9: 6.5rem;

  /* Radius & shadow */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(20, 26, 36, 0.06),
    0 2px 6px rgba(20, 26, 36, 0.05);
  --shadow-md: 0 6px 18px rgba(20, 26, 36, 0.08),
    0 2px 6px rgba(20, 26, 36, 0.05);
  --shadow-lg: 0 18px 48px rgba(20, 26, 36, 0.14);

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 160ms;
  --dur: 320ms;
  --dur-slow: 620ms;

  /* Layout */
  --wrap: 1160px;
  --wrap-narrow: 760px;
  --header-h: 72px;

  color-scheme: light;
}

/* Dark theme overrides */
[data-theme="dark"] {
  --brand-500: #8fa9e0;
  --brand-600: #b3c6ea;
  --brand-400: #6f8fd0;
  --accent-500: #e0a86b;
  --accent-400: #f0c391;

  --bg: #101318;
  --bg-alt: #14181f;
  --surface: #171c24;
  --surface-soft: #1d232c;
  --border: #2a323d;
  --border-strong: #3b4553;

  --text: #eef1f6;
  --text-soft: #b9c1cd;
  --text-muted: #8d97a5;
  --on-brand: #0e1116;

  --ok: #6ec7a1;
  --warn: #e0b476;

  --wash: rgba(143, 169, 224, 0.1);
  --wash-accent: rgba(224, 168, 107, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.55);

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body,
h1,
h2,
h3,
h4,
h5,
p,
figure,
blockquote,
dl,
dd,
ul,
ol {
  margin: 0;
}

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
}

a {
  color: var(--brand-500);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease);
}

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

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

::selection {
  background: var(--accent-400);
  color: #14181f;
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--text);
  text-wrap: balance;
}

h1 {
  font-size: var(--step-5);
}
h2 {
  font-size: var(--step-4);
}
h3 {
  font-size: var(--step-2);
}
h4 {
  font-size: var(--step-1);
}

p {
  text-wrap: pretty;
}

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

strong {
  font-weight: 650;
}

small {
  font-size: var(--step--1);
}

code,
kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.1em 0.35em;
}

blockquote {
  border-left: 3px solid var(--accent-500);
  padding-left: var(--sp-5);
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-style: italic;
  color: var(--text-soft);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--sp-6) 0;
}

/* --------------------------------------------------------------------------
   4. Utilities
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

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

.section {
  padding-block: var(--sp-8);
  position: relative;
}

.section--tight {
  padding-block: var(--sp-7);
}

.section--alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
}

.section__head {
  max-width: 62ch;
  margin-bottom: var(--sp-6);
}

.section__head--center {
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-500);
  margin-bottom: var(--sp-3);
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.eyebrow--center::after {
  content: "";
  width: 28px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.lead {
  font-size: var(--step-1);
  color: var(--text-soft);
  line-height: 1.6;
}

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

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -120%);
  z-index: 200;
  background: var(--brand-600);
  color: var(--on-brand);
  padding: var(--sp-3) var(--sp-5);
  border-radius: 0 0 var(--r-md) var(--r-md);
  font-size: var(--step--1);
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--dur) var(--ease);
}

.skip-link:focus {
  transform: translate(-50%, 0);
  color: var(--on-brand);
}

/* Simple grid helpers */
.grid {
  display: grid;
  gap: var(--sp-5);
}

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

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

@media (max-width: 62rem) {
  .grid--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 42rem) {
  .grid--2,
  .grid--3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .section {
    padding-block: var(--sp-7);
  }
}

/* --------------------------------------------------------------------------
   5. Motion preferences
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Keep the skip target visible beneath the sticky header. */
main { scroll-margin-top: var(--header-h); }
