/* ── Devlog — list + reading view (prefix dev-) ──────────────────────────────
   Chrome (nav/footer/eyebrow/divider) is reused from company.css; this
   file is the devlog-specific layout and the markdown reading styles. */

.dev-main { padding-top: 64px; min-height: 100vh; }
.dev-view { padding: 56px 28px 90px; }

.dev-head { margin-bottom: 8px; }
.dev-head .co-h2 { margin-bottom: 16px; }
.dev-head .co-lead { max-width: 680px; }

/* ── Search ──────────────────────────────────────────────────────────────── */
.dev-search { position: relative; margin-top: 30px; }
.dev-search__icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--amber2); pointer-events: none; line-height: 0;
}
.dev-search__icon svg { width: 18px; height: 18px; display: block; }
.dev-search__input {
  width: 100%;
  font-family: var(--font-body), serif; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  clip-path: var(--chamfer-sm);
  padding: 12px 40px 12px 42px;
  transition: border-color .15s, box-shadow .15s;
}
.dev-search__clear {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center;
  width: 26px; height: 26px;
  background: none; border: none; cursor: pointer;
  color: var(--text3); line-height: 0;
  transition: color .15s;
}
.dev-search__clear svg { width: 14px; height: 14px; display: block; }
.dev-search__clear:hover { color: var(--amber2); }
.dev-search__clear[hidden] { display: none; }   /* class display: grid otherwise overrides [hidden] */
.dev-search__input::placeholder { color: var(--text3); }
.dev-search__input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(124,58,237,0.30), 0 0 14px rgba(124,58,237,0.22);
}
/* drop WebKit's default search decorations so it stays on-theme */
.dev-search__input::-webkit-search-decoration,
.dev-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ── List of entries ─────────────────────────────────────────────────────── */
.dev-list { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }

/* Each entry is an interactive rune-edge row (af-entry) that links to the post. */
.dev-entry {
  display: block; text-decoration: none; color: inherit;
  padding: 20px 22px;
  /* lift the card off the page a touch + a clearer edge, so entries separate */
  background: #140d2b; border-color: #2a1858;
}
.dev-entry__title {
  font-family: var(--font-display), serif; font-size: 22px; font-weight: 600;
  color: var(--gold-text); line-height: 1.2; margin-bottom: 7px;
}
.dev-entry:hover .dev-entry__title { color: #ffe2b3; }
.dev-entry__excerpt {
  font-family: var(--font-body), serif; font-size: 15px; color: #bcc3d4;
  line-height: 1.7; max-width: 720px;
}
/* Tag chips — chamfered, with a leading rune glyph. Shared by cards + article. */
.dev-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.dev-tags--article { margin-top: 14px; }
.dev-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body), serif; font-size: 11.5px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--violet-300);
  background: rgba(124,58,237,0.10);
  border: 1px solid rgba(124,58,237,0.25);
  clip-path: var(--chamfer-sm);
  padding: 4px 10px;
}
.dev-tag::before { content: "\25C8"; color: var(--amber2); font-size: 9px; }   /* ◈ facet */
/* Clickable chips (article view) — jump back to the list filtered by that tag. */
a.dev-tag { text-decoration: none; cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
a.dev-tag:hover { color: #ffe2b3; border-color: rgba(124,58,237,0.5); background: rgba(124,58,237,0.18); }

.dev-state {
  font-family: var(--font-body), serif; color: var(--text2); font-size: 15px;
  margin-top: 28px; font-style: italic;
}

/* ── Skeleton loaders (delayed — only seen if a fetch is genuinely slow) ────── */
.dev-skel { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.dev-skel[hidden] { display: none; }
.dev-skel--article { margin-top: 4px; max-width: 820px; }
.dev-skel-card {
  background: #140d2b; border: 1px solid #2a1858; clip-path: var(--chamfer-sm);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 12px;
}
.dev-skel-line {
  height: 13px; border-radius: 3px;
  background: linear-gradient(90deg, var(--surface2) 25%, #241652 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: dev-shimmer 1.4s linear infinite;
}
.dev-skel-line.w-title   { width: 58%;   height: 18px; }
.dev-skel-line.w-short   { width: 42%; }
.dev-skel-line.w-med     { width: 72%; }
.dev-skel-line.w-titlelg { width: 66%;   height: 34px; }
.dev-skel-rule { height: 1px; background: var(--border); margin: 10px 0 18px; }
@keyframes dev-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .dev-skel-line { animation: none; background: var(--surface2); }
}

/* ── Folder (article with children) ──────────────────────────────────────── */
.dev-folder { display: flex; flex-direction: column; }
.dev-folder__head {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  clip-path: var(--chamfer-sm);
  transition: border-color .15s, background .15s;
}
.dev-folder__head:hover { border-color: var(--border2); background: var(--surface2); }
.dev-folder__toggle {
  flex: none; width: 12px; color: var(--amber2); font-size: 11px;
  transition: transform .18s ease;
}
.dev-folder__toggle::before { content: "\25B8"; }   /* ▸ */
.dev-folder.is-open > .dev-folder__head .dev-folder__toggle { transform: rotate(90deg); }
.dev-folder__name {
  font-family: var(--font-display), serif; font-size: 19px; font-weight: 600;
  color: var(--gold-text); line-height: 1.2;
}
.dev-folder__count {
  font-family: var(--font-body), serif; font-size: 12px; color: var(--text3);
  letter-spacing: 0.04em;
}
.dev-folder__open { margin-left: auto; font-size: 13px; }

/* Children: smoothly expand/collapse via the grid 0fr→1fr height trick, with a
   fade on the revealed entries. The inner element clips the content while it
   animates and carries the indentation + tree spine. */
.dev-folder__body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .28s ease;
}
.dev-folder.is-open > .dev-folder__body { grid-template-rows: 1fr; }
.dev-folder__inner {
  overflow: hidden; min-height: 0;
  display: flex; flex-direction: column; gap: 12px;
  /* subtle inset + guide rail, not a big block shift */
  margin-left: 2px; padding-left: 14px; border-left: 1px solid var(--border);
  opacity: 0; transition: opacity .28s ease;
}
.dev-folder.is-open > .dev-folder__body > .dev-folder__inner {
  opacity: 1; padding-top: 12px; padding-bottom: 6px;
}

/* ── Article reading view ────────────────────────────────────────────────── */
.dev-back { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 26px; font-size: 14px; }
.dev-back__arrow { width: 15px; height: 15px; flex-shrink: 0; transition: transform .18s ease; }
.dev-back:hover .dev-back__arrow { transform: translateX(-2px); }   /* nudge back on hover */
.dev-title {
  font-family: var(--font-display), serif; font-size: clamp(30px, 4.5vw, 46px);
  font-weight: 600; color: var(--gold-text); line-height: 1.12; letter-spacing: 0.01em;
  margin-bottom: 14px;
}
.dev-rule { max-width: 1080px; margin: 26px 0 32px; }

/* Staggered entrance when an article loads (mirrors the home-page reveals). */
@keyframes dev-reveal { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.dev-view.is-revealing .dev-back     { animation: dev-reveal .5s ease both; }
.dev-view.is-revealing .dev-title    { animation: dev-reveal .5s ease both .07s; }
.dev-view.is-revealing .dev-tags     { animation: dev-reveal .5s ease both .17s; }
/* The article-top divider plays the kit's sequenced reveal (glyph rises + shines,
   then the lines draw outward), same signature as the home-page dividers. */
.dev-view.is-revealing .dev-rule     { animation: af-divider-rise .6s ease-out both .21s; }
.dev-view.is-revealing .dev-rule::before,
.dev-view.is-revealing .dev-rule::after { animation: af-divider-extend .5s ease-out both .71s; }
.dev-view.is-revealing .dev-body     { animation: dev-reveal .5s ease both .27s; }
.dev-view.is-revealing .dev-children { animation: dev-reveal .5s ease both .35s; }
/* Same entrance for the list view (header + entries), once on first load. */
.dev-view.is-revealing .dev-head .co-eyebrow { animation: dev-reveal .5s ease both; }
.dev-view.is-revealing .dev-head .co-h2      { animation: dev-reveal .5s ease both .07s; }
.dev-view.is-revealing .dev-head .co-lead    { animation: dev-reveal .5s ease both .13s; }
.dev-view.is-revealing .dev-search           { animation: dev-reveal .5s ease both .18s; }
.dev-view.is-revealing .dev-list > *         { animation: dev-reveal .5s ease both; }
.dev-view.is-revealing .dev-list > *:nth-child(1) { animation-delay: .24s; }
.dev-view.is-revealing .dev-list > *:nth-child(2) { animation-delay: .30s; }
.dev-view.is-revealing .dev-list > *:nth-child(3) { animation-delay: .36s; }
.dev-view.is-revealing .dev-list > *:nth-child(4) { animation-delay: .42s; }
.dev-view.is-revealing .dev-list > *:nth-child(5) { animation-delay: .48s; }
.dev-view.is-revealing .dev-list > *:nth-child(n+6) { animation-delay: .54s; }

/* Lighter variant: stagger only the list entries, leaving the page chrome
   (header, search bar) untouched. Used when clearing the search drops you back
   to the full browse list — the visible cards/folders cascade back in. Delays
   start near zero since there's no header animating ahead of them. */
.dev-view.is-revealing-list .dev-list > *         { animation: dev-reveal .5s ease both; }
.dev-view.is-revealing-list .dev-list > *:nth-child(1) { animation-delay: 0s; }
.dev-view.is-revealing-list .dev-list > *:nth-child(2) { animation-delay: .06s; }
.dev-view.is-revealing-list .dev-list > *:nth-child(3) { animation-delay: .12s; }
.dev-view.is-revealing-list .dev-list > *:nth-child(4) { animation-delay: .18s; }
.dev-view.is-revealing-list .dev-list > *:nth-child(5) { animation-delay: .24s; }
.dev-view.is-revealing-list .dev-list > *:nth-child(n+6) { animation-delay: .30s; }

@media (prefers-reduced-motion: reduce) {
  .dev-view.is-revealing-list .dev-list > * { animation: none; }
  .dev-view.is-revealing .dev-back,
  .dev-view.is-revealing .dev-title,
  .dev-view.is-revealing .dev-tags,
  .dev-view.is-revealing .dev-rule,
  .dev-view.is-revealing .dev-rule::before,
  .dev-view.is-revealing .dev-rule::after,
  .dev-view.is-revealing .dev-body,
  .dev-view.is-revealing .dev-children,
  .dev-view.is-revealing .dev-head .co-eyebrow,
  .dev-view.is-revealing .dev-head .co-h2,
  .dev-view.is-revealing .dev-head .co-lead,
  .dev-view.is-revealing .dev-search,
  .dev-view.is-revealing .dev-list > * { animation: none; }
}

/* ── In-article child navigation ─────────────────────────────────────────────
   Pills linking to an article's direct children, shown at its foot. */
.dev-children { margin-top: 44px; padding-top: 26px; border-top: 1px solid var(--border); }
.dev-children[hidden] { display: none; }
.dev-children__label {
  font-family: var(--font-display), serif; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--amber2);
  margin-bottom: 14px;
}
.dev-children__grid { display: flex; flex-wrap: wrap; gap: 10px; }
.dev-child {
  display: inline-flex; align-items: center; gap: 9px; max-width: 100%;
  font-family: var(--font-body), serif; font-size: 14.5px; color: var(--text2);
  text-decoration: none;
  background: var(--surface); border: 1px solid var(--border);
  clip-path: var(--chamfer-sm);
  padding: 10px 15px;
  transition: border-color .15s, background .15s, color .15s;
}
.dev-child:hover { border-color: var(--border2); background: var(--surface2); color: var(--gold-text); }
.dev-child__glyph { color: var(--amber2); font-size: 11px; flex-shrink: 0; }
.dev-child__name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px;
}
@media (max-width: 560px) {
  .dev-children__grid { flex-direction: column; }
  .dev-child { width: 100%; }
  .dev-child__name { max-width: none; white-space: normal; }   /* full titles, stacked */
}

/* ── Markdown body ───────────────────────────────────────────────────────── */
.markdown { max-width: 760px; }
.markdown > *:first-child { margin-top: 0; }
.markdown p,
.markdown li {
  font-family: var(--font-body), serif; font-size: 18px; line-height: 1.85;
  color: var(--text);
}
.markdown p { margin: 0 0 18px; }
.markdown h2, .markdown h3, .markdown h4 {
  font-family: var(--font-display), serif; font-weight: 600; color: var(--gold-text);
  letter-spacing: 0.01em; line-height: 1.25;
}
/* Section headings wear a short tapered underline — a light recurring "seal"
   that echoes the article's top divider and reinforces the structural break,
   without a full rule chopping the column. */
.markdown h2 { font-size: 28px; margin: 40px 0 16px; position: relative; padding-bottom: 11px; }
.markdown h2::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 64px; height: 2px;
  background: linear-gradient(90deg, rgba(217,119,6,0.7), rgba(124,58,237,0.4) 70%, transparent);
}
.markdown h3 { font-size: 23px; margin: 32px 0 12px; color: var(--violet-300); }
.markdown h4 { font-size: 19px; margin: 26px 0 10px; }
.markdown a { color: var(--amber-lit); text-decoration: underline; text-underline-offset: 2px; }
.markdown a:hover { color: #ffe2b3; }
.markdown strong { color: var(--gold-text); font-weight: 600; }
.markdown em { color: var(--text); }

.markdown ul, .markdown ol { margin: 0 0 18px; padding-left: 26px; }
.markdown li { margin-bottom: 7px; }
.markdown li::marker { color: var(--amber2); }

.markdown blockquote {
  margin: 0 0 20px; padding: 6px 20px;
  border-left: 2px solid transparent;
  border-image: linear-gradient(180deg, var(--amber), var(--accent)) 1;
  color: var(--text2); font-style: italic;
}

.markdown code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.86em;
  background: var(--surface2); color: var(--violet-300);
  padding: 2px 6px; border: 1px solid var(--border);
}
.markdown pre {
  background: var(--surface2); border: 1px solid var(--border);
  clip-path: var(--chamfer-sm); padding: 16px 18px; margin: 0 0 20px;
  overflow-x: auto;
}
.markdown pre code { background: none; border: none; padding: 0; color: var(--text2); font-size: 13.5px; line-height: 1.6; }

.markdown img,
.markdown video { max-width: 100%; height: auto; clip-path: var(--chamfer-sm); margin: 6px 0 20px; }
.markdown video { display: block; width: 100%; background: #000; }

.markdown hr {
  border: none; height: 1px; margin: 32px 0;
  background: linear-gradient(90deg, transparent, var(--amber), var(--accent), transparent);
  opacity: 0.5;
}

.markdown table {
  width: 100%; border-collapse: collapse; margin: 0 0 22px;
  font-family: var(--font-body), serif; font-size: 15px;
}
.markdown th, .markdown td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; }
.markdown th { background: var(--surface2); color: var(--gold-text); font-weight: 600; }
.markdown td { color: var(--text2); }

/* ── Back-to-top ─────────────────────────────────────────────────────────── */
.dev-totop {
  --totop-lift: 0px;   /* JS raises this when the footer scrolls into view */
  position: fixed; right: 24px; bottom: calc(24px + var(--totop-lift)); z-index: 90;
  width: 44px; height: 44px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(124,58,237,0.95), rgba(100,30,210,0.95));
  color: var(--gold-text); border: none; cursor: pointer;
  clip-path: var(--chamfer-sm);
  box-shadow: 0 0 14px rgba(124,58,237,0.35);
  font-family: var(--font-display), serif; font-size: 20px; line-height: 1;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, background .2s ease, box-shadow .2s ease;
}
.dev-totop.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.dev-totop:hover {
  background: linear-gradient(135deg, #b45309, #d97706);
  box-shadow: 0 6px 20px rgba(217,119,6,0.4), 0 0 24px rgba(217,119,6,0.4);
  transform: translateY(-2px);
}
.dev-totop:active { transform: translateY(0); }
.dev-totop svg { width: 20px; height: 20px; display: block; }

@media (max-width: 480px) {
  .dev-view { padding-left: 18px; padding-right: 18px; }
  .markdown p, .markdown li { font-size: 16px; }
  .dev-totop { right: 16px; bottom: calc(16px + var(--totop-lift)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dev-totop { transition: opacity .2s ease; transform: none; }
  .dev-folder__body, .dev-folder__inner, .dev-folder__toggle { transition: none; }
}
