/* ==========================================================================
   Archive Reading Experience — Style System
   ==========================================================================
   A restrained, paper-like design system for long-form reading.
   Restraint is the feature. Whitespace is structural.
   ========================================================================== */

/* ==========================================================================
   1. CSS Variables
   ========================================================================== */

:root {
  /* Colors */
  --bg: #f7f3eb;
  --text: #1f1f1f;
  --muted: #777;
  --link: #2c2c2c;
  --border: #ddd;
  --card-bg: #fff;

  /* Layout */
  --header-height: 56px;
  --content-max-width: 720px;
  --content-wide-max: 1080px;
  --section-gap: 5rem;
  --mobile-breakpoint: 860px;
  --desktop-breakpoint: 1081px;
  --sidebar-width: 260px;
}

/* ==========================================================================
   2. Reset & Base
   ========================================================================== */

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

html {
  font-size: 17px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.85;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   3. Typography
   ========================================================================== */

/* Hero heading — serif italic, weight 400 */
h1 {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 1.9rem;
  font-weight: 400;
  font-style: italic;
  line-height: 1.4;
}

/* Section headings — monospace, weight 500 */
h2 {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 1.5rem;
}

/* Subheadings — monospace, weight 500 */
h3 {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 1rem;
}

/* Body prose */
p {
  text-align: justify;
  hyphens: auto;
  margin-bottom: 1.4em;
}

/* Small body */
.small-body {
  font-size: 0.88rem;
  line-height: 1.7;
}

/* ==========================================================================
   4. Links
   ========================================================================== */

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

a:hover {
  border-bottom-color: var(--text);
}

/* ==========================================================================
   5. Section Reveal (fade-in on scroll)
   ========================================================================== */

.section-reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.section-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Reduced motion: skip the animation */
@media (prefers-reduced-motion: reduce) {
  .section-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  html {
    scroll-behavior: auto;
  }

  a {
    transition: none;
  }
}

/* ==========================================================================
   6. Layout — Top Header + Main
   ========================================================================== */

/* Fixed top header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 90;
}

/* Branding (left) */
.site-brand {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.5;
}

.site-brand a {
  color: var(--text);
  border-bottom: none;
}

/* Top navigation (right) */
.top-nav {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.top-nav a {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.5;
  color: var(--muted);
  border-bottom: none;
  transition: color 0.2s ease;
}

.top-nav a:hover,
.top-nav a.active {
  color: var(--text);
}

/* Main content area */
.main {
  margin-top: 56px;
  padding: 3rem 4rem 6rem;
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================================================
   7. Sections
   ========================================================================== */

.content-section {
  padding-top: 3.5rem;
  border-top: 1px solid var(--border);
  margin-bottom: var(--section-gap);
}

.content-section:first-of-type {
  padding-top: 0;
  border-top: none;
}

/* Section labels — "01 · Section Name" */
.section-label {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* ==========================================================================
   8. Drop Cap
   ========================================================================== */

.drop-cap::first-letter {
  float: left;
  font-size: 3.2em;
  font-weight: 700;
  line-height: 0.8;
  margin-right: 0.08em;
  margin-top: 0.1em;
}

/* ==========================================================================
   9. Blockquotes
   ========================================================================== */

blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1.2rem;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 1.4em;
}

/* ==========================================================================
   10. Pull Quotes
   ========================================================================== */

.pull-quote {
  display: block;
  text-align: center;
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.7;
  max-width: 520px;
  margin: 3rem auto;
  color: var(--muted);
}

/* ==========================================================================
   11. Buttons
   ========================================================================== */

.btn {
  display: inline-block;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.5;
  padding: 0.6rem 1.4rem;
  border: 1px solid var(--text);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px solid var(--text);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn:hover {
  background-color: var(--text);
  color: var(--bg);
  border-bottom-color: var(--text);
}

/* ==========================================================================
   12. Report Entries (project list items)
   ========================================================================== */

.report-entry {
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.report-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.report-entry-title {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 400;
  font-style: italic;
  line-height: 1.4;
  border-bottom: none;
  margin-bottom: 0.3rem;
  display: inline-block;
}

.report-entry-title:hover {
  border-bottom: none;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.report-entry-meta {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.70rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.6;
  color: var(--muted);
  display: block;
  margin-bottom: 0.8rem;
}

.report-entry-desc {
  margin-bottom: 0;
}

/* ==========================================================================
   13. Metadata / Labels
   ========================================================================== */

.meta {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.70rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.6;
  color: var(--muted);
}

.label {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1.5;
  color: var(--muted);
}

/* ==========================================================================
   14. Page Header (hero on each page)
   ========================================================================== */

.page-hero {
  margin-bottom: 3rem;
}

.page-hero h1 {
  margin-bottom: 0.5rem;
}

.page-hero .subtitle {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ==========================================================================
   15. Footer
   ========================================================================== */

.site-footer {
  padding-top: 3.5rem;
  border-top: 1px solid var(--border);
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.70rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.6;
  color: var(--muted);
}

/* ==========================================================================
   16. Resume — Bullet Lists
   ========================================================================== */

.resume-list {
  list-style: none;
  padding-left: 0;
  margin-bottom: 1.4em;
}

.resume-list li {
  position: relative;
  padding-left: 1.2rem;
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
  line-height: 1.7;
  text-align: justify;
  hyphens: auto;
}

.resume-list li::before {
  content: "\2014";
  position: absolute;
  left: 0;
  color: var(--border);
  font-size: 0.85em;
}

/* ==========================================================================
   17. Resume — Skills Grid
   ========================================================================== */

.skills-grid {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.6rem 1.5rem;
  margin-bottom: 1.4em;
}

.skills-label {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.6;
  color: var(--muted);
}

.skills-value {
  font-size: 0.92rem;
  line-height: 1.6;
}

@media (max-width: 600px) {
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 0.3rem 0;
  }

  .skills-label {
    margin-top: 0.8rem;
  }
}

/* ==========================================================================
   19. Resume — Header block
   ========================================================================== */

.resume-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.resume-header-name {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.3rem;
}

.resume-header-role {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  line-height: 1.6;
  margin-bottom: 0.6rem;
}

.resume-header-contact {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  line-height: 1.8;
  color: var(--muted);
}

.resume-header-contact a {
  color: var(--text);
  font-size: 0.72rem;
}

/* ==========================================================================
   18. Resume — Entry blocks
   ========================================================================== */

.resume-entry {
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.resume-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.resume-entry-title {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 0.2rem;
}

.resume-entry-meta {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.70rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.6;
  color: var(--muted);
  display: block;
  margin-bottom: 0.8rem;
}

/* ==========================================================================
   19a. Contact Cards
   ========================================================================== */

.contact-cards {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.4em;
}

.contact-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-card:hover {
  border-color: #bbb;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.contact-card-label {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.4rem;
  line-height: 1.5;
}

.contact-card-value {
  font-size: 0.95rem;
  border-bottom: none;
  margin-bottom: 0;
  line-height: 1.6;
}

/* ==========================================================================
   20. Focus styles (accessibility)
   ========================================================================== */

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* ==========================================================================
   23. Sidebar Footer (hidden on mobile, visible in sidebar on desktop)
   ========================================================================== */

.sidebar-footer {
  display: none;
}

/* ==========================================================================
   21. Mobile toggle button
   ========================================================================== */

.mobile-toggle {
  display: none;
  position: fixed;
  top: 0.7rem;
  left: 1rem;
  z-index: 100;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--text);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  line-height: 1.5;
}

/* ==========================================================================
   22. Responsive — Mobile (<=860px)
   ========================================================================== */

@media (max-width: 860px) {
  html {
    font-size: 16px;
  }

  /* Show mobile toggle */
  .mobile-toggle {
    display: block;
  }

  /* Collapse header to hidden nav on mobile */
  .site-header {
    border-bottom: none;
  }

  .site-header .site-inner {
    display: none;
  }

  .site-header .site-inner.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg);
    z-index: 99;
    padding: 4rem 2.5rem 2rem;
    border: none;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 1.5rem;
  }

  .site-header .site-inner.open .top-nav {
    flex-direction: column;
    gap: 1.2rem;
  }

  /* Main content full-width */
  .main {
    padding: 2rem 1.5rem 4rem;
    max-width: 100%;
  }

  /* Hero heading a touch smaller on mobile */
  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.4rem;
  }
}

/* ==========================================================================
   23. Responsive — Tablet (861-1080px)
   Wider single column, no sidebar yet
   ========================================================================== */

@media (min-width: 861px) and (max-width: 1080px) {
  .main {
    max-width: 800px;
  }

  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.8rem;
  }
}

/* ==========================================================================
   24. Responsive — Desktop (>=1081px)
   Sidebar layout, card grids, larger typography
   ========================================================================== */

@media (min-width: 1081px) {

  /* ---------- Base ---------- */

  html {
    font-size: 18px;
  }

  /* ---------- Sidebar layout ---------- */

  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 3rem 2rem;
    background: var(--bg);
    border-right: 1px solid var(--border);
    border-bottom: none;
    overflow-y: auto;
  }

  .site-header .site-inner {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    flex: 1;
  }

  .site-brand {
    font-size: 0.85rem;
    margin-bottom: 1rem;
  }

  .site-brand a {
    font-size: 1rem;
    letter-spacing: 0.08em;
  }

  /* Sidebar tagline */
  .site-brand::after {
    content: "";
    display: block;
    width: 32px;
    height: 2px;
    background: var(--border);
    margin: 0.8rem 0 1.5rem;
  }

  .top-nav {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }

  .top-nav a {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    padding: 0.35rem 0;
    border-bottom: none;
    position: relative;
  }

  .top-nav a::before {
    content: "";
    position: absolute;
    left: -1rem;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 2px;
    height: 70%;
    background: var(--text);
    transition: transform 0.2s ease;
  }

  .top-nav a:hover::before,
  .top-nav a.active::before {
    transform: translateY(-50%) scaleY(1);
  }

  .top-nav a.active {
    color: var(--text);
    font-weight: 500;
  }

  /* Sidebar footer — copyright at bottom */
  .sidebar-footer {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: var(--bg);
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.6;
    color: var(--muted);
  }

  /* ---------- Main content offset ---------- */

  .main {
    margin-left: calc(var(--sidebar-width) + 3rem);
    margin-top: 0;
    margin-right: 4rem;
    padding: 3rem 0 6rem;
    max-width: calc(var(--content-wide-max) - var(--sidebar-width) - 6rem);
  }

  /* ---------- Page hero ---------- */

  .page-hero {
    margin-bottom: 4rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
  }

  .page-hero h1 {
    font-size: 3.2rem;
    font-weight: 700;
    font-style: normal;
    letter-spacing: -0.02em;
    margin-bottom: 0.6rem;
    line-height: 1.15;
  }

  .page-hero .subtitle {
    font-size: 1.05rem;
    color: var(--muted);
  }

  /* ---------- Section headings ---------- */

  h2 {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    letter-spacing: 0.02em;
  }

  /* ---------- Report entries → card grid ---------- */

  .report-entry {
    display: block;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }

  /* Wrap entries in a 2-column card grid */
  [aria-label="Selected projects"],
  [aria-label="Traditional software projects"] {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  [aria-label="Selected projects"] .report-entry,
  [aria-label="Traditional software projects"] .report-entry {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.8rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
  }

  [aria-label="Selected projects"] .report-entry:hover,
  [aria-label="Traditional software projects"] .report-entry:hover {
    border-color: #bbb;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  }

  [aria-label="Selected projects"] .report-entry-title,
  [aria-label="Traditional software projects"] .report-entry-title {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
  }

  [aria-label="Selected projects"] .report-entry-desc,
  [aria-label="Traditional software projects"] .report-entry-desc {
    font-size: 0.88rem;
    line-height: 1.7;
    text-align: left;
  }

  [aria-label="Selected projects"] .report-entry p:not(.report-entry-meta):not(.report-entry-title),
  [aria-label="Traditional software projects"] .report-entry p:not(.report-entry-meta):not(.report-entry-title) {
    font-size: 0.88rem;
    line-height: 1.7;
    text-align: left;
    margin-bottom: 0.8em;
  }

  /* ---------- Content sections ---------- */

  .content-section {
    padding-top: 4rem;
    margin-bottom: 6rem;
  }

  .section-label {
    font-size: 0.72rem;
    margin-bottom: 1.5rem;
  }

  /* ---------- Resume header ---------- */

  .resume-header {
    text-align: left;
    border-bottom: 2px solid var(--text);
    padding-bottom: 2.5rem;
    margin-bottom: 3rem;
  }

  .resume-header-name {
    font-size: 2rem;
    letter-spacing: -0.01em;
  }

  .resume-header-role {
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
  }

  .resume-header-contact a {
    font-size: 0.78rem;
  }

  /* ---------- Resume entries ---------- */

  .resume-entry {
    padding-left: 1.5rem;
    border-left: 2px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
    padding-bottom: 2rem;
  }

  .resume-entry:last-child {
    border-bottom: 1px solid var(--border);
  }

  .resume-entry-title {
    font-size: 0.95rem;
    font-weight: 500;
  }

  /* ---------- Skills grid → 3 columns ---------- */

  .skills-grid {
    grid-template-columns: 130px 1fr;
    gap: 0.8rem 2rem;
  }

  /* ---------- Drop cap ---------- */

  .drop-cap::first-letter {
    font-size: 3.8em;
  }

  /* ---------- Footer (main content footer, not sidebar) ---------- */

  .main > .site-footer {
    padding-top: 4rem;
  }

  /* ---------- Pull quote ---------- */

  .pull-quote {
    font-size: 1.25rem;
    max-width: 640px;
  }

  /* ---------- Buttons ---------- */

  .btn {
    font-size: 0.82rem;
    padding: 0.75rem 1.8rem;
  }

  /* ---------- Contact cards → 3 columns ---------- */

  .contact-cards {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.2rem;
  }

  .contact-card {
    padding: 2rem 1.8rem;
  }

  .contact-card-value {
    font-size: 0.88rem;
  }
}
