/* =========================================================
   ByteDaily — stylesheet
   Design language: an editorial tech briefing — paper-grey
   ground, a deep teal signal color, warm ember for emphasis,
   a characterful serif for headlines against a plain grotesque
   for reading text. Hairline rules do the structural work
   instead of cards-and-shadows.
   ========================================================= */

:root {
  --color-bg: #EDEFEA;
  --color-surface: #FFFFFF;
  --color-text: #1C2321;
  --color-text-muted: #5B6660;
  --color-accent: #2F5D62;
  --color-accent-soft: #E4EAE6;
  --color-warm: #E4572E;
  --color-border: #D3D8CE;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", -apple-system, Segoe UI, sans-serif;

  --max-width: 1120px;
  --radius: 3px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img { max-width: 100%; display: block; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Focus visibility ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---------- Masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 20;
}

.masthead-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  gap: 24px;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.wordmark .byte { color: var(--color-text); }
.wordmark .daily { color: var(--color-accent); font-style: italic; }

.masthead-tagline {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: -2px;
  display: block;
}

nav.primary-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

nav.primary-nav a {
  font-size: 0.95rem;
  color: var(--color-text);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease;
}

nav.primary-nav a:hover,
nav.primary-nav a.active {
  border-bottom-color: var(--color-warm);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
}

form.search-form {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
}

form.search-form input[type="text"] {
  border: none;
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  width: 160px;
  background: transparent;
  color: var(--color-text);
}

form.search-form input[type="text"]:focus { outline: none; }

form.search-form button {
  border: none;
  background: var(--color-accent);
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.85rem;
}

/* ---------- Hero ---------- */
.hero {
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--color-border);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 48px;
  align-items: center;
}

.hero-eyebrow {
  color: var(--color-accent);
  font-size: 0.85rem;
  margin-bottom: 10px;
  display: block;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4vw, 3.1rem);
  line-height: 1.08;
  margin: 0 0 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hero h1 a:hover { color: var(--color-accent); }

.hero p.dek {
  color: var(--color-text-muted);
  font-size: 1.08rem;
  max-width: 60ch;
  margin: 0 0 18px;
}

.byline {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.byline a { color: var(--color-accent); }

.hero-figure {
  aspect-ratio: 4 / 5;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-accent);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.hero-figure::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.06) 0 2px, transparent 2px 26px);
}

.hero-figure .figure-label {
  position: relative;
  color: #fff;
  padding: 20px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
}

/* ---------- Section headers ---------- */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 12px;
  margin: 56px 0 28px;
}

.section-header:first-of-type { margin-top: 40px; }

.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0;
  font-weight: 600;
}

.section-header .see-all {
  font-size: 0.9rem;
  color: var(--color-accent);
}

/* ---------- Category filter pills ---------- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 36px;
}

.pill {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
}

.pill:hover { border-color: var(--color-accent); color: var(--color-accent); }

.pill.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* ---------- Post grid ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--color-border);
  border-left: 1px solid var(--color-border);
}

.post-card {
  padding: 28px 24px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
}

.post-card .category-tag {
  font-size: 0.78rem;
  color: var(--color-accent);
  margin-bottom: 10px;
}

.post-card h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.25;
  margin: 0 0 10px;
  font-weight: 600;
}

.post-card h3 a:hover { color: var(--color-accent); }

.post-card p.excerpt {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin: 0 0 16px;
  flex-grow: 1;
}

.post-card .meta {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 40px 0 64px;
}

.pagination a, .pagination span {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 0.9rem;
  background: var(--color-surface);
}

.pagination a:hover { border-color: var(--color-accent); color: var(--color-accent); }

.pagination .current {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* ---------- Single post ---------- */
.post-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--color-border);
  max-width: 76ch;
  margin: 0 auto;
}

.post-header .category-tag {
  color: var(--color-accent);
  font-size: 0.85rem;
  display: inline-block;
  margin-bottom: 14px;
}

.post-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.15;
  margin: 0 0 16px;
  font-weight: 600;
}

.post-body {
  max-width: 68ch;
  margin: 0 auto;
  padding: 40px 0;
  font-size: 1.08rem;
}

.post-body p { margin: 0 0 22px; }

.post-footer {
  max-width: 68ch;
  margin: 0 auto;
  padding: 24px 0 56px;
  border-top: 1px solid var(--color-border);
}

.post-footer .tag-line {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.related-posts {
  border-top: 1px solid var(--color-border);
  padding: 48px 0 64px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 24px;
}

.related-grid h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 6px;
}

.related-grid .category-tag {
  color: var(--color-accent);
  font-size: 0.78rem;
}

/* ---------- Static pages ---------- */
.page-content {
  max-width: 68ch;
  margin: 0 auto;
  padding: 56px 0 64px;
}

.page-content h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  margin: 0 0 24px;
}

.page-content p { margin: 0 0 20px; color: var(--color-text); }

.page-content .lede {
  font-size: 1.15rem;
  color: var(--color-text-muted);
}

/* ---------- Forms ---------- */
.form-field {
  margin-bottom: 20px;
}

.form-field label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--color-text-muted);
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--color-surface);
  color: var(--color-text);
}

.btn {
  display: inline-block;
  background: var(--color-accent);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
}

.btn:hover { background: #274e52; }

.alert-success {
  background: var(--color-accent-soft);
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.alert-empty {
  padding: 40px 0;
  color: var(--color-text-muted);
}

/* ---------- Footer ---------- */
footer.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 40px;
  padding: 48px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 32px;
}

.footer-grid .wordmark { font-size: 1.3rem; margin-bottom: 10px; }

.footer-grid p { color: var(--color-text-muted); font-size: 0.92rem; max-width: 40ch; }

.footer-grid h4 {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0 0 14px;
  font-weight: 600;
}

.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 10px; font-size: 0.92rem; }
.footer-grid a:hover { color: var(--color-accent); }

.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-figure { aspect-ratio: 16 / 9; order: -1; }
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  nav.primary-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px 24px;
    gap: 14px;
  }
  nav.primary-nav.open { display: flex; }
  .nav-toggle { display: inline-block; }
  form.search-form { display: none; }
  .post-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
