/* ============================================
   Base
   ============================================ */

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

html {
  font-size: 62.5%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: Charter, "Iowan Old Style", "Bitstream Charter", "Sitka Text", Georgia, serif;
  font-size: 2.05em;
  line-height: 1.55;
  color: #111;
  background: #fff;
  margin: 0;
  padding: 0;
}

::selection {
  background: #ffff66;
}

/* ============================================
   Layout
   ============================================ */

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 2.4rem;
}

/* ============================================
   Header & Nav
   ============================================ */

header {
  padding: 4rem 0 3rem;
  margin-bottom: 5rem;
  position: relative;
}

header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 8px;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 8' preserveAspectRatio='none'><path d='M0 4 C30 2.5 60 5.5 90 4 C120 2.5 150 5.5 180 4 C210 2.5 240 5.5 270 4 C300 2.5 330 5.5 360 4 C390 2.5 420 5.5 450 4 C480 2.5 510 5.5 540 4 C570 3 590 5 600 4' stroke='%23d0d0d0' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-size: 100% 8px;
  background-repeat: no-repeat;
  pointer-events: none;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.site-logo-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  flex-shrink: 0;
}

.site-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
  object-fit: cover;
}

.site-name {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.6rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #000;
}

.site-logo-link:hover .site-name {
  color: #000;
}

nav {
  display: flex;
  gap: 2rem;
}

nav a {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.3rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
  text-decoration: none;
}

nav a:hover {
  color: #000;
}

/* ============================================
   Links
   ============================================ */

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #C0392B;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 0.08em;
}

a:hover {
  color: #C0392B;
}

/* ============================================
   Homepage
   ============================================ */

.intro {
  padding-bottom: 4.5rem;
  border-bottom: 1px solid #efefef;
  margin-bottom: 4.5rem;
}

.intro p {
  font-size: 1.05em;
  line-height: 1.7;
  margin: 0;
}

.section-label {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.1rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #999;
  margin: 0 0 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #efefef;
}

.all-writing-link {
  display: inline-block;
  margin-top: 3rem;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.3rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============================================
   Article List
   ============================================ */

.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-list li {
  margin-bottom: 2.8rem;
}

.article-list a {
  display: block;
  text-decoration: none;
  color: inherit;
}

.article-list a:hover h3 {
  color: #C0392B;
  background-size: 100% 8px;
}

.article-date {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.68em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #999;
  margin-bottom: 0.4em;
}

.article-list h3 {
  font-family: Charter, "Iowan Old Style", "Bitstream Charter", "Sitka Text", Georgia, serif;
  font-size: 1em;
  font-weight: normal;
  line-height: 1.2;
  color: #111;
  margin: 0 0 0.25em;
  width: fit-content;
  position: relative;
  padding-bottom: 5px;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 10' preserveAspectRatio='none'><path d='M0 5 C15 3 35 7.5 60 4.5 C85 2.5 105 7 130 5 C155 3 175 8 200 5 C225 2.5 250 7.5 280 4.5 C290 3.5 296 5.5 300 5' stroke='%23C0392B' stroke-width='4' fill='none' stroke-linecap='butt'/></svg>");
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 8px;
  transition: background-size 0.3s ease, color 0.15s ease;
}

.article-list h3[data-grade]::before {
  content: attr(data-grade);
  position: absolute;
  right: -3.4rem;
  top: -0.3rem;
  width: 2.4rem;
  height: 2.4rem;
  text-align: center;
  line-height: 2.4rem;
  font-family: "Iowan Old Style", Georgia, serif;
  font-size: 1.2rem;
  font-weight: bold;
  font-style: italic;
  color: #C0392B;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M 22 4 C 34 3 40 12 39 22 C 38 33 28 40 18 38 C 8 36 1 27 3 17 C 5 6 14 3 22 4' fill='none' stroke='%23C0392B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(0.4) rotate(-20deg);
  transition: opacity 0s, transform 0s;
  pointer-events: none;
}


.article-list a:hover h3[data-grade]::before {
  opacity: 1;
  transform: scale(1) rotate(-8deg);
  transition: opacity 0.15s ease 0.32s,
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) 0.32s;
}


.article-list h4 {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.82em;
  font-weight: normal;
  font-style: italic;
  color: #666;
  margin: 0;
  line-height: 1.4;
}

/* ============================================
   Writing Index Page
   ============================================ */

.writing-header {
  margin-bottom: 4rem;
}

.writing-header h1 {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 2.8rem;
  font-weight: 500;
  color: #000;
  margin: 0;
}

/* ============================================
   Article Page
   ============================================ */

.article-header {
  margin-bottom: 4rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid #efefef;
}

.article-header .article-date {
  margin-bottom: 0.8em;
}

.article-content h1 {
  font-family: Charter, "Iowan Old Style", "Bitstream Charter", "Sitka Text", Georgia, serif;
  font-size: 3.4rem;
  font-weight: normal;
  line-height: 1.15;
  color: #000;
  margin: 0 0 0.5em;
}

.article-subtitle {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 0.9em;
  font-style: italic;
  color: #666;
  margin: 0;
  line-height: 1.5;
}

.article-body {
  margin-bottom: 6rem;
}

.article-body p {
  margin-bottom: 1.5em;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  hyphens: auto;
}

.article-body h2 {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.3em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #000;
  margin: 3em 0 1em;
}

.article-body blockquote {
  border-left: 2px solid #efefef;
  margin: 2em 0;
  padding-left: 2em;
  color: #555;
  font-style: italic;
}

.article-footer {
  border-top: 1px solid #efefef;
  padding-top: 2.5rem;
  margin-top: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.3rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============================================
   About Page
   ============================================ */

.about-content h1 {
  font-family: Charter, "Iowan Old Style", "Bitstream Charter", "Sitka Text", Georgia, serif;
  font-size: 3.4rem;
  font-weight: normal;
  line-height: 1.15;
  color: #000;
  margin: 0 0 1em;
}

.about-content p {
  margin-bottom: 1.5em;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  hyphens: auto;
}

/* ============================================
   Footer
   ============================================ */

footer {
  border-top: 1px solid #efefef;
  padding: 3rem 0 4rem;
  margin-top: 6rem;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.3rem;
  color: #999;
}

footer p {
  margin: 0;
}

footer a {
  color: #999;
  text-decoration-color: #ccc;
}

footer a:hover {
  color: #333;
}

/* ============================================
   Dark Mode
   ============================================ */

@media (prefers-color-scheme: dark) {
  body {
    background: #1a1a1a;
    color: #d0d0d0;
  }

  .intro,
  .article-header,
  .article-footer,
  footer {
    border-color: #2e2e2e;
  }

  header::after {
    background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 8' preserveAspectRatio='none'><path d='M0 4 C30 2.5 60 5.5 90 4 C120 2.5 150 5.5 180 4 C210 2.5 240 5.5 270 4 C300 2.5 330 5.5 360 4 C390 2.5 420 5.5 450 4 C480 2.5 510 5.5 540 4 C570 3 590 5 600 4' stroke='%232e2e2e' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  }

  a {
    text-decoration-color: #E05555;
  }

  a:hover {
    color: #E05555;
  }

  footer a {
    text-decoration-color: #3a3a3a;
  }

  .article-list a:hover h3 {
    color: #E05555;
  }

  .article-list h3 {
    background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 10' preserveAspectRatio='none'><path d='M0 5 C15 3 35 7.5 60 4.5 C85 2.5 105 7 130 5 C155 3 175 8 200 5 C225 2.5 250 7.5 280 4.5 C290 3.5 296 5.5 300 5' stroke='%23E05555' stroke-width='4' fill='none' stroke-linecap='butt'/></svg>");
  }

  .article-list h3[data-grade]::before {
    color: #E05555;
    background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M 22 4 C 34 3 40 12 39 22 C 38 33 28 40 18 38 C 8 36 1 27 3 17 C 5 6 14 3 22 4' fill='none' stroke='%23E05555' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  }


  .section-label {
    border-color: #2e2e2e;
    color: #666;
  }

  .site-name {
    color: #e0e0e0;
  }

  .site-avatar {
    filter: invert(1);
  }

  nav a {
    color: #888;
  }

  nav a:hover {
    color: #e0e0e0;
  }

  .article-list h3,
  .article-content h1,
  .about-content h1,
  .writing-header h1 {
    color: #e0e0e0;
  }

  .article-list h4,
  .article-subtitle {
    color: #888;
  }

  .article-body h2 {
    color: #e0e0e0;
  }

  .article-body blockquote {
    border-color: #2e2e2e;
    color: #888;
  }

  footer p,
  footer a {
    color: #555;
  }

  footer a:hover {
    color: #999;
  }

  ::selection {
    background: #4a4a00;
    color: #fff;
  }
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 600px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.2rem;
  }

  .article-content h1 {
    font-size: 2.8rem;
  }

  .about-content h1 {
    font-size: 2.8rem;
  }
}
