/* ============================================================
   IAMADLX — 2026
   Clean · Editorial · Reading-first
   ============================================================ */

/* ─── 1. Tokens ─────────────────────────────────────────── */
:root {
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;

  --radius: 6px;
  --header-h: 60px;
  --content-w: 680px;
  --wide-w: 1100px;
  --page-pad: clamp(1.25rem, 5vw, 2.5rem);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t: 0.18s var(--ease);
}

/* ─── 2. Light ──────────────────────────────────────────── */
:root, [data-theme="light"] {
  --bg:        #FAFAF9;
  --bg-2:      #F5F4F2;
  --bg-3:      #EDEBE8;
  --border:    rgba(28, 25, 23, 0.09);
  --text:      #1C1917;
  --text-2:    #6B6560;
  --text-3:    #A39E99;
  --accent:    #EA580C;
  --accent-2:  #C2410C;
  --accent-bg: rgba(234, 88, 12, 0.07);
  --header-bg: rgba(250, 250, 249, 0.88);
  --code-bg:   #F0EDE9;
  --select-bg: rgba(234, 88, 12, 0.15);
}

/* ─── 3. Dark ───────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:        #111110;
  --bg-2:      #1A1917;
  --bg-3:      #242220;
  --border:    rgba(245, 245, 244, 0.08);
  --text:      #F5F5F4;
  --text-2:    #A8A29E;
  --text-3:    #6B6560;
  --accent:    #FB923C;
  --accent-2:  #FDBA74;
  --accent-bg: rgba(251, 146, 60, 0.1);
  --header-bg: rgba(17, 17, 16, 0.92);
  --code-bg:   #1E1D1B;
  --select-bg: rgba(251, 146, 60, 0.18);
}

/* ─── 4. Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding-top: var(--header-h);
  overflow-x: hidden;
  transition: background var(--t), color var(--t);
}

::selection { background: var(--select-bg); }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: color var(--t), opacity var(--t); }
ul, ol { list-style: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }

/* ─── 5. Layout ─────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--wide-w);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

.container--text {
  max-width: calc(var(--content-w) + (var(--page-pad) * 2));
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

/* ─── 6. Header ─────────────────────────────────────────── */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--border);
  transition: transform 0.3s var(--ease), background var(--t);
}

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

.header-inner {
  height: 100%;
  max-width: var(--wide-w);
  margin: 0 auto;
  padding: 0 var(--page-pad);
  display: flex;
  align-items: center;
  gap: 2rem;
}

.logo {
  font-size: 0.975rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  flex-shrink: 0;
}

.logo:hover { color: var(--accent); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius);
  transition: color var(--t), background var(--t);
}

.site-nav a:hover { color: var(--text); background: var(--bg-3); }
.site-nav a.is-active { color: var(--text); }

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Theme toggle */
.theme-toggle {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-3);
  transition: color var(--t), background var(--t);
}
.theme-toggle:hover { color: var(--text); background: var(--bg-3); }

[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun  { display: none;  }
[data-theme="dark"]  .icon-sun  { display: block; }
[data-theme="dark"]  .icon-moon { display: none;  }

/* Mobile toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4.5px;
  width: 34px;
  height: 34px;
  padding: 8px;
  border-radius: var(--radius);
  color: var(--text);
  transition: background var(--t);
}
.nav-toggle:hover { background: var(--bg-3); }
.nav-toggle span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--t), opacity var(--t);
  transform-origin: center;
}
.nav-toggle.is-active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.is-active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.is-active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Mobile nav */
.nav-mobile {
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  z-index: 99;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem var(--page-pad) 1.25rem;
  transform: translateY(-110%);
  opacity: 0;
  transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
  pointer-events: none;
}
.nav-mobile.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.nav-mobile a {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.nav-mobile a:last-child { border-bottom: none; }

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

/* ─── 7. Hero ───────────────────────────────────────────── */
.hero {
  padding: clamp(3.5rem, 8vw, 6rem) 0 clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
}

.hero-eyebrow {
  font-size: 0.775rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero-title {
  font-family: var(--sans);
  font-size: clamp(2rem, 1.2rem + 4vw, 3.75rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.08;
  color: var(--text);
  max-width: 14ch;
}

.hero-sub {
  margin-top: 1.25rem;
  font-size: clamp(0.975rem, 0.9rem + 0.4vw, 1.15rem);
  color: var(--text-2);
  line-height: 1.65;
  max-width: 52ch;
}

/* ─── 8. Post list ──────────────────────────────────────── */
.post-list {
  padding: clamp(1.5rem, 4vw, 3rem) 0 clamp(3rem, 6vw, 5rem);
}

.post-list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 1.5rem;
  padding: clamp(1.25rem, 3vw, 1.75rem) 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: opacity var(--t);
}

.post-list-item:first-child { border-top: 1px solid var(--border); }

.post-list-item:hover .post-list-title { color: var(--accent); }
.post-list-item:hover .post-list-arrow { transform: translate(3px, -3px); opacity: 1; }

.post-list-title {
  font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.3;
  color: var(--text);
  transition: color var(--t);
  grid-column: 1;
  grid-row: 1;
  align-self: center;
}

.post-list-arrow {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  color: var(--text-3);
  opacity: 0;
  transition: transform var(--t), opacity var(--t);
  flex-shrink: 0;
}

.post-list-meta {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-3);
}

.post-list-excerpt {
  grid-column: 1 / -1;
  grid-row: 3;
  margin-top: 0.5rem;
  font-size: 0.925rem;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 65ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-list-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}

@media (max-width: 500px) {
  .post-list-arrow { display: none; }
}

/* ─── 9. Article ────────────────────────────────────────── */
.article-cover {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  object-position: center;
}

.article-cover-wrap {
  background: var(--bg-2);
  overflow: hidden;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.article-header {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(1.5rem, 3vw, 2.5rem);
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.article-tags a {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  transition: background var(--t), color var(--t);
}
.article-tags a:hover { background: var(--accent); color: #fff; }

.article-title {
  font-family: var(--sans);
  font-size: clamp(1.75rem, 1rem + 3.5vw, 3.25rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.12;
  color: var(--text);
}

.article-lead {
  margin-top: 1rem;
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.2rem);
  color: var(--text-2);
  line-height: 1.65;
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-top: 1.5rem;
  font-size: 0.825rem;
  color: var(--text-3);
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ─── 10. Article body ──────────────────────────────────── */
.article-body {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.175rem);
  line-height: 1.85;
  color: var(--text);
  padding-bottom: clamp(2.5rem, 6vw, 4rem);
}

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

.article-body h2 {
  font-family: var(--sans);
  font-size: clamp(1.3rem, 1.1rem + 1vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
  margin-top: 2.5em;
  margin-bottom: 0.6em;
}

.article-body h3 {
  font-family: var(--sans);
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text);
  margin-top: 2em;
  margin-bottom: 0.5em;
}

.article-body h4 {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 1.75em;
  margin-bottom: 0.4em;
}

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color var(--t);
}
.article-body a:hover { color: var(--accent-2); }

.article-body strong { font-weight: 700; color: var(--text); }
.article-body em { font-style: italic; }

.article-body ul, .article-body ol {
  padding-left: 1.5em;
  margin: 1.2em 0;
}
.article-body li { list-style: disc; padding: 0.2em 0; }
.article-body ol li { list-style: decimal; }
.article-body li + li { margin-top: 0.25em; }

.article-body blockquote {
  position: relative;
  margin: 2em 0;
  padding: 1.25rem 1.5rem 1.25rem 1.75rem;
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-2);
}
.article-body blockquote > * + * { margin-top: 0.6em; }
.article-body blockquote p { margin: 0; }

.article-body code {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  color: var(--accent);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

.article-body pre {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5em 0;
}
.article-body pre code {
  background: none;
  color: var(--text);
  padding: 0;
  font-size: 0.9rem;
}

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

.article-body figure { margin: 2em 0; text-align: center; }
.article-body figcaption {
  margin-top: 0.6em;
  font-size: 0.825rem;
  font-style: italic;
  color: var(--text-3);
  font-family: var(--sans);
}

.article-body hr {
  border: none;
  text-align: center;
  margin: 2.5em 0;
  color: var(--text-3);
  font-size: 1.25rem;
  letter-spacing: 0.3em;
}
.article-body hr::after { content: "· · ·"; }

.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  margin: 1.5em 0;
  font-family: var(--sans);
}
.article-body th, .article-body td {
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  text-align: left;
}
.article-body th { background: var(--bg-2); font-weight: 700; }

/* ─── 11. Article footer ────────────────────────────────── */
.article-footer {
  padding: 1.75rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: var(--sans);
}

.article-share {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.825rem;
  color: var(--text-3);
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  transition: background var(--t), color var(--t), border-color var(--t);
}
.share-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ─── 12. Author ────────────────────────────────────────── */
.author-box {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 1.5rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 2);
  margin: 2.5rem 0;
  font-family: var(--sans);
}

.author-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.author-name {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-bottom: 0.35rem;
}

.author-bio-text {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* ─── 13. Post nav ──────────────────────────────────────── */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 2);
  overflow: hidden;
  margin: 2.5rem 0 3rem;
  font-family: var(--sans);
}

.post-nav-item {
  background: var(--bg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--text);
  transition: background var(--t);
}
.post-nav-item:hover { background: var(--bg-2); }
.post-nav-item--next { text-align: right; }

.post-nav-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.post-nav-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 480px) {
  .post-nav { grid-template-columns: 1fr; }
}

/* ─── 14. About / Pages ─────────────────────────────────── */
.page-header {
  padding: clamp(3rem, 7vw, 5rem) 0 clamp(1.5rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--border);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.page-eyebrow {
  font-size: 0.775rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.page-title {
  font-size: clamp(2rem, 1.3rem + 3.5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.page-body {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.175rem);
  line-height: 1.85;
  color: var(--text);
  padding-bottom: clamp(3rem, 6vw, 5rem);
}

.page-body > * + * { margin-top: 1.4em; }
.page-body > *:first-child { margin-top: 0; }
.page-body h2 { font-family: var(--sans); font-weight: 800; letter-spacing: -0.025em; margin-top: 2.5em; }
.page-body h3 { font-family: var(--sans); font-weight: 700; margin-top: 2em; }
.page-body a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.page-body strong { font-weight: 700; }
.page-body ul { padding-left: 1.5em; }
.page-body li { list-style: disc; padding: 0.2em 0; }
.page-body blockquote { background: var(--accent-bg); border-left: 3px solid var(--accent); padding: 1rem 1.25rem 1rem 1.5rem; border-radius: 0 var(--radius) var(--radius) 0; font-style: italic; color: var(--text-2); }

/* ─── 15. Tags list ─────────────────────────────────────── */
.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(3rem, 6vw, 5rem);
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 0.45rem 0.9rem;
  border-radius: 100px;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.tag-pill:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.tag-pill span { font-size: 0.75rem; color: var(--text-3); transition: color var(--t); }
.tag-pill:hover span { color: rgba(255,255,255,0.7); }

/* ─── 16. Pagination ────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 0 3rem;
  font-family: var(--sans);
}

.pagination a, .pagination span {
  min-width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg);
  transition: all var(--t);
}
.pagination a:hover { background: var(--bg-2); color: var(--text); }
.pagination .active, .pagination a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── 17. Footer ────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: clamp(2rem, 4vw, 3rem) 0;
  font-family: var(--sans);
}

.footer-inner {
  max-width: var(--wide-w);
  margin: 0 auto;
  padding: 0 var(--page-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.footer-logo {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text);
}
.footer-logo:hover { color: var(--accent); }

.footer-copy {
  font-size: 0.775rem;
  color: var(--text-3);
}
.footer-copy a { color: var(--text-3); text-decoration: underline; text-underline-offset: 3px; }
.footer-copy a:hover { color: var(--accent); }

.footer-social {
  display: flex;
  gap: 0.35rem;
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  color: var(--text-3);
  transition: color var(--t), background var(--t);
}
.footer-social a:hover { color: var(--text); background: var(--bg-2); }

/* ─── 18. Responsive ────────────────────────────────────── */
@media (max-width: 640px) {
  .author-box { flex-direction: column; }
  .article-footer { flex-direction: column; align-items: flex-start; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
