/* Rails Inside — IBM × Warp dark technical journal.
   See DESIGN.md for the full system. */

:root {
  --canvas: #0B0E14;
  --panel: #11151D;
  --panel-hi: #161B26;
  --ink: #F4F4F4;
  --ink-soft: #C6C8CC;
  --ink-muted: #8D9099;
  --ink-faint: #555A66;
  --rule: #1F2530;
  --rule-soft: #161A22;
  --blue: #0F62FE;
  --blue-hi: #4589FF;
  --red: #DA1E28;
  --green: #42BE65;
  --yellow: #F1C21B;

  --shell: 1240px;
  --col: 720px;

  --sans: 'IBM Plex Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --condensed: 'IBM Plex Sans Condensed', 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--canvas);
  color: var(--ink);
  font: 400 17px/1.65 var(--sans);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--blue-hi); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 160ms ease, color 160ms ease; }
a:hover { color: var(--ink); border-bottom-color: var(--blue); }

/* ===== Shell ===== */
.shell { max-width: var(--shell); margin: 0 auto; padding-inline: clamp(20px, 5vw, 56px); }
.col { max-width: var(--col); margin-inline: auto; }

/* ===== Top bar (Warp chrome) ===== */
.bar {
  position: sticky; top: 0; z-index: 50;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
  height: 56px;
}
.bar__row {
  display: flex; align-items: center; gap: 20px;
  height: 100%;
}
.lights { display: inline-flex; gap: 8px; align-items: center; }
.light { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.light--r { background: #FF5F56; }
.light--y { background: #FFBD2E; }
.light--g { background: #3A3F4B; }

.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 17px/1 var(--mono);
  letter-spacing: 0;
  color: var(--ink);
  border-bottom: none;
}
.wordmark__prompt { color: var(--blue); }
.wordmark__name { color: var(--ink); }
.wordmark__cursor {
  width: 8px; height: 14px; background: var(--blue); display: inline-block;
  animation: blink 1s steps(2, end) infinite;
  margin-left: 2px;
}
.wordmark:hover { border-bottom: none; color: var(--ink); }
.wordmark:hover .wordmark__name { color: var(--blue-hi); }

@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

.crumb {
  flex: 1;
  font: 500 14.5px/1 var(--mono);
  color: var(--ink-muted);
  letter-spacing: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crumb b { color: var(--ink-soft); font-weight: 500; }

.bar nav {
  display: inline-flex; gap: 14px; align-items: center;
  font: 500 14.5px/1 var(--mono);
}
.bar nav a {
  color: var(--ink-muted); border: none;
  padding: 4px 0;
}
.bar nav a:hover { color: var(--ink); }
.bar nav .sep { color: var(--ink-faint); }

@media (max-width: 1099px) {
  .crumb { display: none; }
}
@media (max-width: 719px) {
  .bar nav { display: none; }
  .bar__sub {
    display: flex;
    gap: 14px;
    padding: 10px clamp(20px, 5vw, 56px);
    border-bottom: 1px solid var(--rule);
    font: 500 14.5px/1 var(--mono);
    background: var(--panel);
  }
  .bar__sub a { color: var(--ink-muted); border: none; }
}
@media (min-width: 720px) { .bar__sub { display: none; } }

/* ===== Hero ===== */
.hero {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--canvas);
  border-bottom: 1px solid var(--rule);
}
.hero__img {
  width: 100%; height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.hero__veil {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(11,14,20,0.10) 0%, rgba(11,14,20,0.55) 65%, var(--canvas) 100%),
    linear-gradient(90deg, rgba(11,14,20,0.45) 0%, rgba(11,14,20,0) 60%);
  pointer-events: none;
}
.hero__inner {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end;
  padding-block: clamp(40px, 7vw, 96px);
}
.hero__inner > .shell { width: 100%; }

.eyebrow {
  display: inline-block;
  font: 500 11.5px/1 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue-hi);
  padding-bottom: 14px;
}

.display {
  font: 700 clamp(56px, 7vw, 104px) / 0.92 var(--condensed);
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin: 0 0 18px 0;
  color: var(--ink);
  max-width: 18ch;
}
.display em {
  font-style: normal;
  color: var(--blue-hi);
}
.dek {
  font: 400 19px/1.55 var(--sans);
  color: var(--ink-soft);
  max-width: 56ch;
  margin: 0;
}

/* ===== Mono ticker (section break) ===== */
.ticker {
  font: 500 11.5px/1 var(--mono);
  color: var(--ink-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 14px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
}
.ticker span { white-space: nowrap; }
.ticker .sep { color: var(--ink-faint); }

/* ===== Sections ===== */
section { padding-block: clamp(56px, 8vw, 96px); }
section.tight { padding-block: clamp(36px, 5vw, 56px); }

h2 {
  font: 600 28px/1.15 var(--sans);
  letter-spacing: -0.015em;
  margin: 0 0 18px 0;
}
h3 {
  font: 600 20px/1.25 var(--sans);
  margin: 28px 0 10px 0;
}
p { margin: 0 0 18px 0; }
p + p { margin-top: 0; }
strong { color: var(--ink); font-weight: 600; }

/* Editorial column */
.prose { max-width: var(--col); margin-inline: auto; }
.prose p { color: var(--ink-soft); }
.prose h2 {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.prose h3 { color: var(--ink); margin-top: 36px; }
.prose ul, .prose ol { color: var(--ink-soft); padding-left: 22px; margin: 0 0 22px 0; }
.prose li { margin-bottom: 8px; }

.prose a {
  color: var(--blue-hi);
  border-bottom: 1px solid var(--blue);
}
.prose a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ===== Code ===== */
:not(pre) > code {
  font: 400 0.92em/1.4 var(--mono);
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 2px 6px;
  color: var(--blue-hi);
}
pre {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 22px 24px 22px;
  margin: 26px 0;
  overflow-x: auto;
  font: 400 14px/1.6 var(--mono);
  color: var(--ink-soft);
}
pre code { font: inherit; color: inherit; background: none; padding: 0; border: 0; }
pre[data-lang] { padding-top: 38px; }
pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 10px; right: 10px;
  font: 500 10.5px/1 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--canvas);
  padding: 4px 8px;
  border: 1px solid var(--blue);
}

/* ===== Card grid ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.cards--feed { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1099px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 639px) { .cards { grid-template-columns: 1fr; } }

.card {
  background: var(--panel);
  padding: 0;
  display: flex; flex-direction: column;
  transition: background 220ms ease, transform 220ms ease;
}
.card:hover { background: var(--panel-hi); transform: translateY(-2px); }
.card__img {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  border-bottom: 1px solid var(--rule);
}
.card:hover .card__img { border-bottom-color: var(--blue); }
.card__body { padding: 24px 24px 28px; flex: 1; display: flex; flex-direction: column; }
.card__eyebrow {
  font: 500 11.5px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 14px;
}
.card__title {
  font: 700 24px/1.05 var(--condensed);
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 0 0 12px 0;
}
.card__title a { color: var(--ink); border: none; }
.card__title a:hover { color: var(--blue-hi); }
.card__dek {
  color: var(--ink-muted);
  font-size: 15.5px;
  line-height: 1.55;
  margin: 0 0 18px 0;
  flex: 1;
}
.card__cta {
  font: 500 13px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
  border: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.card__cta::after { content: '→'; font-family: var(--mono); }
.card a.card__cta:hover { color: var(--blue-hi); border: none; }

/* ===== Inlined homepage post ===== */
.post-inline {
  border-top: 1px solid var(--rule);
  padding-block: clamp(56px, 7vw, 88px);
}
.post-inline:first-of-type { border-top: 0; }
.post-inline__head { max-width: var(--col); margin: 0 auto 28px; }
.post-inline__plate {
  max-width: var(--shell); margin: 0 auto 36px;
  border: 1px solid var(--rule);
  background: var(--panel);
  position: relative;
}
.post-inline__plate img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.post-inline h1 {
  font: 700 clamp(36px, 4.4vw, 56px)/0.98 var(--condensed);
  letter-spacing: -0.025em;
  text-transform: uppercase;
  margin: 0 0 14px;
}
.post-inline h1 a { color: var(--ink); border: none; }
.post-inline h1 a:hover { color: var(--blue-hi); }
.post-inline__meta {
  font: 500 11.5px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 14px;
}
.post-inline__meta .blue { color: var(--blue); }
.post-inline__more {
  display: inline-block;
  margin-top: 24px;
  font: 500 12.5px/1 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue);
  border: 1px solid var(--blue);
  padding: 12px 18px;
}
.post-inline__more:hover { background: var(--blue); color: var(--canvas); border-color: var(--blue); }

/* ===== Article page ===== */
.article-head {
  padding-top: clamp(40px, 6vw, 72px);
  padding-bottom: clamp(28px, 4vw, 40px);
  border-bottom: 1px solid var(--rule);
}
.article-head h1 {
  font: 700 clamp(44px, 5.4vw, 72px)/0.96 var(--condensed);
  letter-spacing: -0.028em;
  text-transform: uppercase;
  margin: 12px 0 18px;
}
.article-head .dek { max-width: 64ch; }
.article-plate { margin: 0 auto; max-width: var(--shell); }
.article-plate img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  border-bottom: 1px solid var(--rule);
}

.article-foot {
  border-top: 1px solid var(--rule);
  padding-block: clamp(40px, 5vw, 64px);
  font: 500 13px/1.55 var(--mono);
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}
.article-foot a { color: var(--blue-hi); border-bottom: 1px solid var(--blue); }

/* ===== Footer ===== */
footer.site {
  border-top: 1px solid var(--rule);
  background: var(--canvas);
  padding-block: 56px 40px;
  margin-top: 96px;
}
.foot-ticker {
  font: 500 11.5px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 14px 0;
  margin-bottom: 36px;
  display: flex; flex-wrap: wrap; gap: 8px 28px;
}
.foot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 40px;
  font: 400 14.5px/1.6 var(--mono);
  color: var(--ink-muted);
}
.foot-grid h4 {
  font: 500 11.5px/1 var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 14px;
}
.foot-grid ul { list-style: none; padding: 0; margin: 0; }
.foot-grid li { margin-bottom: 8px; }
.foot-grid a { color: var(--ink-muted); border: none; }
.foot-grid a:hover { color: var(--ink); }
@media (max-width: 720px) { .foot-grid { grid-template-columns: 1fr; } }

/* ===== 404 ===== */
.fourohfour {
  min-height: 60vh;
  display: flex; align-items: center;
  padding-block: 80px;
}
.fourohfour h1 {
  font: 700 clamp(80px, 14vw, 200px)/0.9 var(--condensed);
  letter-spacing: -0.035em;
  margin: 0;
  color: var(--blue);
}

/* ===== Selection ===== */
::selection { background: var(--blue); color: var(--ink); }

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .wordmark__cursor { animation: none; opacity: 1; }
  * { transition: none !important; }
}
