/* ==========================================================================
   Site chrome
   ========================================================================== */

.site-header {
  position: relative;
  z-index: 40; /* above the fixed note sidebar (notes.css .note-toc, z 30) */
  border-bottom: 1px solid var(--rule);
  padding: 1.25rem 0;
}

.site-header__inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-logo em {
  color: var(--accent);
  font-style: normal;
}

.site-nav ul {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
}

.site-nav a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-muted);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
  border-color: var(--accent);
}

/* -- mobile nav ------------------------------------------------------- */

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: transparent;
  flex-shrink: 0;
}

.nav-toggle__bar {
  display: block;
  width: 1.1rem;
  height: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 720px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    flex-basis: 100%;
    order: 3;
  }

  .site-nav ul {
    display: none;
    flex-direction: column;
    gap: 0;
    width: 100%;
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--rule);
  }

  .site-nav.is-open ul {
    display: flex;
  }

  .site-nav li {
    width: 100%;
  }

  .site-nav a {
    display: block;
    padding: 0.85rem 0.25rem;
    border-bottom: 1px solid var(--rule);
  }
}

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 5rem;
  padding: 2.5rem 0 3rem;
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.site-footer a {
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

main {
  min-height: 60vh;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  padding-top: clamp(3rem, 8vw, 6.5rem);
  padding-bottom: clamp(2.5rem, 6vw, 4rem);
  border-bottom: 1px solid var(--rule);
}

.hero__title {
  font-size: clamp(2.75rem, 8vw, 5.5rem);
  font-weight: 600;
  max-width: 20ch;
}

.hero__title em {
  font-style: italic;
  color: var(--accent);
}

.hero__lede {
  margin-top: 1.5rem;
  max-width: var(--measure);
}

.hero__actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Section headers
   ========================================================================== */

.section {
  padding-top: clamp(2.5rem, 6vw, 4.5rem);
  padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.section + .section {
  border-top: 1px solid var(--rule);
}

.section__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 2.25rem;
  flex-wrap: wrap;
}

.section__title {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
}

.section__link {
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  white-space: nowrap;
}

.section__link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Magazine grids
   ========================================================================== */

.grid {
  display: grid;
  gap: var(--gutter);
}

.grid--projects {
  grid-template-columns: repeat(12, 1fr);
}

.grid--projects > * {
  grid-column: span 12;
}

@media (min-width: 640px) {
  .grid--projects > * {
    grid-column: span 6;
  }
  .grid--projects > *:nth-child(3n + 1) {
    grid-column: span 12;
  }
}

@media (min-width: 960px) {
  .grid--projects > * {
    grid-column: span 4;
  }
  .grid--projects > *:nth-child(3n + 1) {
    grid-column: span 8;
  }
}

.grid--gallery {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 640px) {
  .grid--gallery {
    grid-template-columns: repeat(4, 1fr);
  }
  .grid--gallery > *:first-child {
    grid-column: span 2;
    grid-row: span 2;
  }
}

/* ==========================================================================

/* ==========================================================================
   Projects index (projects.html): the live project leads, the rest are an
   even grid
   ========================================================================== */

.project-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding-bottom: 3.5rem;
  border-bottom: 1px solid var(--rule);
}

.project-feature__media {
  display: block;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--card);
  box-shadow: 0 28px 50px -36px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.project-feature__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  transition: transform 0.5s ease;
}

.project-feature:hover .project-feature__media img {
  transform: scale(1.02);
}

.project-feature__title {
  margin-top: 0.6rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1.1;
}

.project-feature__title a {
  text-decoration: none;
}

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

.project-feature__desc {
  margin-top: 0.9rem;
  font-family: var(--font-serif);
  font-size: 1.12rem;
  line-height: 1.65;
  color: var(--ink-muted);
}

.project-feature__meta {
  margin: 1.4rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.88rem;
}

.project-feature__meta > div {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 0.75rem;
}

.project-feature__meta > div + div {
  margin-top: 0.45rem;
}

.project-feature__meta dt {
  font-weight: 600;
}

.project-feature__meta dd {
  margin: 0;
  color: var(--ink-muted);
}

.project-feature .hero__actions {
  margin-top: 1.6rem;
}

.project-rest {
  display: block;
  margin: 2.75rem 0 1.5rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 2.75rem 1.75rem;
}

.project-grid .card__media {
  aspect-ratio: 16 / 10;
  border: 1px solid var(--rule);
}

.card__meta {
  margin-top: 0.7rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

@media (max-width: 820px) {
  .project-feature {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 2.5rem;
  }
}

/* ==========================================================================
   Post index (category-index.html): the newest post leads, the rest are
   short rows grouped by year
   ========================================================================== */

.post-feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  padding: 2.75rem 0 3rem;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
}

.post-feature--thumb {
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
}

.post-feature__title {
  margin-top: 0.7rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  line-height: 1.2;
  word-break: keep-all;
}

.post-feature:hover .post-feature__title {
  color: var(--accent);
}

.post-feature__excerpt {
  margin-top: 1.1rem;
  max-width: var(--measure);
  font-family: var(--font-serif);
  font-size: 1.3rem;
  line-height: 1.7;
  color: var(--ink-muted);
  word-break: keep-all;
}

.post-feature__go {
  display: inline-block;
  margin-top: 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}

.post-feature__media {
  display: block;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-alt);
  overflow: hidden;
}

.post-feature__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* the cards / list switch (assets/js/post-index.js) */
.post-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0 0.25rem;
}

.post-tools__count {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.post-tools__view {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

.post-tools__view button {
  padding: 0.4rem 0.95rem;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: 500 0.85rem var(--font-sans);
  cursor: pointer;
}

.post-tools__view button + button {
  border-left: 1px solid var(--rule);
}

.post-tools__view button.is-on {
  background: var(--ink);
  color: var(--bg);
}

/* cards: a photo, or the excerpt set as a quote when there is none */
.post-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 2.75rem 1.75rem;
  padding: 2rem 0 1rem;
}

.post-cards[hidden],
.year-list[hidden] {
  display: none;
}

.post-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.post-card__media {
  display: block;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-alt);
  overflow: hidden;
}

.post-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.post-card:hover .post-card__media img {
  transform: scale(1.035);
}

.post-card__media--quote {
  display: flex;
  align-items: center;
  padding: 1.5rem 1.4rem;
  background: color-mix(in srgb, var(--accent-plum) 9%, var(--card));
}

.post-card__quote {
  font-family: var(--font-serif);
  font-size: 1.12rem;
  line-height: 1.65;
  color: var(--ink);
  word-break: keep-all;
}

.post-card__quote::before {
  content: "\201C";
  display: block;
  height: 1.6rem;
  font-family: var(--font-display);
  font-size: 2.6rem;
  line-height: 1;
  color: var(--accent-plum);
}

.post-card__date {
  display: block;
  margin-top: 0.95rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

.post-card__title {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.3;
  word-break: keep-all;
}

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

.post-card__excerpt {
  display: block;
  margin-top: 0.45rem;
  font-family: var(--font-serif);
  font-size: 0.97rem;
  line-height: 1.6;
  color: var(--ink-muted);
}

.year-list ol,
.year-list li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.year-list__group {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 1.5rem;
  padding: 2.25rem 0;
  border-bottom: 1px solid var(--rule);
}

/* the year stays beside its rows while they scroll past */
.year-list__year {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1.1;
}

.year-list__year span {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.year-list__item {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr) auto;
  gap: 1.1rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 55%, transparent);
  text-decoration: none;
  color: inherit;
}

.year-list__items li:last-child .year-list__item {
  border-bottom: 0;
}

.year-list__title {
  font-family: var(--font-display);
  font-size: 1.22rem;
  word-break: keep-all;
}

.year-list__item:hover .year-list__title {
  color: var(--accent);
}

.year-list__excerpt {
  overflow: hidden;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--ink-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.year-list__date {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

@media (max-width: 700px) {
  .post-feature--thumb {
    grid-template-columns: minmax(0, 1fr);
  }

  .post-feature__excerpt {
    font-size: 1.12rem;
  }

  .year-list__group {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    padding: 1.75rem 0;
  }

  .year-list__year {
    position: static;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
  }

  .year-list__year span {
    margin-top: 0;
  }

  .year-list__item {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.15rem 0.9rem;
  }

  .year-list__title {
    font-size: 1.1rem;
  }

  .year-list__excerpt {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* ==========================================================================
   Article (post / project body)
   ========================================================================== */

.article-header {
  padding-top: clamp(2.5rem, 6vw, 4rem);
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.article-header__title {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  max-width: 22ch;
}

/* Hangul is about twice as wide as a Latin "ch" */
.article-header__title:lang(ko) {
  max-width: 16em;
  line-height: 1.25;
}

.article-header__subtitle {
  margin-top: 0.75rem;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--ink-muted);
  max-width: var(--measure-wide);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.article-meta dt {
  display: inline;
  font-weight: 600;
  color: var(--ink);
  margin-right: 0.35em;
}

.article-meta > div {
  display: flex;
}

.article-cover {
  margin: 2.5rem auto;
  border-radius: var(--radius);
  overflow: hidden;
  text-align: center;
}

.article-cover img {
  margin: 0 auto;
}

.article-body {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding-top: 2.5rem;
  padding-bottom: 1rem;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.75;
  overflow-wrap: break-word;
}

.article-body > * + * {
  margin-top: 1.4em;
}

.article-body h2 {
  font-size: 1.6rem;
  margin-top: 2.2em;
}

.article-body h3 {
  font-size: 1.3rem;
  margin-top: 1.8em;
}

.article-body > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 3.6em;
  float: left;
  line-height: 0.85;
  padding: 0.05em 0.08em 0 0;
  color: var(--accent);
}

@media (max-width: 480px) {
  .article-body > p:first-of-type::first-letter {
    font-size: 2.6em;
  }
}

.article-body img {
  border-radius: var(--radius);
  margin-left: auto;
  margin-right: auto;
}

.article-body figcaption {
  margin-top: 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-align: center;
}

/* tables scroll horizontally within their own box on narrow screens
   instead of forcing the whole page wider */
.article-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.92rem;
}

.article-body th,
.article-body td {
  padding: 0.6rem 1rem;
  border: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.article-body th {
  background: var(--bg-alt);
  font-weight: 600;
  white-space: nowrap;
}

.article-footer {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding-top: 2.5rem;
  padding-bottom: 4rem;
  border-top: 1px solid var(--rule);
}

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: 3rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--rule);
}

.article-nav a {
  max-width: 45%;
  text-decoration: none;
  font-family: var(--font-display);
}

@media (max-width: 560px) {
  .article-nav {
    flex-direction: column;
    gap: 1.75rem;
  }

  .article-nav a,
  .article-nav__next {
    max-width: none;
    text-align: left;
    margin-left: 0;
  }
}

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

.article-nav__label {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.35rem;
}

.article-nav__next {
  text-align: right;
  margin-left: auto;
}

/* ==========================================================================
   Category / about page intro
   ========================================================================== */

.page-intro {
  padding-top: clamp(2.5rem, 6vw, 4rem);
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.page-intro__title {
  font-size: clamp(2.2rem, 5vw, 3.25rem);
}

.page-intro__desc {
  margin-top: 1rem;
  max-width: var(--measure);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--ink-muted);
}

/* SVG figures exported from the vault's 3.개념집 (transparent, grey ink) */
.article-body img.note-fig {
  display: block;
  width: 100%;
  height: auto; /* width/height attributes from the exporter keep the room reserved */
  max-width: 560px;
  margin: 1.4rem auto;
  border-radius: 0;
  box-shadow: none;
}

/* Floating buttons step aside while reading downward (assets/js/nav.js). */
@media (max-width: 1099.98px) {
  .robot,
  .note-toc-toggle {
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  body.is-reading .robot:not(.is-open),
  body.is-reading .note-toc-toggle {
    transform: translateY(calc(100% + 1.5rem));
    opacity: 0;
    pointer-events: none;
  }
}
