/* Ken Corey — kencorey.com
   Design: Editorial Warmth — magazine-style personal site */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..900;1,9..144,300..900&family=Source+Sans+3:ital,wght@0,300..900;1,300..900&display=swap');

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

:root {
  --bg:         #f7f3ec;
  --surface:    #ffffff;
  --surface-alt:#f0ebe2;
  --border:     #ddd6cb;
  --text:       #2c2825;
  --text-light: #5c564e;
  --muted:      #7d776f;
  --accent:     #c4553d;
  --accent-h:   #a8432e;
  --accent-soft:#fdf0ed;
  --sage:       #5e8c61;
  --sage-soft:  #eef4ee;
  --max-w:      1100px;
  --max-w-text: 740px;
  --display:    'Fraunces', Georgia, serif;
  --body:       'Source Sans 3', system-ui, sans-serif;
  --radius:     8px;
  --shadow:     0 2px 12px rgba(44,40,37,0.08);
  --shadow-lg:  0 8px 32px rgba(44,40,37,0.12);
}

/* ── Reset & Base ── */
html {
  font-size: 17px;
  scroll-behavior: smooth;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-weight: 400;
  line-height: 1.75;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-h); }
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Skip link for screen readers */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  z-index: 100;
  font-weight: 600;
}
.skip-link:focus {
  top: 1rem;
}

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

/* ── Layout ── */
.wrapper { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }
.wrapper--narrow { max-width: var(--max-w-text); }

/* ── Header ── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}
.site-logo {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  font-variation-settings: 'opsz' 32;
}
.site-logo:hover { color: var(--accent); }

/* Nav */
.site-nav { display: flex; flex-wrap: wrap; gap: 0.15rem; align-items: center; }
.site-nav a {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s;
}
.site-nav a:hover { background: var(--surface-alt); color: var(--text); }
.site-nav a[aria-current="true"] {
  background: var(--accent);
  color: #fff;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text);
}
.nav-toggle svg { width: 24px; height: 24px; }

/* ── Hero / Banner ── */
.hero-banner {
  position: relative;
  min-height: 45vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url('/static/images/default-bg.jpg') no-repeat center center;
  background-size: cover;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(44,40,37,0.3) 0%, rgba(44,40,37,0.55) 100%);
}
.hero-banner__content {
  position: relative;
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 700px;
}
.hero-banner__title {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  text-shadow: 0 2px 16px rgba(0,0,0,0.25);
  font-variation-settings: 'opsz' 72;
  margin-bottom: 0.5rem;
}
.hero-banner__subtitle {
  font-family: var(--body);
  font-size: 1.1rem;
  color: rgba(255,255,255,0.9);
  font-weight: 400;
}
.hero-banner--small { min-height: 22vh; }
.hero-banner--small .hero-banner__title {
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
}

/* ── Homepage sections ── */
.home-intro {
  padding: 4rem 0 3rem;
}
.home-intro__text {
  font-size: 1.15rem;
  line-height: 1.8;
  color: var(--text-light);
  max-width: var(--max-w-text);
}
.home-intro__text p { margin-bottom: 1rem; }
.home-intro__text a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Section headings */
.section-label {
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-variation-settings: 'opsz' 12;
}
.section-title {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 1.5rem;
  font-variation-settings: 'opsz' 48;
}

/* Project cards grid */
.projects-section { padding: 3rem 0 4rem; }
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.project-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.project-card__icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
  width: 3rem;
  height: 3rem;
  line-height: 3rem;
  text-align: center;
  background: var(--accent-soft);
  border-radius: var(--radius);
}
.project-card--sage .project-card__icon { background: var(--sage-soft); }
.project-card__title {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
  font-variation-settings: 'opsz' 24;
}
.project-card__desc {
  font-size: 0.95rem;
  color: var(--text-light);
  line-height: 1.65;
  flex: 1;
}
.project-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
}
.project-card__link::after {
  content: '\2192';
  transition: transform 0.2s;
}
.project-card:hover .project-card__link::after {
  transform: translateX(3px);
}

/* ── Recent Posts on Home ── */
.recent-section { padding: 0 0 4rem; }
.post-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}
.post-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.post-card__body { padding: 1.5rem; }
.post-card__category {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.post-card__title {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin: 0.4rem 0;
  font-variation-settings: 'opsz' 20;
}
.post-card__title a { color: inherit; text-decoration: none; }
.post-card__title a:hover { color: var(--accent); }
.post-card__meta {
  font-size: 0.8rem;
  color: var(--muted);
}
.post-card__summary {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: 0.5rem;
  line-height: 1.6;
}

/* ── Blog listing (category pages) ── */
.blog-listing { padding: 3rem 0 4rem; }
.post-article {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 2.5rem;
  margin-bottom: 2rem;
}
.post-article__title {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
  margin-bottom: 0.25rem;
  font-variation-settings: 'opsz' 36;
}
.post-article__title a { color: var(--text); }
.post-article__title a:hover { color: var(--accent); }
.post-article__meta {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* ── Single post ── */
.single-post { padding: 3rem 0 4rem; }
.single-post__meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

/* Post body typography */
.post-body { font-size: 1.05rem; line-height: 1.85; }
.post-body p { margin-bottom: 1.2em; }
.post-body h2, .post-body h3 {
  font-family: var(--display);
  font-weight: 700;
  margin: 2em 0 0.6em;
  line-height: 1.3;
  font-variation-settings: 'opsz' 32;
}
.post-body h2 { font-size: 1.5rem; }
.post-body h3 { font-size: 1.2rem; }
.post-body img {
  border-radius: var(--radius);
  margin: 1.5em 0;
  box-shadow: var(--shadow);
  content-visibility: auto;
}
.post-body a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(196,85,61,0.3);
}
.post-body a:hover { text-decoration-color: var(--accent); }
.post-body blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.75em 1.25em;
  background: var(--accent-soft);
  color: var(--text-light);
  margin: 1.5em 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}
.post-body ul, .post-body ol {
  margin: 1em 0;
  padding-left: 1.5em;
}
.post-body li { margin-bottom: 0.4em; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.back-link::before { content: '\2190'; }
.back-link:hover { color: var(--accent-h); }

/* ── Footer ── */
.site-footer {
  background: var(--text);
  color: rgba(255,255,255,0.7);
  padding: 3rem 0;
  margin-top: 2rem;
}
.site-footer .wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.site-footer__copy {
  font-size: 0.85rem;
}
.site-footer__links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}
.site-footer__links a {
  color: rgba(255,255,255,0.6);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.2s;
}
.site-footer__links a:hover { color: #fff; }

/* ── Responsive ── */
@media (max-width: 768px) {
  html { font-size: 16px; }

  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
  }
  .site-nav.is-open { display: flex; }
  .site-nav a {
    padding: 0.65rem 0;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
  }
  .site-nav a:last-child { border-bottom: none; }

  .hero-banner { min-height: 35vh; }
  .hero-banner--small { min-height: 18vh; }

  .projects-grid { grid-template-columns: 1fr; }
  .post-cards { grid-template-columns: 1fr; }
  .post-article { padding: 1.5rem; }

  .site-footer .wrapper { flex-direction: column; text-align: center; }
  .site-footer__links { justify-content: center; }
}

@media (max-width: 480px) {
  .wrapper { padding: 0 1rem; }
  .hero-banner__title { font-size: 1.6rem; }
  .section-title { font-size: 1.4rem; }
}

/* ── Print ── */
@media print {
  .site-header, .site-footer, .hero-banner, .nav-toggle { display: none; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .wrapper { max-width: 100%; padding: 0; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
