/* Content pages ("See more" project pages, privacy policies). Load after site.css. */

/* ---------- Page header card ---------- */
.page-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 116px 32px 48px;
}

.page-icon {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border-radius: 22px;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

/* Page title size (.t-page) */
.page-hero h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  line-height: 1;
  padding-block: 0.12em;
  text-transform: uppercase;
}

.page-subtitle {
  max-width: 38rem;
  margin-top: 0.9rem;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  line-height: 1.55;
  color: var(--text-2);
}

.page-meta {
  display: inline-flex;
  margin-top: 1.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-2);
}

.page-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 1.5rem; }


/* ---------- Layout: contents sidebar + content card ---------- */
.layout {
  max-width: 1140px;
  margin: 0 auto;
  padding: 40px 20px 72px;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  align-items: start;
  gap: 1.25rem;
}

.layout:not(:has(.toc)) { grid-template-columns: minmax(0, 1fr); }

/* ---------- Contents ---------- */
.toc {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 1rem 0.75rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.toc summary {
  list-style: none;
  padding: 0 0.6rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc summary::-webkit-details-marker { display: none; }
.toc ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.toc a {
  display: block;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.toc li.toc-h3 a { padding-left: 1.4rem; font-size: 0.8rem; color: var(--muted); }
.toc a:hover { color: var(--text); }
.toc a.active { background: var(--accent-soft); color: var(--text); }

/* ---------- Content card & typography ---------- */
.content {
  min-width: 0;
  background: var(--glass-read);
  padding: clamp(1.5rem, 4vw, 2.75rem);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.content > :first-child { margin-top: 0; }
.content > :last-child { margin-bottom: 0; }

.content h2 {
  margin: 2.75rem 0 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.4rem, 3vw, 1.7rem);
  line-height: 1.1;
  text-transform: uppercase;
}

.content > h2:first-child { padding-top: 0; border-top: none; }

.content h3 { margin: 2rem 0 0.6rem; font-size: 1.25rem; font-weight: 650; line-height: 1.3; }
.content h4 { margin: 1.5rem 0 0.4rem; font-size: 1rem; font-weight: 650; }

.content p,
.content li { font-size: 1rem; line-height: 1.75; color: var(--text-2); }

.content p { margin: 0 0 1rem; }
.content .lede { font-size: 1.15rem; color: var(--text); }
.content ul, .content ol { margin: 0 0 1rem 1.3rem; }
.content li > ul, .content li > ol { margin: 0.35rem 0 0.35rem 1.1rem; }
.content li { margin: 0.3rem 0; padding-left: 0.2rem; }
.content strong { color: var(--text); font-weight: 600; }
.content a:not([class]) { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.content a:not([class]):hover { text-decoration-thickness: 2px; }

.content blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.1rem;
  border-left: 3px solid var(--accent);
}

.content blockquote p { color: var(--text); font-size: 1.05rem; }
.content hr { margin: 2.5rem 0; border: none; border-top: 1px solid var(--line); }

.content :not(pre) > code {
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--text);
}

/* ---------- Code blocks ---------- */
.code-block {
  margin: 1.5rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
  border: 1px solid var(--line);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.6rem 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.code-lang {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8ea3c4;
}

.code-btn {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #c9d6ea;
  cursor: pointer;
  transition: background 0.15s ease;
}

.code-btn:hover { background: rgba(255, 255, 255, 0.08); }

.code-block pre { padding: 1rem 1.1rem; overflow-x: auto; }

.code-block code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--code-text);
  tab-size: 2;
}

/* ---------- Images: always cropped to a square ---------- */
.content figure { margin: 1.75rem 0; }

.content figure img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.content figcaption {
  margin-top: 0.55rem;
  font-size: 0.82rem;
  line-height: 1.5;
  text-align: center;
  color: var(--muted);
}

/* Small images: as many per row as fit (about 2 on phones, 4 on desktop) */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1.75rem 0;
}

.gallery figure { margin: 0; }
.gallery figure img { border-radius: var(--radius); }

/* Illustrations and cut-outs: show the whole image on a soft tile instead of cropping it.
   <div class="gallery fit"> */
.gallery.fit figure img {
  object-fit: contain;
  padding: 12%;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

/* Screenshot: keeps its own shape (no square crop), up to 420px wide.
   <figure class="figure-shot"> */
.content .figure-shot { max-width: 420px; }
.content .figure-shot img { aspect-ratio: auto; object-fit: initial; border: 1px solid var(--line); }

/* Large image: fills the width of the content card */
.figure-large img { border-radius: var(--radius); }

/* ---------- Small screens ---------- */
@media (max-width: 880px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding-top: 32px; }
  .toc { position: static; max-height: none; padding: 0.4rem; }
  .toc summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    cursor: pointer;
  }
  .toc summary::after { content: '+'; font-size: 1rem; }
  .toc[open] summary::after { content: '−'; }
  .toc ul { padding: 0 0.2rem 0.4rem; }
}

@media (max-width: 600px) {
  .page-hero { padding: 100px 18px 40px; }
  .page-icon { width: 72px; height: 72px; border-radius: 18px; }
  .layout { padding: 28px 12px 56px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .toc a, .code-btn { transition: none; }
}
