:root {
  color-scheme: dark;
  --bg: #090a0d;
  --panel: #111318;
  --panel-2: #171a21;
  --ink: #f3f4f1;
  --muted: #9ca3ad;
  --line: rgba(243, 244, 241, 0.12);
  --line-strong: rgba(243, 244, 241, 0.22);
  --green: #79e2c8;
  --pink: #ff7aa8;
  --violet: #a996ff;
  --amber: #ffd166;
  --wash: rgba(121, 226, 200, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 14% 0%, rgba(121, 226, 200, 0.14), transparent 25rem),
    radial-gradient(circle at 86% 8%, rgba(169, 150, 255, 0.13), transparent 24rem),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.52;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

main,
section,
article,
aside,
div,
form {
  min-width: 0;
}

.skip {
  position: absolute;
  top: -80px;
  left: 16px;
  z-index: 40;
  padding: 10px 12px;
  background: var(--green);
  color: #07100e;
}

.skip:focus {
  top: 12px;
}

.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 10, 13, 0.84);
  backdrop-filter: blur(18px);
}

.nav,
.index-head,
.tools,
.blog-grid,
.page-split,
.photo-grid,
.footer,
.article-page {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
}

.nav {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.brand,
.nav-links,
.meta,
.segmented,
.editor-actions,
.admin-top {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: var(--ink);
  font-weight: 760;
}

.brand-logo {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #0d0f13;
  color: transparent;
  box-shadow: inset 0 0 0 1px rgba(121, 226, 200, 0.08);
}

.brand-logo::before {
  content: "IB";
  color: var(--green);
  font: 760 0.78rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.nav-links {
  gap: 18px;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 650;
}

.nav-links a:hover,
.read-more,
.rail-links a,
.back-link {
  color: var(--green);
}

.index-head {
  padding: clamp(54px, 9vw, 92px) 0 30px;
}

.eyebrow,
.meta,
.tools span,
.editor label span,
.token-field span {
  color: var(--green);
  font: 700 0.72rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0;
  text-transform: uppercase;
}

.index-head h1,
.article-page h1,
.page-split h1,
.editor h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(3rem, 6.4vw, 5.4rem);
  line-height: 0.98;
  font-weight: 740;
  letter-spacing: 0;
}

.index-head h1::before {
  content: "$ ";
  color: var(--pink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72em;
}

.lead,
.article-page header p,
.page-split p {
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(1.02rem, 1.8vw, 1.2rem);
}

.read-more,
.rail-links a {
  font-weight: 760;
}

.tools {
  display: grid;
  grid-template-columns: minmax(240px, 360px) 1fr;
  gap: 20px;
  align-items: end;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

label {
  display: grid;
  gap: 8px;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(17, 19, 24, 0.86);
  color: var(--ink);
  padding: 12px 13px;
}

input:focus,
textarea:focus {
  outline: 3px solid rgba(121, 226, 200, 0.16);
  border-color: var(--green);
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(17, 19, 24, 0.86);
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
  font-weight: 760;
}

button:hover,
button[aria-pressed="true"] {
  border-color: var(--green);
  background: rgba(121, 226, 200, 0.16);
  color: var(--green);
}

.segmented {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.blog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 32px;
  padding: 26px 0 84px;
}

.stream {
  display: grid;
  gap: 10px;
}

.post-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(17, 19, 24, 0.76);
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.post-card:hover {
  border-color: rgba(121, 226, 200, 0.45);
  background: rgba(121, 226, 200, 0.07);
  transform: translateY(-1px);
}

.post-image {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  aspect-ratio: 1.32;
  background: #07080a;
}

.post-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.article-image,
.portrait img,
.photo-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.meta {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.meta span::before {
  content: "/";
  margin-right: 8px;
  color: var(--muted);
}

.post-card h2 {
  margin: 0;
  font-size: clamp(1.32rem, 2.55vw, 2.25rem);
  line-height: 1.06;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.post-card p,
.article-body p,
.rail p {
  color: var(--muted);
}

.post-card p {
  max-width: 66ch;
  margin: 8px 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(17, 19, 24, 0.74);
}

.pagination div {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pagination span {
  color: var(--muted);
}

.pagination button {
  min-width: 42px;
}

.pagination button[aria-current="page"] {
  border-color: rgba(121, 226, 200, 0.7);
  background: rgba(121, 226, 200, 0.16);
  color: var(--green);
}

.rail {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(121, 226, 200, 0.45) transparent;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  background: rgba(17, 19, 24, 0.72);
}

.rail h2,
.twitter-widget h2 {
  margin: 0 0 8px;
  color: var(--amber);
  font: 760 0.78rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
}

.rail-links {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.macchiati-widget,
.twitter-widget {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.twitter-widget .rail-head a {
  color: var(--green);
  font-weight: 760;
}

.macchiati-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  max-height: 410px;
  overflow-y: auto;
  padding-right: 5px;
  overscroll-behavior: contain;
  scrollbar-color: rgba(121, 226, 200, 0.45) transparent;
}

.macchiato-thumb {
  min-height: 0;
  display: grid;
  gap: 6px;
  padding: 0;
  border-radius: 9px;
  overflow: hidden;
  background: rgba(7, 8, 10, 0.72);
  text-align: left;
}

.macchiato-thumb:hover,
.macchiato-thumb:focus-visible {
  transform: none;
}

.macchiato-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #07080a;
}

.macchiato-thumb span {
  min-height: 34px;
  padding: 0 7px 7px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 720;
  line-height: 1.18;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 42px);
  background: rgba(3, 4, 6, 0.82);
  backdrop-filter: blur(16px);
}

.modal-backdrop[hidden] {
  display: none;
}

.macchiato-modal-card {
  width: min(820px, 100%);
  max-height: min(88vh, 860px);
  display: grid;
  gap: 12px;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px;
  background: rgba(17, 19, 24, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.macchiato-modal-card img {
  width: 100%;
  max-height: calc(88vh - 112px);
  object-fit: contain;
  border-radius: 8px;
  background: #07080a;
}

.macchiato-modal-card figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
}

.macchiato-modal-card strong {
  color: var(--ink);
  font-size: 1rem;
}

.macchiato-modal-card figcaption span {
  color: var(--green);
  font: 800 0.88rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.modal-close {
  justify-self: end;
  min-height: 34px;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--green);
}

.article-page {
  max-width: 900px;
  padding: 58px 0 90px;
}

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

.article-image {
  max-height: 520px;
  margin-bottom: 32px;
  border-radius: 12px;
}

.article-body {
  max-width: 740px;
  font-size: clamp(1.08rem, 2vw, 1.25rem);
}

.article-body img {
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 24px 0;
  border-radius: 12px;
}

.article-body a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.article-body blockquote {
  margin: 24px 0;
  padding-left: 18px;
  border-left: 2px solid var(--green);
  color: var(--muted);
}

.page-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  gap: clamp(30px, 7vw, 72px);
  align-items: start;
  padding: 70px 0;
}

.portrait {
  margin: 0;
  overflow: hidden;
  border-radius: 12px;
  background: var(--panel);
}

.contact-list {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-weight: 650;
}

.contact-list a {
  color: var(--green);
}

.photo-grid {
  columns: 3 240px;
  column-gap: 12px;
  padding-bottom: 80px;
}

.photo-grid a {
  display: block;
  break-inside: avoid;
  margin-bottom: 12px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--panel);
}

.footer {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 24px;
  color: var(--muted);
}

.admin-body {
  background: var(--bg);
  color: var(--ink);
}

.login-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel[hidden],
.admin-list[hidden],
.editor[hidden],
.editor-section[hidden],
.editor-actions[hidden],
#new-entry[hidden] {
  display: none;
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(22px, 5vw, 34px);
  background: rgba(17, 19, 24, 0.9);
}

.login-card h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3.4rem);
  line-height: 1;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  overflow: visible;
}

.admin-list {
  min-height: 0;
  max-height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
  border-right: 1px solid var(--line);
  padding: 18px;
  background: rgba(17, 19, 24, 0.88);
}

.admin-top {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

#new-entry {
  width: 100%;
  margin-bottom: 18px;
}

#entry-list {
  display: grid;
  gap: 8px;
}

#entry-list button {
  height: auto;
  display: grid;
  gap: 2px;
  justify-items: start;
  text-align: left;
  padding: 12px;
}

#entry-list small {
  color: var(--muted);
}

.editor {
  min-height: 0;
  display: grid;
  gap: 18px;
  align-content: start;
  overflow: visible;
  padding: clamp(24px, 4vw, 54px);
}

.editor-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 22px;
}

.editor h1 {
  margin-left: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.editor-section {
  width: min(900px, 100%);
  display: grid;
  gap: 16px;
}

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

.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 16px;
  align-items: end;
}

.html-editor-label {
  display: grid;
  gap: 10px;
}

.html-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.html-toolbar button {
  min-width: 38px;
  min-height: 34px;
  padding: 7px 10px;
}

.html-editor {
  min-height: 420px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 8, 10, 0.66);
  color: var(--ink);
  outline: none;
}

.html-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.html-editor:focus {
  border-color: rgba(121, 226, 200, 0.66);
  box-shadow: 0 0 0 4px rgba(121, 226, 200, 0.08);
}

.link-helper,
.media-helper {
  width: min(520px, 100%);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 8, 10, 0.92);
}

.link-helper[hidden],
.media-helper[hidden] {
  display: none;
}

.link-helper input,
.media-helper input {
  flex: 1 1 240px;
  min-height: 36px;
  padding: 8px 10px;
}

.media-embed {
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 8, 10, 0.72);
}

.media-embed img,
.media-embed video,
.media-embed iframe {
  width: 100%;
  display: block;
}

.media-embed iframe {
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
}

.html-editor p,
.html-editor ul,
.html-editor ol,
.html-editor blockquote {
  margin: 0 0 14px;
}

.html-editor h2,
.html-editor h3 {
  margin: 18px 0 10px;
  line-height: 1.08;
}

.html-editor a {
  color: var(--green);
  text-decoration: underline;
}

.html-editor blockquote {
  border-left: 3px solid var(--green);
  padding-left: 12px;
  color: var(--muted);
}

.file-button {
  min-height: 72px;
}

.file-button input {
  padding: 10px;
}

.mac-preview {
  width: min(360px, 100%);
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(17, 19, 24, 0.86);
}

.mac-preview:empty {
  display: none;
}

.mac-preview img {
  width: 100%;
  aspect-ratio: 0.82;
  object-fit: cover;
}

.mac-preview figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.mac-preview span {
  color: var(--green);
  font: 800 0.82rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.stats-section {
  width: min(980px, 100%);
}

.stats-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.stats-toolbar label {
  min-width: 180px;
}

.stat-grid,
.stats-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stats-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card,
.stat-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(17, 19, 24, 0.74);
}

.stat-card {
  padding: 18px;
}

.stat-card span,
.stat-list h2 {
  margin: 0;
  color: var(--green);
  font: 760 0.72rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.stat-list {
  overflow: hidden;
}

.stat-list h2,
.stat-list p,
.stat-list div {
  padding: 12px 14px;
}

.stat-list p {
  margin: 0;
  color: var(--muted);
}

.stat-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.stat-list span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-list strong {
  color: var(--ink);
  font: 760 0.82rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: auto;
}

#status {
  min-height: 24px;
  color: var(--green);
}

@media (max-width: 860px) {
  .nav,
  .footer,
  .editor-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .tools,
  .blog-grid,
  .page-split,
  .admin-shell,
  .field-grid,
  .upload-row,
  .stat-grid,
  .stats-columns {
    grid-template-columns: 1fr;
  }

  .segmented {
    justify-content: flex-start;
  }

  .rail {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .macchiati-grid {
    grid-template-columns: repeat(5, minmax(86px, 1fr));
    max-height: 182px;
  }

  .admin-list {
    max-height: 44vh;
    overflow-y: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-shell {
    max-height: none;
    overflow: visible;
  }

  .editor {
    max-height: none;
    overflow: visible;
    padding: 24px 18px 56px;
  }

  .editor h1 {
    font-size: clamp(2rem, 11vw, 3rem);
  }
}

@media (max-width: 560px) {
  .nav,
  .index-head,
  .tools,
  .blog-grid,
  .page-split,
  .photo-grid,
  .footer,
  .article-page {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }

  .index-head {
    gap: 24px;
    padding-top: 44px;
  }

  .index-head h1,
  .article-page h1,
  .page-split h1 {
    max-width: 320px;
    font-size: 2.18rem;
  }

  .lead,
  .rail p {
    max-width: 310px;
  }

  .post-card {
    grid-template-columns: 1fr;
  }

  .post-image {
    aspect-ratio: 1.65;
  }

  .macchiati-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 360px;
  }

  .macchiato-modal-card figcaption {
    align-items: flex-start;
    flex-direction: column;
  }
}
