/* ============================================================
   PERSONAL SITE — style.css
   Structure: Tokens → Reset → Base → Layout → Components → Pages → Responsive
   ============================================================ */

/* ── 1. DESIGN TOKENS ───────────────────────────────────────── */
:root {
  /* Colour palette */
  --bg:          #F8F7F4;   /* warm off-white */
  --surface:     #FFFFFF;
  --text:        #1A1A1A;   /* near-black */
  --text-muted:  #6B7280;   /* slate grey */
  --accent:      #2E6DA4;   /* steel blue */
  --accent-light:#E8F1F8;   /* tint for hover states */
  --rule:        #E2E0DB;   /* hairline divider */

  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  /* Type scale (fluid via clamp) */
  --step-5:  clamp(2.25rem,  4vw + 1rem,  3.5rem);
  --step-4:  clamp(1.75rem,  3vw + 0.5rem, 2.5rem);
  --step-3:  clamp(1.35rem,  2vw + 0.25rem, 1.75rem);
  --step-2:  clamp(1.1rem,   1vw + 0.5rem,  1.25rem);
  --step-1:  1rem;
  --step-0:  0.875rem;

  /* Spacing */
  --space-xs:   0.5rem;
  --space-s:    1rem;
  --space-m:    1.75rem;
  --space-l:    3rem;
  --space-xl:   5rem;
  --space-2xl:  8rem;

  /* Layout */
  --max-width:  68rem;
  --gutter:     clamp(1.25rem, 5vw, 3rem);

  /* Misc */
  --radius:     4px;
  --transition: 0.2s ease;
}

/* ── 2. RESET ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

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

p, h1, h2, h3, h4, blockquote { overflow-wrap: break-word; }

/* ── 3. BASE ─────────────────────────────────────────────────── */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-1);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  font-weight: 400; /* DM Serif Display looks best at regular weight */
}

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

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition);
}
a:hover { color: var(--text); }

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

ul, ol { padding-left: var(--space-m); }

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-s);
  background: var(--accent);
  color: #fff;
  padding: var(--space-xs) var(--space-s);
  border-radius: var(--radius);
  font-size: var(--step-0);
  font-weight: 600;
  z-index: 9999;
  transition: top var(--transition);
}
.skip-link:focus { top: var(--space-s); }

/* ── 4. LAYOUT WRAPPERS ──────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Narrower reading column for prose sections */
.container--prose {
  max-width: 46rem;
}

/* ── 5. SITE HEADER / NAV ────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg);
  border-bottom: 1px solid var(--rule);
  padding-block: var(--space-s);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
}

/* Logo / wordmark */
.site-logo {
  font-family: var(--font-display);
  font-size: var(--step-2);
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-logo:hover { color: var(--accent); }

.site-logo .logo-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: middle;
  position: relative;
  top: -2px;
  /* Signature animation: the cursor blink */
  animation: blink 1.4s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Main nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-m);
  list-style: none;
  padding: 0;
}

.site-nav a {
  font-size: var(--step-0);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  padding-block: var(--space-xs);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ── 6. SITE FOOTER ──────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: var(--space-l);
  margin-top: var(--space-2xl);
}

.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-s);
}

.site-footer p {
  font-size: var(--step-0);
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: var(--space-m);
  list-style: none;
  padding: 0;
}
.footer-links a {
  font-size: var(--step-0);
  color: var(--text-muted);
  text-decoration: none;
}
.footer-links a:hover { color: var(--accent); }

/* ── 7. PAGE HERO ────────────────────────────────────────────── */
.page-hero {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-xl);
}

/* The decorative rule above page titles */
.page-hero__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  margin-bottom: var(--space-m);
}

.page-hero__eyebrow::before {
  content: '';
  display: block;
  width: 2.5rem;
  height: 1px;
  background: var(--accent);
  flex-shrink: 0;
}

.page-hero__eyebrow span {
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-hero__title {
  color: var(--text);
  max-width: 16ch;
}

.page-hero__subtitle {
  margin-top: var(--space-m);
  font-size: var(--step-2);
  color: var(--text-muted);
  max-width: 38ch;
  font-weight: 400;
  line-height: 1.5;
}

/* ── 8. HOME — HERO ──────────────────────────────────────────── */
.home-hero {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

.home-hero__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

.home-hero__intro {
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-m);
}

.home-hero__heading {
  font-size: var(--step-5);
  color: var(--text);
  max-width: 20ch;
}

.home-hero__heading em {
  font-style: italic;
  color: var(--accent);
}

.home-hero__body {
  margin-top: var(--space-m);
  font-size: var(--step-2);
  color: var(--text-muted);
  max-width: 42ch;
  line-height: 1.6;
}

.home-hero__cta-group {
  margin-top: var(--space-l);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
}

/* ── 9. BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.65em 1.4em;
  border-radius: var(--radius);
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn--primary:hover {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.btn--secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--rule);
}
.btn--secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── 10. SECTIONS ────────────────────────────────────────────── */
.section {
  padding-block: var(--space-xl);
}

.section + .section {
  border-top: 1px solid var(--rule);
}

.section__label {
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-m);
}

.section__heading {
  font-size: var(--step-4);
  margin-bottom: var(--space-m);
}

/* ── 11. ABOUT — SKILLS LIST ─────────────────────────────────── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--space-m);
  margin-top: var(--space-l);
  list-style: none;
  padding: 0;
}

.skill-card {
  padding: var(--space-m);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.skill-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(46, 109, 164, 0.08);
}

.skill-card__icon {
  width: 2rem;
  height: 2rem;
  margin-bottom: var(--space-s);
  color: var(--accent);
}

.skill-card__title {
  font-family: var(--font-body);
  font-size: var(--step-1);
  font-weight: 600;
  margin-bottom: 0.25em;
}

.skill-card__desc {
  font-size: var(--step-0);
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── 12. FLEXIBLE SECTION (portfolio grid OR blog index) ─────── */

/* --- 12a. Portfolio grid --- */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: var(--space-m);
  list-style: none;
  padding: 0;
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}
.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.project-card__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--accent-light); /* placeholder tint when no image */
}

.project-card__body {
  padding: var(--space-m);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-s);
  list-style: none;
  padding: 0;
}

.tag {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.2em 0.6em;
  border-radius: 2px;
}

.project-card__title {
  font-family: var(--font-body);
  font-size: var(--step-2);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.project-card__desc {
  font-size: var(--step-0);
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.project-card__link {
  margin-top: var(--space-m);
  font-size: var(--step-0);
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}
.project-card__link:hover { color: var(--text); }
.project-card__link::after { content: ' →'; }

/* --- 12b. Blog index --- */
.blog-list {
  list-style: none;
  padding: 0;
}

.blog-item {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: var(--space-m);
  padding-block: var(--space-m);
  border-bottom: 1px solid var(--rule);
  align-items: start;
}
.blog-item:first-child { border-top: 1px solid var(--rule); }

.blog-item__date {
  font-size: var(--step-0);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.2em;
}

.blog-item__title {
  font-family: var(--font-body);
  font-size: var(--step-2);
  font-weight: 600;
  margin-bottom: 0.25em;
}

.blog-item__title a {
  color: var(--text);
  text-decoration: none;
}
.blog-item__title a:hover { color: var(--accent); }

.blog-item__excerpt {
  font-size: var(--step-0);
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── 13. ABOUT PAGE — PROSE ──────────────────────────────────── */
.prose p { margin-bottom: var(--space-m); }
.prose h2 { margin-top: var(--space-l); margin-bottom: var(--space-m); }
.prose h3 { margin-top: var(--space-m); margin-bottom: var(--space-s); }
.prose ul, .prose ol { margin-bottom: var(--space-m); }
.prose li { margin-bottom: var(--space-xs); }

/* Profile image */
.about-profile {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.about-profile__image-wrap {
  position: relative;
}

.about-profile__image {
  width: 100%;
  max-width: 22rem;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--accent-light);
}

/* Decorative accent corner on image */
.about-profile__image-wrap::after {
  content: '';
  position: absolute;
  inset: var(--space-s) calc(-1 * var(--space-s)) calc(-1 * var(--space-s)) var(--space-s);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  pointer-events: none;
  z-index: -1;
}

/* ── 14. HOME — FEATURED SECTION ─────────────────────────────── */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--space-m);
  margin-top: var(--space-l);
}

.feature-card {
  padding: var(--space-m);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color var(--transition);
}
.feature-card:hover { border-color: var(--accent); }

.feature-card__num {
  font-family: var(--font-display);
  font-size: var(--step-4);
  color: var(--accent-light);
  line-height: 1;
  margin-bottom: var(--space-s);
  /* contrast via outline trick */
  -webkit-text-stroke: 1px var(--accent);
  color: transparent;
}

.feature-card__title {
  font-family: var(--font-body);
  font-size: var(--step-1);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.feature-card__desc {
  font-size: var(--step-0);
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── 15. CONTACT STRIP ───────────────────────────────────────── */
.contact-strip {
  background: var(--text);
  color: var(--bg);
  padding-block: var(--space-xl);
}

.contact-strip h2 {
  color: #fff;
  margin-bottom: var(--space-m);
}

.contact-strip p {
  color: rgba(255,255,255,0.6);
  margin-bottom: var(--space-l);
  max-width: 38ch;
  font-size: var(--step-2);
}

.contact-strip .btn--primary {
  background: var(--accent);
  border-color: var(--accent);
}
.contact-strip .btn--primary:hover {
  background: #fff;
  border-color: #fff;
  color: var(--text);
}

/* ── 16. RESPONSIVE ──────────────────────────────────────────── */

/* Tablet and up */
@media (min-width: 640px) {
  .about-profile {
    grid-template-columns: 280px 1fr;
    align-items: start;
  }

  .blog-item {
    grid-template-columns: 8rem 1fr;
  }
}

/* Desktop */
@media (min-width: 900px) {
  .home-hero__inner {
    grid-template-columns: 1fr 320px;
    align-items: center;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .site-logo .logo-dot { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* ── 17. PRINT ───────────────────────────────────────────────── */
@media print {
  .site-header, .site-footer, .contact-strip { display: none; }
  body { font-size: 12pt; }
}
