/* ==========================================================================
   art — Ghost theme
   Editorial monospace portfolio. Design tokens lifted from the Claude Design
   mockup (see calude_design_files/portfolio.html).
   ========================================================================== */

:root {
  --bg:        #F4F1EC;
  --surface:   #FFFFFF;
  --ink:       #111111;
  --muted:     #6B6B6B;
  --rule:      #E5DFD4;
  --accent:    #111111;

  --font-display: "Courier Prime", "Courier New", monospace;
  --font-body:    "Courier Prime", "Courier New", monospace;
  --font-meta:    "JetBrains Mono", ui-monospace, monospace;

  /* Ghost custom-font hooks (admin → Design → Typography). When the user
     chooses an alternative font in Ghost admin, Ghost emits these vars and
     they override --font-display / --font-body via the inheritance below. */
  --gh-font-heading: var(--font-display);
  --gh-font-body:    var(--font-body);

  --container: 1280px;
  --gutter: 16px;
  --grid-gap: 14px;
  --page-pad: 40px;
}

/* Pipe Ghost's font picker through to our local font tokens */
body { font-family: var(--gh-font-body, var(--font-body)); }
h1, h2, h3, h4, h5, h6,
.brand, .hero h1, .post-head h1, .gallery-head h1, .about h1,
.card .label .title { font-family: var(--gh-font-heading, var(--font-display)); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

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

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

/* ==========================================================================
   Navigation
   ========================================================================== */

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px var(--page-pad);
}
.site-nav .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}
.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-meta);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.nav-links a {
  color: var(--ink);
  text-decoration: none;
}
.nav-links a:hover,
.nav-links a.is-active {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ==========================================================================
   Hero (index)
   ========================================================================== */

.hero {
  text-align: center;
  padding: 56px 24px 72px;
}
.hero .eyebrow {
  font-family: var(--font-meta);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 16px;
  text-transform: uppercase;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 64px;
  letter-spacing: 0.08em;
  margin: 0;
  color: var(--ink);
}

/* ==========================================================================
   Series cards (used by mosaic + gallery grid)
   ========================================================================== */

.card {
  position: relative;
  overflow: hidden;
  background: var(--rule);
  text-decoration: none;
  color: #FFF;
  display: block;
  aspect-ratio: 1 / 1;
}
.card .img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background-size: cover;
  background-position: center;
  transition: transform 600ms ease;
}
.card:hover .img { transform: scale(1.03); }

.card .label {
  position: absolute;
  left: 18px;
  bottom: 16px;
  z-index: 2;
  color: #fff;
  text-shadow: 0 1px 16px rgba(0,0,0,0.45);
}
.card .label .kicker {
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.9;
  display: block;
  margin-bottom: 4px;
}
.card .label .title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
}

/* fallback solid placeholder when feature_image is missing */
.card.no-image .img {
  background: linear-gradient(135deg, #C9C0B2, #7A4F47);
}

/* ==========================================================================
   Mosaic — variable-span grid for the home index.
   Spans repeat every 7 cards via :nth-child(7n+x), so any post count tiles.
   ========================================================================== */

.mosaic {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--grid-gap);
  padding: 0 24px 40px;
}
.mosaic .card { aspect-ratio: 1 / 1; }
.mosaic .card:nth-child(7n+1) { grid-column: span 3; grid-row: span 2; aspect-ratio: 3 / 4; }
.mosaic .card:nth-child(7n+2) { grid-column: span 2; grid-row: span 1; aspect-ratio: 4 / 3; }
.mosaic .card:nth-child(7n+3) { grid-column: span 1; grid-row: span 1; aspect-ratio: 1 / 1; }
.mosaic .card:nth-child(7n+4) { grid-column: span 3; grid-row: span 1; aspect-ratio: 16 / 9; }
.mosaic .card:nth-child(7n+5) { grid-column: span 2; grid-row: span 2; aspect-ratio: 3 / 4; }
.mosaic .card:nth-child(7n+6) { grid-column: span 1; grid-row: span 1; aspect-ratio: 1 / 1; }
.mosaic .card:nth-child(7n+0) { grid-column: span 3; grid-row: span 1; aspect-ratio: 16 / 9; }

/* ==========================================================================
   Gallery grid (portfolio listing — uniform)
   ========================================================================== */

.gallery-head {
  padding: 64px var(--page-pad) 32px;
  text-align: center;
}
.gallery-head .eyebrow {
  font-family: var(--font-meta);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}
.gallery-head h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 56px;
  letter-spacing: 0.06em;
  margin: 8px 0 0;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--grid-gap);
  padding: 24px;
}
.gallery-grid .card { aspect-ratio: 3 / 4; }

/* ==========================================================================
   Post (series) detail
   ========================================================================== */

.post-head {
  padding: 60px var(--page-pad) 40px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 80px;
  align-items: start;
}
.post-head h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 48px;
  letter-spacing: 0.04em;
  margin: 0 0 20px;
}
.post-head .lede {
  font-size: 14px;
  line-height: 1.7;
  color: #2a2a2a;
  max-width: 52ch;
  margin: 0;
}

.credits {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  align-self: end;
  padding-bottom: 8px;
  margin: 0;
}
.credits dt {
  font-family: var(--font-meta);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.credits dd {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
}

/* Post body — Ghost renders content here. We turn its image grid into a
   uniform 4-col layout. The koenig editor wraps galleries in
   .kg-gallery-card / .kg-image-card; we override their default look so
   they integrate with the editorial grid. */

.post-body {
  padding: 24px;
}

/* Hero — feature image rendered as the lead image on a series page.
   Sits above any post-body grid / gallery cards. */
.post-body .post-hero {
  margin: 0 0 var(--grid-gap);
}
.post-body .post-hero img {
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  display: block;
}
.post-body .post-hero figcaption {
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 10px;
  text-align: center;
}

.post-body .post-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--grid-gap);
}
.post-body .post-grid .img,
.post-body .post-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* If editor used native gallery cards, normalize them */
.post-body .kg-gallery-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--grid-gap);
  margin: var(--grid-gap) 0;
}
.post-body .kg-gallery-row { display: contents; }
.post-body .kg-gallery-image img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* Stand-alone images inside post body */
.post-body .kg-image-card,
.post-body figure.kg-card {
  margin: var(--grid-gap) 0;
}
.post-body .kg-image {
  width: 100%;
  height: auto;
}

.post-foot {
  padding: 60px var(--page-pad) 40px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 24px;
}
.post-foot a,
.post-foot span {
  font-family: var(--font-meta);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}
.post-foot a:hover { text-decoration: underline; text-underline-offset: 4px; }
.post-foot .disabled { color: var(--muted); pointer-events: none; }

/* ==========================================================================
   About / static page
   ========================================================================== */

.about {
  padding: 64px var(--page-pad) 48px;
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 64px;
}
.about .portrait {
  aspect-ratio: 4 / 5;
  background-size: cover;
  background-position: center;
  background-color: var(--rule);
}
.about .portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.about h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 44px;
  letter-spacing: 0.04em;
  margin: 0 0 24px;
}
.about p {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.85;
  max-width: 56ch;
}

.meta-list {
  margin-top: 32px;
  border-top: 1px solid var(--rule);
  padding-top: 24px;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 12px 24px;
  font-size: 13px;
}
.meta-list dt {
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.meta-list dd {
  margin: 0;
  font-family: var(--font-display);
}

/* Generic page (page.hbs fallback) */
.page-default {
  padding: 64px var(--page-pad);
  max-width: 720px;
  margin: 0 auto;
}
.page-default h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 44px;
  letter-spacing: 0.04em;
  margin: 0 0 24px;
}

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

.site-foot {
  border-top: 1px solid var(--rule);
  padding: 36px var(--page-pad);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  gap: 24px;
  flex-wrap: wrap;
}
.site-foot a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 24px;
}
.site-foot a:first-of-type { margin-left: 0; }
.site-foot a:hover { color: var(--ink); }

/* ==========================================================================
   Pagination (used on index / collection pages)
   ========================================================================== */

.pagination {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 24px var(--page-pad) 64px;
  font-family: var(--font-meta);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.pagination a {
  color: var(--ink);
  text-decoration: none;
}
.pagination a:hover { text-decoration: underline; text-underline-offset: 4px; }
.pagination .page-number { color: var(--muted); }

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

@media (max-width: 960px) {
  :root { --page-pad: 24px; }

  .hero h1 { font-size: 44px; }
  .gallery-head h1 { font-size: 40px; }
  .post-head h1 { font-size: 36px; }
  .about h1 { font-size: 32px; }

  .post-head {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .credits { align-self: start; }

  .about {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .about .portrait { max-width: 480px; }

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

/* ==========================================================================
   Koenig editor cards
   These classes are emitted by Ghost's editor and must be styled by the
   theme. We integrate them with the editorial layout:
     - kg-width-wide / kg-width-full break out of the post-body 4-col grid
     - bookmark cards become a horizontal card with cover image + meta
   ========================================================================== */

/* Wide / full-width images break out of the post-body grid */
.post-body .kg-width-wide,
.post-body figure.kg-width-wide {
  grid-column: 1 / -1;
  width: 100%;
  margin: var(--grid-gap) 0;
}
.post-body .kg-width-wide img {
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
}

.post-body .kg-width-full,
.post-body figure.kg-width-full {
  grid-column: 1 / -1;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-top: var(--grid-gap);
  margin-bottom: var(--grid-gap);
}
.post-body .kg-width-full img {
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: cover;
}

/* Image card caption */
.post-body .kg-image-card figcaption,
.post-body .kg-card figcaption {
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}

/* Bookmark cards */
.post-body .kg-bookmark-card {
  grid-column: 1 / -1;
  width: 100%;
  margin: var(--grid-gap) 0;
}
.post-body .kg-bookmark-container {
  display: flex;
  border: 1px solid var(--rule);
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  min-height: 148px;
  overflow: hidden;
}
.post-body .kg-bookmark-container:hover { border-color: var(--ink); }
.post-body .kg-bookmark-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 20px 24px;
  gap: 8px;
  min-width: 0;
}
.post-body .kg-bookmark-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin: 0;
  line-height: 1.4;
}
.post-body .kg-bookmark-description {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-body .kg-bookmark-metadata {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-meta);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.post-body .kg-bookmark-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.post-body .kg-bookmark-author { color: var(--ink); }
.post-body .kg-bookmark-publisher {
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-body .kg-bookmark-publisher::before {
  content: "·";
  margin-right: 8px;
  color: var(--rule);
}
.post-body .kg-bookmark-thumbnail {
  flex: 0 0 auto;
  position: relative;
  min-width: 33%;
  max-width: 33%;
}
.post-body .kg-bookmark-thumbnail img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-body .kg-bookmark-thumbnail:empty { display: none; }

/* Embeds, callouts, dividers — basic editor compat */
.post-body .kg-embed-card { margin: var(--grid-gap) 0; }
.post-body .kg-embed-card iframe { width: 100%; }
.post-body hr {
  grid-column: 1 / -1;
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 32px 0;
}

/* Tighten body typography inside post-body where prose appears */
.post-body p,
.post-body ul,
.post-body ol,
.post-body blockquote {
  grid-column: 1 / -1;
  max-width: 64ch;
  margin: 0 0 1em;
}
.post-body blockquote {
  border-left: 2px solid var(--ink);
  padding-left: 20px;
  font-style: italic;
  color: #2a2a2a;
}

@media (max-width: 640px) {
  .site-nav { padding: 20px var(--page-pad); }
  .nav-links { gap: 18px; }

  .hero { padding: 32px 16px 48px; }
  .hero h1 { font-size: 32px; letter-spacing: 0.06em; }

  /* Mosaic collapses to a 2-col uniform grid on small screens */
  .mosaic {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 16px 32px;
  }
  .mosaic .card,
  .mosaic .card:nth-child(7n+1),
  .mosaic .card:nth-child(7n+2),
  .mosaic .card:nth-child(7n+3),
  .mosaic .card:nth-child(7n+4),
  .mosaic .card:nth-child(7n+5),
  .mosaic .card:nth-child(7n+6),
  .mosaic .card:nth-child(7n+0) {
    grid-column: span 1;
    grid-row: span 1;
    aspect-ratio: 1 / 1;
  }

  .gallery-grid { grid-template-columns: 1fr; padding: 16px; }
  .post-body { padding: 16px; }
  .post-body .post-grid,
  .post-body .kg-gallery-container {
    grid-template-columns: 1fr;
  }

  .post-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 36px var(--page-pad);
  }

  .site-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .site-foot a { margin-left: 0; margin-right: 18px; }
}
