@import '../shared/stack-vars.css';
@import '../shared/stack-layout.css';

:root {
  --tab-offset: 2.1rem;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'Instrument Sans', system-ui, sans-serif;
  --text: 'Instrument Sans', system-ui, sans-serif;
  --display: 'Literata', Georgia, serif;
  --hi: #fff59d;
  --hi-edge: #f5e06a;
  --desk: #3d3830;
  --manila: #ebe4d4;
  --manila-edge: #c9bea8;
  --manila-dark: #d8cfbc;
  --ink: #1c1a16;
  --ink-muted: #4a4640;
  --l0-tab: #c9a86c;
  --l0-tab-fg: #2a2824;
  --l1-tab: #a8c4d4;
  --l1-tab-fg: #1a2830;
  --l2-tab: #b8d4a8;
  --l2-tab-fg: #1a2818;
  --l3-tab: #d4b8c4;
  --l3-tab-fg: #2a1820;
  --l4-tab: #d4c8a8;
  --l4-tab-fg: #2a2418;
  --l5-tab: #c4c4c4;
  --l5-tab-fg: #2a2a2a;
  --l6-tab: #6a7a8a;
  --l6-tab-fg: #f0ece4;
  --l7-tab: #2a4a6b;
  --l7-tab-fg: #ebe4d4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--desk);
  color: var(--ink);
  background-image:
    linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px),
    linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 400;
  padding: 0.5rem 1rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  text-align: center;
  color: #b8ad9d;
  background: rgba(42, 40, 36, 0.97);
  border-bottom: 1px solid #59534a;
}

.site-header a {
  color: #d4a574;
  text-decoration: none;
}

.site-header a:hover {
  color: #ebc39a;
}

.tab-rail {
  position: fixed;
  top: calc(var(--stack-nav) + 0.35rem);
  left: calc(50% + 20rem + 1.35rem);
  right: auto;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.3rem;
  background: rgba(42,40,36,0.94);
  border: 1px solid #4a4844;
  border-radius: 0;
}

.rail-tab {
  font-family: var(--mono);
  font-size: 0.55rem;
  padding: 0.22rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #8a8278;
  cursor: pointer;
  text-align: left;
  min-width: 2.1rem;
}

.rail-tab[data-layer="0"]:hover,
.rail-tab[data-layer="0"].active { background: var(--l0-tab); color: var(--l0-tab-fg); border-color: rgba(0,0,0,0.12); }
.rail-tab[data-layer="1"]:hover,
.rail-tab[data-layer="1"].active { background: var(--l1-tab); color: var(--l1-tab-fg); border-color: rgba(0,0,0,0.12); }
.rail-tab[data-layer="2"]:hover,
.rail-tab[data-layer="2"].active { background: var(--l2-tab); color: var(--l2-tab-fg); border-color: rgba(0,0,0,0.12); }
.rail-tab[data-layer="3"]:hover,
.rail-tab[data-layer="3"].active { background: var(--l3-tab); color: var(--l3-tab-fg); border-color: rgba(0,0,0,0.12); }
.rail-tab[data-layer="4"]:hover,
.rail-tab[data-layer="4"].active { background: var(--l4-tab); color: var(--l4-tab-fg); border-color: rgba(0,0,0,0.12); }
.rail-tab[data-layer="5"]:hover,
.rail-tab[data-layer="5"].active { background: var(--l5-tab); color: var(--l5-tab-fg); border-color: rgba(0,0,0,0.12); }
.rail-tab[data-layer="6"]:hover,
.rail-tab[data-layer="6"].active { background: var(--l6-tab); color: var(--l6-tab-fg); border-color: rgba(0,0,0,0.12); }
.rail-tab[data-layer="7"]:hover,
.rail-tab[data-layer="7"].active { background: var(--l7-tab); color: var(--l7-tab-fg); border-color: rgba(0,0,0,0.08); }

.mount {
  --folder-body-h: 30rem;
  width: min(640px, 100%);
  margin: 0 auto;
  padding: calc(var(--stack-nav) + 0.75rem) 1rem 2rem;
}

/* Scroll step between layers (folder uses display:contents) */
.folder:not(.folder--last) .body {
  margin-bottom: calc(var(--stack-scroll-slot) + 5.5rem);
}

.folder--last .body {
  margin-bottom: var(--stack-runway, 0px);
}

.folder {
  display: contents;
}

.folder .body {
  position: sticky;
  top: calc(var(--stack-stick) + var(--stack-tab-h) - 1px);
  cursor: pointer;
}

.tab {
  opacity: 1;
}

/* Each tab sticks above its folder body as you scroll the stack */
.tab {
  position: sticky;
  display: block;
  top: var(--stack-stick);
  height: var(--stack-tab-h);
  box-sizing: border-box;
  width: max-content;
  max-width: none;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
  padding: 0.28rem 0.5rem 0;
  border: 1px solid rgba(0,0,0,0.18);
  border-bottom: none;
  border-radius: 0;
  cursor: pointer;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}

.tab-label { font-weight: 500; opacity: 0.92; }

.tab:hover { filter: brightness(1.04); }

/* Every folder same height — previews fill remaining space */
.body {
  min-height: var(--folder-body-h);
  height: var(--folder-body-h);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.55;
  background: linear-gradient(180deg, var(--manila) 0%, #e3dbc8 100%);
  border: 1px solid var(--manila-edge);
  border-top: 2px solid var(--manila-dark);
  border-radius: 0;
  padding: 0.85rem 1rem 0.95rem 1.15rem;
  box-shadow:
    inset 5px 0 0 var(--manila-dark),
    inset 0 -1px 0 rgba(0,0,0,0.06);
}

.body-copy {
  flex-shrink: 0;
  overflow: hidden;
}

.body-copy h2 {
  margin-bottom: 0.25rem;
}

.body-copy p:last-child {
  margin-bottom: 0.35rem;
}

.body-fill {
  flex: 1 1 auto;
  min-height: 0;
  pointer-events: none;
}

/* Preview folders: text on top, screenshot fills the rest */
.body--has-preview {
  padding-bottom: 0.7rem;
  overflow: hidden;
}

.body--has-preview .body-copy {
  max-height: 38%;
  overflow: hidden;
  overflow-y: hidden;
}

.body--has-preview .body-copy p {
  margin-bottom: 0.3rem;
  font-size: 0.86rem;
  line-height: 1.5;
}

.body--has-preview .body-copy h1 {
  font-size: 1.2rem;
  margin-bottom: 0.2rem;
}

.body--has-preview .body-copy h2 {
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}

.body--has-preview .body-copy .cta-block {
  margin-top: 0.35rem;
}

.body--has-preview .terms-list {
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.body--has-preview .terms-list li {
  margin-bottom: 0.2rem;
}

/* Screenshot preview — click opens site in new tab */
a.site-preview {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0.4rem 0 0;
  border: 1px solid var(--manila-edge);
  background: #f6f2e8;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
}

a.site-preview:hover {
  border-color: #a89878;
  filter: brightness(1.02);
}

.site-preview-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.45rem;
  background: #ddd6c8;
  border-bottom: 1px solid var(--manila-edge);
  font-family: var(--mono);
  font-size: 0.52rem;
  color: var(--ink-muted);
}

.site-preview-url {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-preview-go {
  color: #2a4a6b;
  font-weight: 600;
}

.site-preview-frame {
  display: flex;
  flex: 1 1 0;
  min-height: 11rem;
  overflow: hidden;
  background: #1a1814;
}

.site-preview-img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: top center;
  background: #1a1814;
}

.cta-block {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.55rem 0 0.35rem;
}

.body .btn {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.body .btn--primary {
  background: #2a4a6b;
  color: #fff !important;
  border: 1px solid #1e3854;
}

.body .btn--primary:hover {
  background: #1e3854;
  color: #fff !important;
}

.body .btn--ghost {
  background: #f6f2e8;
  color: #1c3a5c !important;
  border: 1px solid #8a9ab0;
}

.body .btn--ghost:hover {
  background: #fff;
  color: #2a4a6b !important;
}

.service-deep-list {
  margin: 0 0 0.5rem 0;
  padding: 0;
  list-style: none;
  font-size: 1.05rem;
  line-height: 1.4;
  color: var(--ink);
}

.service-deep-list > li {
  margin-bottom: 0.55rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.service-deep-list > li:last-child {
  border-bottom: none;
  margin-bottom: 0.35rem;
}

.service-deep-list strong {
  display: inline;
  font-family: var(--sans);
  font-size: inherit;
  font-weight: 600;
  color: var(--ink);
}

.hi {
  font-weight: 600;
  color: var(--ink);
}

.service-deep-list .xref {
  display: block;
  margin-top: 0.2rem;
}

.section-lead {
  font-size: 0.88rem;
  color: var(--ink-muted);
  margin-bottom: 0.55rem;
}

/* L2 — dense copy, no internal scroll */
.folder--services .body-copy {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  overflow-y: hidden;
}

.folder--services .section-lead {
  font-size: 0.86rem;
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

.folder--services .service-deep-list {
  font-size: 0.8rem;
  line-height: 1.35;
}

.folder--services .service-deep-list > li {
  margin-bottom: 0.35rem;
  padding-bottom: 0.3rem;
}

.folder--services .service-deep-list strong {
  font-size: 0.88rem;
  display: inline;
  margin-right: 0.2rem;
}

.folder--services .service-deep-list .xref {
  display: inline;
  margin-top: 0;
  margin-left: 0.15rem;
}

.folder--services .body-copy > p:last-child {
  font-size: 0.78rem;
  margin-bottom: 0;
}

.body::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 28%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.03));
}

/* Bodies pile by z-index; each tab sticks above its folder */
.f0 .body { z-index: 1; }
.f1 .body { z-index: 2; }
.f2 .body { z-index: 3; }
.f3 .body { z-index: 4; }
.f4 .body { z-index: 5; }
.f5 .body { z-index: 6; }
.f6 .body { z-index: 7; }
.f7 .body { z-index: 8; }

.f0 .tab { margin-left: calc(var(--tab-offset) * 0); z-index: 110; background: var(--l0-tab); color: var(--l0-tab-fg); }
.f1 .tab { margin-left: calc(var(--tab-offset) * 1); z-index: 111; background: var(--l1-tab); color: var(--l1-tab-fg); }
.f2 .tab { margin-left: calc(var(--tab-offset) * 2); z-index: 112; background: var(--l2-tab); color: var(--l2-tab-fg); }
.f3 .tab { margin-left: calc(var(--tab-offset) * 3); z-index: 113; background: var(--l3-tab); color: var(--l3-tab-fg); }
.f4 .tab { margin-left: calc(var(--tab-offset) * 4); z-index: 114; background: var(--l4-tab); color: var(--l4-tab-fg); }
.f5 .tab { margin-left: calc(var(--tab-offset) * 5); z-index: 115; background: var(--l5-tab); color: var(--l5-tab-fg); }
.f6 .tab { margin-left: calc(var(--tab-offset) * 6); z-index: 116; background: var(--l6-tab); color: var(--l6-tab-fg); }
.f7 .tab { margin-left: calc(var(--tab-offset) * 7); z-index: 117; background: var(--l7-tab); color: var(--l7-tab-fg); }

.file-id {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-bottom: 0.35rem;
}

.body h1 {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.35rem;
  color: var(--ink);
}

.body h2 {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--ink);
}

.lead, .body p, .clause {
  font-size: 0.88rem;
  color: var(--ink-muted);
  line-height: 1.55;
  margin-bottom: 0.45rem;
}

.stack-note, .xref {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-muted);
}

.body a:not(.btn) { color: #2a4a6b; font-weight: 600; }

.meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin: 0.5rem 0 0.65rem;
}

.meta-table th {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-align: left;
  color: var(--ink-muted);
  padding: 0.2rem 0.65rem 0.2rem 0;
  vertical-align: top;
  width: 5.5rem;
}

.meta-table td { padding: 0.2rem 0; color: var(--ink); }

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.12rem 0.4rem;
  border: 1px solid var(--ink);
  color: var(--ink);
}

.badge--avail { border-color: #3d6b3d; color: #2d5a2d; }

.avail { margin-top: 0.35rem; font-size: 0.82rem; }

.terms-list {
  margin: 0 0 0.65rem 1rem;
  font-size: 1.05rem;
  color: var(--ink);
  line-height: 1.45;
}

.terms-list strong {
  font-weight: 600;
  color: var(--ink);
}

.terms-list li { margin-bottom: 0.35rem; }

.meta-table--contact { margin-top: 0.5rem; }

.btn {
  padding: 0.5rem 0.85rem;
  text-decoration: none;
  border-radius: 0;
  margin-right: 0.35rem;
  display: inline-block;
  margin-top: 0.3rem;
}

/* Cal.com embed (needs embed allowlist on cal.levkin.ca for levkin.ca) */
.cal-slot {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0.4rem 0 0;
  border: 1px solid var(--manila-edge);
  background: #1a1814;
  overflow: hidden;
}

.cal-slot .site-preview-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.45rem;
  background: #ddd6c8;
  border-bottom: 1px solid var(--manila-edge);
  font-family: var(--mono);
  font-size: 0.52rem;
  color: var(--ink-muted);
}

.cal-slot .site-preview-go {
  color: #2a4a6b;
  font-weight: 600;
  text-decoration: none;
}

.cal-embed-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 11rem;
  background: #0a0a0a;
}

.cal-slot[data-cal-theme='light'] .cal-embed-frame {
  background: #f5f3ee;
}

.cal-inline {
  width: 100%;
  height: 100%;
  min-height: 14rem;
  overflow: auto;
}

.cal-slot.is-blocked .cal-inline {
  display: none;
}

.cal-slot.is-embedded .cal-inline iframe {
  display: block;
  width: 100%;
  min-height: 14rem;
  border: 0;
}

.cal-embed-fallback {
  display: none;
  position: absolute;
  inset: 0;
  text-decoration: none;
  color: inherit;
}

.cal-slot.is-blocked .cal-embed-fallback {
  display: flex;
  flex-direction: column;
}

.cal-embed-fallback img {
  flex: 1;
  width: 100%;
  object-fit: cover;
  object-position: top center;
  /* Crop Cal.com branding bar at bottom of screenshot */
  max-height: calc(100% + 2rem);
  margin-bottom: -2rem;
}

.cal-embed-fallback-label {
  font-family: var(--mono);
  font-size: 0.55rem;
  text-align: center;
  padding: 0.35rem;
  background: rgba(0, 0, 0, 0.75);
  color: #c4b8a8;
}

.service-note {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--ink-muted);
  margin-bottom: 0.28rem;
}

.folder--services .service-deep-list > li {
  margin-bottom: 0.28rem;
  padding-bottom: 0.22rem;
}

.folder--services .body-copy > p:last-child {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .tab-rail { display: none; }
  .mount { padding-right: 1rem; }
  :root { --tab-offset: 1.75rem; }
}

