:root {
  --ink: #171716;
  --muted: #6c6c67;
  --soft: #f4f4f1;
  --paper: #fbfbf9;
  --white: #ffffff;
  --line: #deded8;
  --line-dark: #c8c8c1;
  --radius: 14px;
  --shadow:
    0 1px 2px rgba(0, 0, 0, 0.03),
    0 8px 30px rgba(0, 0, 0, 0.025);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
}

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

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 249, 0.96);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-family: Georgia, serif;
  font-size: 17px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 13px;
}

.topnav > a:not(.button) {
  color: var(--muted);
}

.topnav > a:hover {
  color: var(--ink);
}

.account {
  padding-left: 22px;
  border-left: 1px solid var(--line);
  font-weight: 550;
}

.quiet-link {
  color: var(--muted);
}

.shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 72px 0 100px;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 600;
}

h2 {
  letter-spacing: -0.025em;
}

.page-copy,
.hero-copy {
  color: var(--muted);
  line-height: 1.65;
  font-size: 16px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 17px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
}

.button-dark {
  background: var(--ink);
  color: white;
}

.button-dark:hover {
  opacity: 0.88;
}

.button-disabled {
  background: #e8e8e3;
  color: #92928c;
  cursor: default;
}

.hero {
  max-width: 760px;
  padding: 90px 0;
}

.hero-public h1 {
  max-width: 700px;
}

.hero-copy {
  max-width: 610px;
  font-size: 18px;
}

.hero-actions {
  margin-top: 30px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 42px;
}

.page-heading h1 {
  margin-bottom: 12px;
}

.page-heading .page-copy {
  max-width: 620px;
  margin-bottom: 0;
}

.library-grid,
.template-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(285px, 1fr));
  gap: 18px;
}

.library-card,
.template-card {
  min-height: 270px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.library-card {
  justify-content: space-between;
}

.library-card:hover,
.template-card:hover {
  border-color: var(--line-dark);
}

.library-card-top,
.template-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.library-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--soft);
  font-family: Georgia, serif;
  font-size: 19px;
}

.status-pill,
.selected-badge {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-muted {
  color: var(--muted);
  background: var(--soft);
}

.library-card-body {
  margin: 30px 0;
}

.library-card h2,
.template-card h2 {
  margin-bottom: 7px;
  font-size: 22px;
  font-weight: 600;
}

.library-slug {
  margin-bottom: 17px;
  color: var(--muted);
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  font-size: 11px;
}

.library-description,
.template-description,
.best-for {
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.library-card-footer {
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
}

.library-card-footer a {
  display: flex;
  justify-content: space-between;
}

.unavailable-link {
  color: #9a9a94;
  font-weight: 500;
}

.workspace-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 70px;
  margin-top: 80px;
  padding-top: 48px;
  border-top: 1px solid var(--line);
}

.workspace-row h2 {
  max-width: 330px;
  font-size: 28px;
  font-weight: 550;
}

.workspace-links {
  border-top: 1px solid var(--line);
}

.workspace-links a {
  display: flex;
  justify-content: space-between;
  padding: 17px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.creation-heading {
  max-width: 720px;
  margin-bottom: 44px;
}

.creation-heading h1 {
  margin-top: 32px;
}

.creation-copy {
  max-width: 600px;
}

.back-link {
  color: var(--muted);
  font-size: 13px;
}

.template-card {
  min-height: 420px;
}

.template-selected {
  border-color: var(--ink);
  box-shadow:
    0 0 0 1px var(--ink),
    var(--shadow);
}

.template-kind {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.best-for {
  margin-top: 18px;
}

.structure-preview {
  margin-top: auto;
  padding-top: 24px;
}

.structure-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.structure-preview ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.structure-preview li {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.structure-preview .more {
  color: var(--muted);
}

.blank-preview {
  margin-top: auto;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.selected-template-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-top: 28px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.selected-template-panel h2 {
  margin-bottom: 8px;
}

.selected-template-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.empty-state {
  padding: 50px;
  border: 1px dashed var(--line-dark);
  border-radius: var(--radius);
  text-align: center;
}

@media (max-width: 760px) {
  .topbar {
    padding: 0 20px;
  }

  .topnav > a:not(.button),
  .account {
    display: none;
  }

  .shell {
    width: min(100% - 32px, 1180px);
    padding-top: 44px;
  }

  .page-heading,
  .selected-template-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-row {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* ----------------------------------------------------------
   Library creation surface

   A deliberately faint construction-grid motif. It belongs
   to creation/onboarding only, not to the main Library UI.
   ---------------------------------------------------------- */

.creation-page {
  position: relative;
}

.creation-page::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 68px 0 0;
  pointer-events: none;

  background-image:
    linear-gradient(
      rgba(23, 23, 22, 0.048) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(23, 23, 22, 0.048) 1px,
      transparent 1px
    );

  background-size: 38px 38px;

  -webkit-mask-image:
    linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.82),
      rgba(0, 0, 0, 0.38) 68%,
      transparent 100%
    );

  mask-image:
    linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.82),
      rgba(0, 0, 0, 0.38) 68%,
      transparent 100%
    );
}

.creation-page .shell {
  position: relative;
  z-index: 1;
}

.configuration-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 22px;
  align-items: start;
}

.configuration-form-card,
.configuration-summary {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.configuration-form-card {
  padding: 34px;
}

.configuration-summary {
  padding: 28px;
}

.field-group {
  margin-bottom: 30px;
}

.field-group label {
  display: block;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 650;
}

.optional {
  margin-left: 5px;
  color: var(--muted);
  font-weight: 450;
}

.field-group input,
.field-group textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  outline: none;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.field-group input:focus,
.field-group textarea:focus {
  border-color: var(--ink);
  box-shadow:
    0 0 0 1px var(--ink);
}

.field-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.slug-field {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: var(--soft);
}

.slug-field:focus-within {
  border-color: var(--ink);
  box-shadow:
    0 0 0 1px var(--ink);
}

.slug-field > span {
  padding-left: 13px;
  color: var(--muted);
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  font-size: 12px;
}

.slug-field input {
  border: 0;
  box-shadow: none !important;
  background: transparent;
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  font-size: 12px;
}

.configuration-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
}

.next-step-note {
  color: var(--muted);
  font-size: 11px;
}

.configuration-summary h2 {
  margin-bottom: 12px;
  font-size: 25px;
  font-weight: 600;
}

.summary-structure {
  margin-top: 30px;
}

.summary-structure ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.summary-structure li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.change-template {
  display: inline-block;
  margin-top: 25px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 820px) {
  .configuration-layout {
    grid-template-columns: 1fr;
  }
}

button.button {
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

button.button:disabled {
  background: #e8e8e3;
  color: #92928c;
  cursor: default;
  opacity: 1;
}

.review-layout {
  display: grid;
  grid-template-columns:
    minmax(0, 1.35fr)
    minmax(290px, 0.65fr);
  gap: 22px;
  align-items: start;
}

.review-card,
.creation-confirmation {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.review-card {
  padding: 34px;
}

.creation-confirmation {
  padding: 28px;
  position: sticky;
  top: 94px;
}

.review-section + .review-section {
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.review-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.review-section h2 {
  margin-bottom: 6px;
  font-size: 30px;
}

.review-section h3 {
  margin-bottom: 9px;
  font-size: 21px;
}

.review-address {
  color: var(--muted);
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  font-size: 12px;
}

.review-description {
  max-width: 620px;
  margin-top: 20px;
  color: var(--muted);
  line-height: 1.6;
}

.review-shelves {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.review-shelves li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.creation-confirmation h2 {
  font-size: 25px;
}

.creation-confirmation > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.creation-confirmation .button {
  width: 100%;
  margin-top: 15px;
}

.confirmation-note {
  margin: 11px 0 0;
  text-align: center;
  font-size: 10px !important;
}

@media (max-width: 820px) {
  .review-layout {
    grid-template-columns: 1fr;
  }

  .creation-confirmation {
    position: static;
  }
}

.building-layout {
  display: grid;
  grid-template-columns:
    minmax(0, 1.35fr)
    minmax(290px, 0.65fr);
  gap: 22px;
  align-items: start;
}

.building-card,
.building-summary {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.building-card {
  padding: 12px 34px;
}

.building-summary {
  padding: 28px;
}

.build-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 13px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  color: #9a9a94;
}

.build-step:last-child {
  border-bottom: 0;
}

.build-step-complete {
  color: var(--ink);
}

.build-marker {
  padding-top: 2px;
  font-size: 15px;
}

.build-step h2 {
  margin-bottom: 5px;
  font-size: 16px;
  font-weight: 600;
}

.build-step p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.building-summary h2 {
  margin-bottom: 22px;
  font-size: 25px;
}

.building-summary dl {
  margin: 0;
}

.building-summary dl > div {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.building-summary dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.building-summary dd {
  margin: 0;
  font-size: 12px;
}

.request-id {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.request-id code {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

@media (max-width: 820px) {
  .building-layout {
    grid-template-columns: 1fr;
  }
}

.build-step-current {
  color: var(--ink);
}

.build-step-current .build-marker {
  font-weight: 700;
}

.build-step-failed {
  color: var(--ink);
}

.build-step-failed .build-marker {
  font-weight: 700;
}

.building-ready-actions {
  margin-top: 24px;
}

.building-ready-actions .quiet-link {
  display: inline-block;
  margin-left: 14px;
}

.building-error {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.55;
}
