/* ============================================
   petty.is — editorial broadsheet blog
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400;1,600&family=JetBrains+Mono:wght@400;500&family=Outfit:wght@300;400;500;600&display=swap');

:root {
  --ink: #1a1714;
  --paper: #f4f0e8;
  --paper-dark: #e8e2d6;
  --accent: #c4401a;
  --accent-hover: #a83515;
  --muted: #8a8279;
  --rule: #c9c2b6;
  --font-display: 'Papyrus', 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --max-width: 1200px;
  --content-width: 720px;
}

/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink);
  background-color: var(--paper);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent);
  color: var(--paper);
}

/* === Subtle paper grain overlay === */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* === Layout === */
.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* === Masthead === */
.masthead {
  padding: 2.5rem 0 1.5rem;
  border-bottom: 3px double var(--ink);
  position: relative;
}

.masthead-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
}

.site-title {
  font-family: var(--font-display);
  font-size: 4.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.2s;
}

.site-title span {
  color: var(--accent);
}

.site-title:hover {
  color: var(--accent);
}

.masthead-nav {
  display: flex;
  gap: 1.8rem;
  align-items: baseline;
}

.masthead-nav a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-decoration: none;
  position: relative;
  transition: color 0.2s;
}

.masthead-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  transition: width 0.3s cubic-bezier(0.25, 0.1, 0, 1);
}

.masthead-nav a:hover {
  color: var(--ink);
}

.masthead-nav a:hover::after {
  width: 100%;
}

/* === Dateline bar === */
.dateline {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
}

/* === Hero / Featured post === */
.hero {
  padding: 3rem 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.hero-text {
  padding-top: 0.5rem;
}

.hero-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.8rem;
  display: inline-block;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.hero-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

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

.hero-excerpt {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.7;
  font-weight: 300;
  margin-bottom: 1rem;
}

.hero-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.hero-image {
  aspect-ratio: 4/3;
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  overflow: hidden;
  position: relative;
}

.hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.25, 0.1, 0, 1);
}

.hero-image:hover img {
  transform: scale(1.03);
}

/* Placeholder pattern for images */
.placeholder-img {
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      var(--rule) 10px,
      var(--rule) 11px
    );
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-img span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: var(--paper);
  padding: 0.3rem 0.6rem;
}

/* === Post grid === */
.posts-section {
  padding: 2.5rem 0;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  font-style: italic;
}

.section-link {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-decoration: none;
}

.section-link:hover {
  text-decoration: underline;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.post-card {
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.post-card-image {
  aspect-ratio: 16/10;
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  margin-bottom: 1rem;
  overflow: hidden;
}

.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.25, 0.1, 0, 1);
}

.post-card:hover .post-card-image img {
  transform: scale(1.04);
}

.post-card-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.5rem;
  display: inline-block;
}

.post-card-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.post-card-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

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

.post-card-excerpt {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 300;
  margin-bottom: 0.6rem;
}

.post-card-meta {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* === Sidebar list style (for archive, etc.) === */
.post-list {
  list-style: none;
}

.post-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2rem;
}

.post-list-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.post-list-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.post-list-title a:hover {
  color: var(--accent);
}

.post-list-date {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
}

/* === Landing === */
.landing {
  padding: 6rem 0 8rem;
  max-width: var(--content-width);
}

.landing-intro {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.landing-sub {
  font-size: 1.05rem;
  color: var(--muted);
  font-weight: 300;
  line-height: 1.7;
  margin-bottom: 2rem;
}

.landing-cta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-decoration: none;
  padding: 0.6rem 1.4rem;
  border: 1px solid var(--accent);
  transition: background 0.2s, color 0.2s;
  display: inline-block;
}

.landing-cta:hover {
  background: var(--accent);
  color: var(--paper);
}

.landing {
  animation: fadeUp 0.6s ease-out 0.1s both;
}

/* === Projects === */
.projects-page {
  padding-bottom: 3rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}

.project-card {
  padding: 2rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.project-card-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.project-card-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.project-card-title a:hover {
  color: var(--accent);
}

.project-card-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  white-space: nowrap;
}

.project-card-desc {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 300;
}

.project-card-features {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-card-features li {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink);
  line-height: 1.5;
  padding-left: 1rem;
  position: relative;
}

.project-card-features li::before {
  content: '\2014';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.project-card-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-card-tech span {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--paper-dark);
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--rule);
}

.project-card-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-decoration: none;
  margin-top: auto;
  transition: color 0.2s;
}

.project-card-link:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
}

/* === Article / Single post === */
.article {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

.article-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.article-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 0.8rem;
  display: inline-block;
}

.article-title {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.article-subtitle {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.article-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  display: flex;
  gap: 1.5rem;
}

.article-meta span::before {
  content: '·';
  margin-right: 1.5rem;
}

.article-meta span:first-child::before {
  display: none;
}

/* === Article body prose === */
.prose {
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.85;
  font-weight: 400;
}

.prose p {
  margin-bottom: 1.4rem;
}

.prose h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.01em;
}

.prose h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  font-style: italic;
  margin: 2rem 0 0.8rem;
}

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

.prose a:hover {
  text-decoration-color: transparent;
}

.prose blockquote {
  margin: 2rem 0;
  padding: 0 0 0 1.5rem;
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--muted);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--paper-dark);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.prose pre {
  background: var(--ink);
  color: var(--paper);
  padding: 1.5rem;
  margin: 2rem 0;
  overflow-x: auto;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
}

.prose pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.prose img {
  max-width: 100%;
  margin: 2rem 0;
  border: 1px solid var(--rule);
}

.prose figure {
  margin: 2.5rem 0;
}

.prose figcaption {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.5rem;
  letter-spacing: 0.03em;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem auto;
  width: 60%;
}

.prose ul, .prose ol {
  margin: 1.2rem 0;
  padding-left: 1.5rem;
}

.prose li {
  margin-bottom: 0.4rem;
}

/* === Drop cap for first paragraph === */
.prose > p:first-child::first-letter {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.8em;
  float: left;
  line-height: 0.8;
  margin: 0.05em 0.1em 0 0;
  color: var(--accent);
}

/* === Footnotes / end section === */
.article-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 3px double var(--ink);
}

.article-footer-bio {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
  font-family: var(--font-display);
}

/* === Post navigation === */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.post-nav a {
  text-decoration: none;
  color: inherit;
}

.post-nav-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.post-nav-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  transition: color 0.2s;
}

.post-nav a:hover .post-nav-title {
  color: var(--accent);
}

.post-nav-next {
  text-align: right;
}

/* === Footer === */
.site-footer {
  margin-top: auto;
  border-top: 3px double var(--ink);
  padding: 1.5rem 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent);
}

/* === Page entrance animation === */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.masthead {
  animation: fadeUp 0.5s ease-out;
}

.hero {
  animation: fadeUp 0.6s ease-out 0.1s both;
}

.posts-section {
  animation: fadeUp 0.6s ease-out 0.2s both;
}

.article-header {
  animation: fadeUp 0.5s ease-out;
}

.prose {
  animation: fadeUp 0.5s ease-out 0.1s both;
}

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

  .site-title { font-size: 3rem; }

  .hero {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .hero-title { font-size: 2.2rem; }
  .article-title { font-size: 2.4rem; }

  .post-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 600px) {
  .container { padding: 0 1.2rem; }
  .site-title { font-size: 2.2rem; }
  .masthead-inner { flex-direction: column; gap: 0.8rem; }
  .masthead-nav { gap: 1.2rem; }
  .hero-title { font-size: 1.8rem; }
  .article { padding: 2rem 1.2rem 3rem; }
  .article-title { font-size: 2rem; }
  .post-nav { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: 0.8rem; }
  .dateline { flex-direction: column; gap: 0.3rem; }
}
