/*
Theme Name: Modern Archive
Theme URI: https://example.local/modern-archive
Author: Codex
Description: Minimal portfolio archive theme with fixed location and year navigation.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: modern-archive
*/

:root {
  --bg: #f2fff3;
  --paper: #f2fff3;
  --ink: #161616;
  --muted: #6a6861;
  --line: rgba(22, 22, 22, 0.14);
  --accent: #b4472f;
  --aside: minmax(12rem, 24vw);
  --gutter: clamp(1.25rem, 3vw, 3rem);
  --content: minmax(0, 1fr);
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

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

a:hover,
a:focus-visible {
  color: var(--accent);
}

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

.site-shell {
  display: grid;
  grid-template-columns: var(--content) var(--aside);
  min-height: 100vh;
}

body.home .site-shell {
  display: block;
}

.site-main {
  padding: var(--gutter);
}

body:not(.home) .site-main {
  min-height: 100vh;
  padding: clamp(1rem, 2.2vw, 2rem);
}

.home-masthead {
  align-items: baseline;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: clamp(2rem, 5vw, 4.5rem);
}

.home-brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  line-height: 1;
}

.home-masthead p {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
  max-width: 26rem;
  text-align: right;
}

.home-grid {
  align-items: start;
  display: grid;
  gap: clamp(0.9rem, 1.8vw, 2rem);
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.home-project {
  break-inside: avoid;
}

.home-project:nth-child(4n + 2) {
  margin-top: clamp(1.25rem, 4vw, 4.5rem);
}

.home-project:nth-child(4n + 3) {
  margin-top: clamp(0.5rem, 2.5vw, 2.5rem);
}

.home-project:nth-child(4n) {
  margin-top: clamp(1.75rem, 5vw, 5.5rem);
}

.home-project a {
  display: grid;
  gap: 0.55rem;
}

.home-project img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
}

.home-project span {
  font-size: clamp(0.86rem, 1vw, 1rem);
  line-height: 1.18;
}

.site-header {
  align-items: start;
  display: flex;
  gap: 2rem;
  justify-content: space-between;
  margin-bottom: clamp(4rem, 10vw, 8rem);
}

.site-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 8vw, 7.5rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.92;
  margin: 0;
  max-width: 11ch;
}

.site-title a:hover {
  color: inherit;
}

.site-description {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 1rem 0 0;
  max-width: 32rem;
}

.header-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  list-style: none;
  margin: 0;
  padding: 0;
  text-transform: uppercase;
}

.archive-heading {
  display: grid;
  gap: 0.35rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.archive-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.archive-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 3.2vw, 3.6rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.95;
  margin: 0;
}

.project-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
}

.project-card {
  border-top: 1px solid var(--line);
  display: grid;
  gap: clamp(1rem, 2vw, 1.75rem);
  grid-template-columns: minmax(9rem, 15rem) minmax(0, 1fr);
  padding: clamp(0.9rem, 2vw, 1.4rem) 0;
}

.project-thumb {
  aspect-ratio: 4 / 3;
  background: #e5e0d6;
  overflow: hidden;
}

.project-thumb img {
  height: 100%;
  object-fit: cover;
  transition: transform 500ms ease;
  width: 100%;
}

.project-card:hover .project-thumb img {
  transform: scale(1.035);
}

.project-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.76rem;
  gap: 0.4rem 0.75rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.55rem;
  text-transform: uppercase;
}

.project-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 2vw, 2rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.98;
  margin: 0;
}

.project-excerpt {
  color: #3f3d38;
  font-size: clamp(0.95rem, 1.1vw, 1.05rem);
  line-height: 1.5;
  margin: 0.6rem 0 0;
  max-width: 38rem;
}

.project-excerpt p {
  margin: 0;
}

.archive-nav {
  height: 100vh;
  overflow-y: auto;
  padding: clamp(1rem, 2.2vw, 2rem);
  position: sticky;
  top: 0;
}

.archive-nav__panel {
  display: grid;
  gap: 0.28rem;
  justify-items: start;
}

.archive-nav__panel[hidden] {
  display: none;
}

.archive-nav__panel a,
.archive-nav__button {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(0.95rem, 1.05vw, 1.2rem);
  letter-spacing: 0;
  line-height: 1.15;
  padding: 0;
  text-align: left;
}

.archive-nav__button:hover,
.archive-nav__button:focus-visible,
.archive-nav__panel a:hover,
.archive-nav__panel a:focus-visible,
.archive-nav__panel a.is-active {
  color: var(--accent);
}

.single-article {
  max-width: 46rem;
}

.single-hero {
  margin-bottom: clamp(1.5rem, 3vw, 2.8rem);
}

.single-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 3.8vw, 4rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
  margin: 0.45rem 0 1.25rem;
}

.single-content {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1rem, 1.25vw, 1.15rem);
  line-height: 1.65;
  max-width: 42rem;
}

.single-content > *:first-child {
  margin-top: 0;
}

.post-navigation {
  border-top: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 4rem;
  padding-top: 1.5rem;
}

.nav-toggle {
  align-items: center;
  background: var(--ink);
  border: 0;
  border-radius: 999px;
  color: var(--paper);
  display: none;
  font: inherit;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  position: fixed;
  right: 1rem;
  top: 1rem;
  z-index: 30;
}

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  height: 1px;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

@media (max-width: 860px) {
  .site-shell {
    display: block;
  }

  .site-main {
    padding: 5rem 1rem 2rem;
  }

  body.home .site-main {
    padding-top: 1rem;
  }

  .home-masthead {
    align-items: start;
    display: grid;
  }

  .home-masthead p {
    text-align: left;
  }

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

  .site-header {
    display: grid;
    margin-bottom: 3rem;
  }

  .project-card {
    grid-template-columns: 1fr;
  }

  .archive-nav {
    bottom: 0;
    background: var(--bg);
    box-shadow: -18px 0 40px rgba(0, 0, 0, 0.16);
    max-width: min(23rem, 86vw);
    position: fixed;
    right: 0;
    top: 0;
    transform: translateX(100%);
    transition: transform 220ms ease;
    width: 100%;
    z-index: 20;
  }

  body.nav-open .archive-nav {
    transform: translateX(0);
  }

  .nav-toggle {
    display: inline-flex;
  }
}

@media (max-width: 520px) {
  .home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-project:nth-child(n) {
    margin-top: 0;
  }
}
