/* ============================================
   LIMINAL — CSS Design System
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Inter:wght@300;400;500&display=swap');

/* === TOKENS === */
:root {
  --bg:         #0e0d0c;
  --bg-card:    #141210;
  --text:       #e8e2d9;
  --text-muted: #7a7065;
  --accent:     #b89a6a;
  --border:     #252220;
  --serif:      'Cormorant Garamond', Georgia, serif;
  --sans:       'Inter', system-ui, sans-serif;
  --max-body:   640px;
  --max-header: 760px;
  --max-page:   900px;
  --pad-h:      60px;
  --transition: 0.3s ease;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

/* === BASE === */
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  opacity: 0;
  transition: opacity var(--transition);
}

body.is-loaded { opacity: 1; }

/* === READING PROGRESS === */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  width: 0%;
  height: 2px;
  background: var(--accent);
  z-index: 200;
  transition: width 0.1s linear;
}

/* === NAVIGATION === */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px var(--pad-h);
  background: linear-gradient(to bottom, var(--bg) 60%, transparent);
  transition: transform var(--transition);
}

.site-nav.is-hidden { transform: translateY(-100%); }

.site-nav__logo {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: var(--text);
  text-transform: uppercase;
}

.site-nav__links {
  display: flex;
  gap: 36px;
  list-style: none;
}

.site-nav__links a {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--transition);
}

.site-nav__links a:hover { color: var(--text); }

.site-nav--post .site-nav__logo {
  color: var(--text-muted);
  font-size: 15px;
}

.site-nav__back {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color var(--transition);
}

.site-nav__back:hover { color: var(--text); }
.site-nav__back::before { content: '←'; font-size: 14px; }

/* === HOMEPAGE HERO === */
.hero {
  padding: 160px var(--pad-h) 40px;
  max-width: var(--max-page);
}

.hero__label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}

.hero__title {
  font-family: var(--serif);
  font-size: clamp(44px, 6vw, 80px);
  font-weight: 300;
  line-height: 1.08;
  color: var(--text);
  margin-bottom: 28px;
}

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

.hero__desc {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.8;
  font-weight: 300;
}

/* === DIVIDER === */
.section-divider {
  width: 40px;
  height: 1px;
  background: var(--border);
  margin: 48px var(--pad-h);
}

/* === POSTS SECTION === */
.posts-section { padding: 0 var(--pad-h) 120px; }

.section-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 48px;
}

.posts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}

/* === POST CARD === */
.post-card {
  background: var(--bg);
  transition: background var(--transition);
  overflow: hidden;
}

.post-card:hover { background: var(--bg-card); }

.post-card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
}

.post-card__image-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

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

.post-card:hover .post-card__image {
  transform: scale(1.03);
}

.post-card__body {
  padding: 32px;
  flex: 1;
}

.post-card--featured {
  grid-column: 1 / -1;
}

.post-card--featured .post-card__image-wrap {
  aspect-ratio: 21 / 9;
}

.post-card--featured .post-card__body {
  padding: 40px 48px;
}

.post-card__tag {
  display: block;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}

.post-card__title {
  font-family: var(--serif);
  font-weight: 300;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 16px;
}

.post-card--featured .post-card__title { font-size: 38px; max-width: 680px; }
.post-card:not(.post-card--featured) .post-card__title { font-size: 24px; }

.post-card__excerpt {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.8;
  font-weight: 300;
  margin-bottom: 28px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card--featured .post-card__excerpt { max-width: 560px; }

.post-card__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.post-card__meta::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 1px;
  background: var(--accent);
}

/* === POST HEADER === */
.post-header {
  padding: 120px var(--pad-h) 80px;
  max-width: calc(var(--max-header) + var(--pad-h) * 2);
  margin: 0 auto;
}

.post-header__tag {
  display: block;
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 28px;
}

.post-header__title {
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 300;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 28px;
}

.post-header__subtitle {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 300;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 48px;
}

.post-header__meta {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.post-header__meta-item {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.post-header__meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border);
}

/* === POST BODY === */
.post-body {
  max-width: calc(var(--max-body) + var(--pad-h) * 2);
  margin: 0 auto;
  padding: 80px var(--pad-h) 120px;
}

.post-body p {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 300;
  line-height: 1.85;
  color: var(--text);
  margin-bottom: 32px;
}

.post-body h2 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 300;
  color: var(--text);
  margin: 56px 0 24px;
}

.post-body h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
  margin: 40px 0 16px;
}

.post-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 24px;
  margin: 40px 0;
}

.post-body blockquote p {
  font-size: 22px;
  color: #c8c0b4;
  font-style: italic;
}

.post-body ul, .post-body ol {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 300;
  line-height: 1.85;
  color: var(--text);
  margin-bottom: 32px;
  padding-left: 28px;
}

.post-body li { margin-bottom: 8px; }

.post-body a {
  color: var(--accent);
  border-bottom: 1px solid rgba(184, 154, 106, 0.3);
  transition: border-color var(--transition);
}

.post-body a:hover { border-color: var(--accent); }

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 64px auto;
  width: 60px;
}

/* === FOOTER === */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 48px var(--pad-h);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-footer__logo {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.site-footer__copy {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* === TAG/ARCHIVE === */
.tag-header {
  padding: 140px var(--pad-h) 80px;
  border-bottom: 1px solid var(--border);
}

.tag-header__name {
  font-family: var(--serif);
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 300;
  color: var(--text);
  margin-bottom: 16px;
}

.tag-header__desc {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.8;
}

/* === ERROR PAGE === */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: var(--pad-h);
}

.error-page__code {
  font-family: var(--serif);
  font-size: 120px;
  font-weight: 300;
  color: var(--border);
  line-height: 1;
  margin-bottom: 24px;
}

.error-page__message {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 300;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 40px;
}

.error-page__link {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid rgba(184,154,106,0.3);
  padding-bottom: 2px;
}

/* === PAGE TEMPLATE === */
.page-header {
  padding: 140px var(--pad-h) 60px;
  max-width: calc(720px + var(--pad-h) * 2);
  margin: 0 auto;
}

.page-header__title {
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 300;
  color: var(--text);
}

.page-body {
  max-width: calc(720px + var(--pad-h) * 2);
  margin: 0 auto;
  padding: 60px var(--pad-h) 120px;
}

.page-body p {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 300;
  line-height: 1.85;
  color: var(--text);
  margin-bottom: 32px;
}

/* === GHOST CARDS (gh-content) === */
.gh-content .kg-image-card { margin: 40px 0; }
.gh-content .kg-image-card img { border-radius: 2px; }

.kg-width-wide {
  margin-left: calc(50% - min(42vw, 680px));
  margin-right: calc(50% - min(42vw, 680px));
  width: min(84vw, 1360px);
  max-width: unset;
}

.kg-width-full {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
  max-width: unset;
}

.gh-content .kg-bookmark-card {
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 20px 24px;
  margin: 32px 0;
}

.gh-content .kg-bookmark-title {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--text);
  margin-bottom: 6px;
}

.gh-content .kg-bookmark-description {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.gh-content .kg-audio-card {
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  padding: 20px 24px;
  margin: 32px 0;
  border-radius: 2px;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  :root { --pad-h: 40px; }
  .posts-grid { grid-template-columns: 1fr; }
  .post-card--featured { grid-column: auto; }
}

@media (max-width: 768px) {
  :root { --pad-h: 24px; }
  .site-nav { padding: 20px var(--pad-h); }
  .site-nav__links { display: none; }
  .hero { padding-top: 120px; }
  .post-body p { font-size: 18px; }
  .site-footer { flex-direction: column; gap: 16px; text-align: center; }
}
