/* Kami inner-page styles */

.ui-lN5SP[data-layout-template="true"] {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.ui-lN5SP[data-layout-template="true"] > .site-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.site-content {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 64px 48px;
  flex: 1;
}

.site-content:not(.contact-page) > .ui-iNQ6I {
  padding-top: 24px;
}

.site-footer {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 24px 64px 48px;
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.site-footer.kami-footer {
  padding: 8px;
}

.site-footer.kami-footer .site-credit {
  border-top: none;
  padding: 0;
}

.site-credit {
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: var(--stone);
  margin: 0;
}

.page-header {
  margin-bottom: 0;
  padding-top: 48px;
  padding-bottom: 48px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.page-header.page-header-with-actions {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-header.page-header-with-actions h1 {
  margin-bottom: 0;
}

article > .page-header {
  margin-bottom: 48px;
}

.page-header-actions {
  flex-shrink: 0;
}

.page-header h1 {
  margin: 0 0 12px;
}

/* Listing pages — content sits flush below the page-header divider */
.site-content .page-header + section,
.site-content .page-header + .post-list {
  margin-top: 0;
}

.site-content .page-header + section > .post-list > .post-item:first-child:not(.blog-item),
.site-content .page-header + .post-list > .post-item:first-child:not(.blog-item) {
  padding-top: 0;
}

#blog-page .blog-feed,
#blog-page .post-list,
#work-page .post-list,
#playground-page .post-list {
  margin-top: 0;
}

.page-header p {
  margin: 0;
  max-width: 560px;
}

.page-header .project-case-study-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 0 !important;
  padding-top: 12px;
  color: var(--brand) !important;
  --ui-text-color: var(--brand) !important;
  text-decoration: none;
}

.page-header .project-case-study-link:hover {
  color: var(--brand) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-header .project-case-study-link .ph-icon {
  width: 14px;
  height: 14px;
  flex: none;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-item,
.work-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 28px 0;
  border-top: none;
  border-bottom: 1px solid var(--border-soft);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.post-item:first-child,
.work-item:first-child {
  border-top: none;
}

.post-item:hover,
.work-item:hover {
  color: inherit;
  text-decoration: none;
}

.post-item:hover .post-title,
.work-item:hover .post-title {
  color: var(--brand);
}

.post-thumb {
  width: 140px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 0.5px solid var(--border-soft);
  background-color: var(--ivory);
}

.post-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.post-meta {
  margin: 0;
}

.post-title {
  margin: 0;
}

.post-excerpt {
  margin: 0;
}

.post-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--brand);
  font-size: 14px;
}

/* Work & playground index — image-first project cards */
#work-page .post-list,
#work .post-list,
#playground-page .post-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

#work-page .work-item,
#work .work-item,
#playground-page .work-item {
  display: flex !important;
  flex-direction: column;
  gap: 0;
  height: 100%;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  border: 0.5px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--ivory);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
  color: inherit;
}

#work-page .work-item:first-child,
#work .work-item:first-child,
#playground-page .work-item:first-child {
  border-top: 0.5px solid var(--border-soft);
}

#work-page .work-item:hover,
#work .work-item:hover,
#playground-page .work-item:hover {
  box-shadow: 0 4px 24px rgba(20, 19, 19, 0.05);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border-soft));
  color: inherit;
  text-decoration: none;
}

#work-page .post-thumb-wrap,
#work .post-thumb-wrap,
#playground-page .post-thumb-wrap {
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 10;
  flex-shrink: 0;
  border-bottom: 0.5px solid var(--border-soft);
}

#work-page .post-thumb,
#work .post-thumb,
#playground-page .post-thumb {
  display: block;
  width: 100%;
  height: 100%;
  min-height: unset;
  object-fit: cover;
  object-position: top left;
  transform-origin: center center;
  transition: transform 0.35s ease;
  border: none;
  border-radius: 0;
}

#work-page .work-item:hover .post-thumb,
#work .work-item:hover .post-thumb,
#playground-page .work-item:hover .post-thumb {
  transform: scale(1.04);
}

#work-page .post-body,
#work .post-body,
#playground-page .post-body {
  position: relative;
  z-index: 1;
  background: var(--ivory);
  padding: 10px 16px 16px;
  gap: 6px;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

#work-page .post-meta,
#work .post-meta,
#playground-page .post-meta {
  margin: 0;
  flex: none;
}

#work-page .work-item h2.post-title.ui-text,
#work .work-item h2.post-title.ui-text,
#playground-page .work-item h2.post-title.ui-text {
  margin: 0;
  padding-top: 2px;
  font-size: 17px !important;
  font-weight: 600;
  line-height: 1.35;
  color: var(--brand) !important;
  --ui-text-color: var(--brand) !important;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: 0 1 auto;
  display: block !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
  box-sizing: border-box;
}

#work-page .work-item h2.post-title.ui-text::after,
#work .work-item h2.post-title.ui-text::after,
#playground-page .work-item h2.post-title.ui-text::after {
  content: none !important;
  display: none !important;
}

#work-page .work-item:hover h2.post-title.ui-text,
#work .work-item:hover h2.post-title.ui-text,
#playground-page .work-item:hover h2.post-title.ui-text {
  color: var(--brand-light) !important;
  --ui-text-color: var(--brand-light) !important;
}

#work-page .post-excerpt,
#work .post-excerpt,
#playground-page .post-excerpt {
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  font-size: 13px !important;
  line-height: 1.5 !important;
  --ui-font-size: 13px !important;
  --ui-line-height: 1.5 !important;
}

#work-page .work-item p.post-excerpt.ui-text::after,
#work .work-item p.post-excerpt.ui-text::after,
#playground-page .work-item p.post-excerpt.ui-text::after {
  content: none !important;
  display: none !important;
}

#work-page .post-cta,
#work .post-cta {
  display: none;
}

#playground-page .post-cta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: auto;
  padding-top: 6px;
  flex: none;
  font-size: 13px !important;
  color: var(--brand);
  text-decoration: none;
}

#work-page .work-item .post-cta,
#work .work-item .post-cta,
#playground-page .work-item .post-cta {
  color: var(--brand) !important;
  --ui-text-color: var(--brand) !important;
}

#work-page .work-item:hover .post-cta,
#work .work-item:hover .post-cta,
#playground-page .work-item:hover .post-cta {
  color: var(--brand) !important;
  --ui-text-color: var(--brand) !important;
  text-decoration: none;
}

#work-page .post-cta .ph-icon,
#work .post-cta .ph-icon,
#playground-page .post-cta .ph-icon {
  width: 14px;
  height: 14px;
  flex: none;
}

/* Blog index — see blog-feed.css */

.prose {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
  color: var(--near-black);
}

.prose p {
  margin: 0 0 1.25em;
}

.prose ol,
.prose ul {
  margin: 0 0 1.25em;
  padding-left: 1.35em;
}

.prose li {
  margin-bottom: 0.5em;
}

.prose li:last-child {
  margin-bottom: 0;
}

.prose h2 {
  font-weight: 500;
  font-size: 21px;
  line-height: 1.25;
  margin: 36px 0 14px;
}

.prose a {
  color: var(--brand);
  text-underline-offset: 3px;
}

.prose a:has(.ph-icon) {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

.prose a:has(.ph-icon):hover {
  text-decoration: underline;
}

.prose a .ph-icon {
  width: 14px;
  height: 14px;
  flex: none;
}

.prose a:hover {
  color: var(--brand);
}

.project-hero {
  margin-bottom: 32px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 0.5px solid var(--border-soft);
}
.project-hero img {
  width: 100%;
}

.project-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
  padding: 20px 24px;
  background: var(--ivory);
  border: 0.5px solid var(--border-soft);
  border-radius: var(--radius);
}

.project-meta-grid dt {
  font-family: var(--latin-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 4px;
}

.project-meta-grid dd {
  margin: 0;
  font-size: 14px;
  color: var(--dark-warm);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 36px 0;
}

.gallery img {
  border-radius: var(--radius);
  border: 0.5px solid var(--border-soft);
}

.site-content article .project-hero.case-lightbox-trigger,
.site-content article .gallery img.case-lightbox-trigger {
  cursor: zoom-in;
}

body.case-lightbox-open {
  overflow: hidden;
}

.case-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.case-lightbox[hidden] {
  display: none;
}

.case-lightbox__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(20, 19, 19, 0.88);
  cursor: zoom-out;
}

.case-lightbox__dialog {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 56px 72px;
  pointer-events: none;
}

.case-lightbox__figure {
  margin: 0;
  width: min(var(--page-width), 100%);
  display: grid;
  gap: 12px;
  justify-items: center;
  pointer-events: auto;
}

.case-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 96px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.case-lightbox__counter {
  font-family: var(--latin-ui);
  font-size: 13px;
  color: rgba(245, 244, 237, 0.75);
}

.case-lightbox__close,
.case-lightbox__nav {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0.5px solid rgba(245, 244, 237, 0.18);
  background: rgba(20, 19, 19, 0.55);
  color: var(--ivory);
  border-radius: 999px;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.case-lightbox__close:hover,
.case-lightbox__nav:hover {
  background: rgba(20, 19, 19, 0.8);
  border-color: rgba(245, 244, 237, 0.35);
}

.case-lightbox__close:focus-visible,
.case-lightbox__nav:focus-visible {
  outline: 2px solid var(--ivory);
  outline-offset: 2px;
}

.case-lightbox__close {
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
}

.case-lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
}

.case-lightbox__nav--prev {
  left: 20px;
}

.case-lightbox__nav--next {
  right: 20px;
}

.case-lightbox__nav[disabled] {
  opacity: 0.35;
  cursor: default;
}

@media (max-width: 640px) {
  .case-lightbox__dialog {
    padding: 56px 16px 88px;
  }

  .case-lightbox__nav {
    top: auto;
    bottom: 20px;
    transform: none;
  }

  .case-lightbox__nav--prev {
    left: calc(50% - 52px);
  }

  .case-lightbox__nav--next {
    right: calc(50% - 52px);
  }

  .case-lightbox__image {
    max-height: calc(100vh - 140px);
  }
}

.back-link-wrap {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-soft);
}

.back-link-wrap a {
  color: var(--brand);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--brand);
  background: var(--brand);
  color: var(--ivory);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}

.btn:hover {
  background: var(--brand-light);
  border-color: var(--brand-light);
  color: var(--ivory);
  text-decoration: none;
  transform: translateY(-1px);
}

.site-content.contact-page {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  justify-content: center;
  padding-bottom: 0;
  max-width: var(--page-width);
}

.contact-page .ui-iNQ6I {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  padding: 0;
}

/* Site footer as last child of #main (homepage + contact page) */
#main:has(> .site-footer.kami-footer) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

#main:has(> .site-footer.kami-footer) > .ui-lN5SP {
  flex: 1 1 auto;
}

#main > .site-footer.kami-footer {
  flex-shrink: 0;
  width: 100%;
  max-width: none;
  margin-top: auto;
  padding: 8px;
  border-top: 1px solid var(--border-soft);
}

.contact-page-layout {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .site-content {
    padding: 0 16px 40px;
  }

  .site-footer {
    padding: 24px 16px 40px;
  }

  .post-item,
  .work-item {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  #work-page .post-list,
  #work .post-list,
  #playground-page .post-list {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  #work-page .post-body,
  #work .post-body,
  #playground-page .post-body {
    padding: 10px 14px 14px;
  }

  .post-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
  }

  .gallery {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .contact-page .ui-iNQ6I {
    justify-content: center;
    padding: 0;
  }

  .page-header {
    padding-top: 32px;
    padding-bottom: 32px;
  }

  .page-header.page-header-with-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header.page-header-with-actions h1 {
    margin-bottom: 0;
  }

  .page-header h1.ui-preset-cnkitt {
    font-size: clamp(24px, 7vw, 29px);
  }

  article > .page-header {
    margin-bottom: 32px;
  }

  .site-footer.kami-footer {
    padding: 8px;
  }

  #main > .site-footer.kami-footer {
    padding: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #work-page .post-thumb,
  #work .post-thumb,
  #playground-page .post-thumb {
    transition: none;
  }

  #work-page .work-item:hover .post-thumb,
  #work .work-item:hover .post-thumb,
  #playground-page .work-item:hover .post-thumb {
    transform: none;
  }
}
