:root {
  color-scheme: light;
  --ink: #202124;
  --paper: #f4ecd7;
  --panel: #fff8e8;
  --white: #fffdf6;
  --mint: #b7dbc9;
  --cyan: #86b6d7;
  --coral: #d96f59;
  --violet: #6f6a9f;
  --gold: #e9bc5f;
  --shadow: #252525;
  --muted: #625f57;
  --danger: #b3261e;
  --line: #393633;
  --soft-shadow: rgba(37, 37, 37, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
}

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", Arial, sans-serif;
  background:
    linear-gradient(90deg, rgba(23, 23, 23, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(23, 23, 23, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
}

body.distraction-free .site-header,
body.distraction-free .site-footer,
body.distraction-free .document-sidebar,
body.distraction-free .format-toolbar {
  display: none;
}

body.distraction-free .writer-app {
  grid-template-columns: 1fr;
}

body.distraction-free .shell {
  width: min(900px, calc(100% - 24px));
}

body.distraction-free .writer-actions .button:not(.focus-exit) {
  display: none;
}

body.distraction-free .focus-exit {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 30;
  display: inline-flex;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea,
[contenteditable="true"] {
  outline-offset: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 3px solid var(--coral);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 20;
  padding: 0.7rem 1rem;
  background: var(--gold);
  border: 3px solid var(--shadow);
}

.skip-link:focus {
  top: 1rem;
}

.boot-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  color: #f8f8f8;
  background: var(--shadow);
  border-bottom: 2px solid var(--shadow);
  font: 700 0.78rem "Courier New", monospace;
}

.boot-bar span {
  padding: 0.6rem 0.8rem;
  background: #315c76;
  text-align: center;
}

.boot-bar .preview-indicator {
  color: var(--ink);
  background: var(--gold);
}

.site-header,
.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 8px;
}

.brand,
.site-header nav,
.site-footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-size: 1.4rem;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
}

.brand img {
  width: 44px;
  height: 44px;
  border: 3px solid var(--shadow);
}

.site-header nav {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-header nav a,
.site-footer a {
  padding: 0.55rem 0.7rem;
  border: 3px solid transparent;
  font-weight: 800;
  text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  background: #d9ebdf;
  border-color: var(--line);
}

.site-footer {
  flex-wrap: wrap;
  justify-content: center;
  padding: 28px 0 44px;
  color: var(--muted);
  font-weight: 800;
}

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

.hero,
.detail-layout,
.writer-app,
.admin-guard,
.not-found,
.page-title,
.filter-panel,
.product-card,
.detail-grid article,
.admin-card,
.modal,
.document-sidebar,
.editor-panel {
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 5px 5px 0 var(--soft-shadow);
}

.hero,
.modal,
.editor-panel {
  box-shadow: 7px 7px 0 var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 26px;
  align-items: center;
  min-height: 420px;
  padding: 30px;
}

.hero h1,
.page-title h1,
.detail-copy h1,
.not-found h1,
.admin-guard h1 {
  margin: 0 0 0.8rem;
  font-size: clamp(2.6rem, 8vw, 6.2rem);
  line-height: 0.94;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 var(--gold);
}

.detail-copy h1,
.not-found h1,
.admin-guard h1,
.page-title h1 {
  font-size: clamp(2.1rem, 6vw, 4.2rem);
}

.lede {
  max-width: 720px;
  color: #2c2a25;
  font-size: 1.15rem;
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 0.75rem;
  font: 700 0.85rem "Courier New", monospace;
  text-transform: uppercase;
}

.hero-screen,
.product-art {
  display: grid;
  gap: 12px;
  min-height: 240px;
  padding: 18px;
  background: var(--cyan);
  border: 3px solid var(--line);
  box-shadow: inset -8px -8px 0 rgba(0, 0, 0, 0.16);
}

.hero-screen span,
.product-art span {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  background: var(--panel);
  border: 2px solid var(--line);
  font: 900 1rem "Courier New", monospace;
}

.hero-screen strong {
  align-self: end;
  font: 900 3rem "Courier New", monospace;
}

.hero-actions,
.card-actions,
.detail-actions,
.writer-actions,
.editor-footer,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button,
.format-toolbar button,
.icon-button,
.document-list button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--ink);
  background: var(--mint);
  border: 2px solid var(--line);
  border-radius: 0;
  box-shadow: 3px 3px 0 var(--shadow);
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
}

.principles-strip,
.dispatch-box,
.plain-section,
.utility-app {
  margin-top: 24px;
  padding: 22px;
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 5px 5px 0 var(--soft-shadow);
}

.principles-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  font: 900 0.9rem "Courier New", monospace;
  text-transform: uppercase;
}

.principles-strip span {
  padding: 12px;
  background: var(--white);
  border: 2px solid var(--line);
}

.plain-section h2,
.dispatch-box h2,
.utility-intro h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 5vw, 3.7rem);
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 var(--gold);
}

.plain-section p,
.dispatch-box p,
.utility-intro p {
  max-width: 760px;
  line-height: 1.6;
}

.dispatch-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.button.primary {
  background: var(--gold);
  border-width: 3px;
  box-shadow: 4px 4px 0 var(--shadow);
}

.button.focus-exit {
  display: none;
}

body.distraction-free .button.focus-exit {
  display: inline-flex;
}

.button.ghost,
.format-toolbar button,
.icon-button {
  background: var(--white);
}

.button.danger {
  color: var(--danger);
}

.button:active,
.format-toolbar button:active,
.icon-button:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--shadow);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 34px 0 16px;
}

.section-heading h2,
.detail-grid h2,
.admin-card h2 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.7rem);
  text-transform: uppercase;
}

.section-heading p {
  max-width: 450px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.product-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 14px;
  min-height: 330px;
  padding: 18px;
  background: var(--white);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.product-card:hover {
  transform: translate(-1px, -1px);
  box-shadow: 6px 6px 0 var(--soft-shadow);
}

.card-topline,
.product-meta div,
.admin-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.product-icon {
  width: 54px;
  height: 54px;
  color: var(--ink);
  border: 2px solid var(--line);
  box-shadow: inset -5px -5px 0 rgba(0, 0, 0, 0.18);
}

.product-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.stage {
  padding: 6px 8px;
  background: var(--gold);
  border: 2px solid var(--line);
  font: 800 0.78rem "Courier New", monospace;
  text-transform: uppercase;
}

.stage-beta .stage {
  background: var(--cyan);
}

.stage-coming-soon .stage {
  background: var(--mint);
}

.stage-retired {
  opacity: 0.82;
}

.product-card h3 {
  margin: 0;
  font-size: 1.45rem;
}

.card-title-link {
  text-decoration: none;
}

.card-title-link:hover {
  text-decoration: underline;
}

.product-card p,
.detail-grid p,
.detail-grid li,
.admin-card p,
.page-title p,
.not-found p,
.admin-guard p {
  line-height: 1.5;
}

.product-meta {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-top: 12px;
  border-top: 3px dotted rgba(23, 23, 23, 0.28);
}

.product-meta dt {
  color: var(--muted);
  font-weight: 900;
}

.product-meta dd {
  margin: 0;
  font-weight: 800;
}

.category-grid,
.detail-grid,
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.category-tile {
  padding: 18px;
  color: var(--ink);
  background: var(--white);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--soft-shadow);
  text-decoration: none;
}

.category-tile strong,
.category-tile span {
  display: block;
}

.category-tile strong {
  font-size: 1.4rem;
}

.category-tile span {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}

.page-title,
.admin-guard,
.not-found {
  padding: 28px;
}

.page-title.narrow {
  max-width: 860px;
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(150px, 190px)) auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
  margin: 24px 0 4px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 0;
}

textarea {
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 26px;
  align-items: center;
  padding: 28px;
}

.detail-grid {
  margin-top: 24px;
}

.detail-grid article,
.admin-card {
  padding: 18px;
  background: var(--white);
}

.detail-grid ul {
  padding-left: 1.2rem;
}

.detail-grid h3 {
  margin: 1rem 0 0.25rem;
  font-size: 1.05rem;
}

.product-tagline {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 900;
}

.empty-state,
.form-error {
  padding: 18px;
  background: var(--white);
  border: 3px solid var(--line);
  font-weight: 900;
  text-align: center;
}

.form-error:empty {
  display: none;
}

.form-success {
  padding: 12px;
  color: #214b33;
  background: #e4f2e8;
  border: 2px solid #5d876a;
  font-weight: 900;
}

.form-success:empty {
  display: none;
}

.bot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.modal {
  width: min(520px, calc(100% - 28px));
  padding: 20px;
}

.modal::backdrop {
  background: rgba(23, 23, 23, 0.44);
}

.modal form {
  display: grid;
  gap: 14px;
}

.modal menu {
  display: flex;
  justify-content: end;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.writer-app {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: calc(100vh - 190px);
  background: transparent;
  border: 0;
  box-shadow: none;
  gap: 18px;
}

.document-sidebar,
.editor-panel {
  min-width: 0;
  padding: 16px;
}

.sidebar-header,
.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-header h1 {
  margin: 0;
  font-size: 1.8rem;
  text-transform: uppercase;
}

.storage-notice {
  padding: 10px;
  background: #fff5e6;
  border: 2px solid var(--line);
  font-weight: 900;
}

.document-list {
  display: grid;
  gap: 8px;
}

.document-list button {
  display: grid;
  justify-content: stretch;
  min-height: 58px;
  text-align: left;
  background: var(--white);
}

.document-list button[aria-current="true"] {
  background: var(--gold);
}

.document-list span {
  color: var(--muted);
  font-size: 0.85rem;
}

.document-title-input {
  min-height: 54px;
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 900;
}

.editor-panel {
  display: grid;
  grid-template-rows: auto auto minmax(360px, 1fr) auto;
  gap: 12px;
}

.format-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.format-toolbar button {
  min-width: 42px;
  padding: 0 10px;
}

.writer-editor {
  min-height: 360px;
  padding: 24px;
  overflow-wrap: anywhere;
  background: #fff;
  border: 2px solid var(--line);
  line-height: 1.6;
}

.writer-editor:empty::before {
  content: "Start typing...";
  color: var(--muted);
}

.editor-footer {
  align-items: center;
}

.editor-footer span {
  color: var(--muted);
  font-weight: 900;
}

.file-action {
  position: relative;
  overflow: hidden;
}

.file-action input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.utility-app {
  display: grid;
  gap: 18px;
}

.utility-textarea {
  min-height: 280px;
  line-height: 1.55;
}

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

.metric-grid div {
  padding: 14px;
  background: var(--white);
  border: 2px solid var(--line);
}

.metric-grid strong,
.metric-grid span {
  display: block;
}

.metric-grid strong {
  font-size: 2rem;
}

.metric-grid span {
  color: var(--muted);
  font-weight: 900;
}

.split-tool {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr);
  align-items: start;
}

.split-tool .utility-intro {
  grid-column: 1 / -1;
}

.tool-form,
.preview-panel {
  min-width: 0;
  padding: 18px;
  background: var(--white);
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 var(--soft-shadow);
}

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

.tool-form label,
.tool-form fieldset {
  min-width: 0;
}

.tool-form textarea {
  min-height: 88px;
}

.wide-field {
  grid-column: 1 / -1;
}

.line-items {
  display: grid;
  gap: 10px;
}

.line-item {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(80px, 0.3fr) minmax(100px, 0.4fr) auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  background: var(--paper);
  border: 2px dotted rgba(23, 23, 23, 0.35);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.checkbox-grid label,
.launch-task {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
}

.checkbox-grid input,
.launch-task input {
  width: auto;
  min-height: 0;
  margin-top: 3px;
}

.preview-panel {
  position: sticky;
  top: 18px;
  overflow: hidden;
}

.preview-panel h2 {
  margin-top: 0;
}

.invoice-heading,
.summary-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.invoice-heading p {
  white-space: pre-line;
}

.table-scroll {
  overflow-x: auto;
}

.tool-table {
  width: 100%;
  border-collapse: collapse;
}

.tool-table th,
.tool-table td {
  padding: 8px;
  border-bottom: 1px solid rgba(23, 23, 23, 0.25);
  text-align: left;
}

.tool-table th:not(:first-child),
.tool-table td:not(:first-child) {
  text-align: right;
}

.summary-list {
  display: grid;
  gap: 6px;
  margin-left: auto;
  max-width: 280px;
}

.summary-list dt,
.summary-list dd {
  margin: 0;
}

.invoice-total {
  padding-top: 8px;
  border-top: 3px double var(--line);
  font-size: 1.15rem;
  font-weight: 900;
}

.launch-phase + .launch-phase {
  margin-top: 18px;
}

.launch-task {
  padding: 8px 0;
  border-bottom: 1px dotted rgba(23, 23, 23, 0.3);
}

.launch-task:has(input:checked) span {
  color: var(--muted);
  text-decoration: line-through;
}

.principles-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.principles-list article {
  padding: 18px;
  background: var(--white);
  border: 2px solid var(--line);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media print {
  .boot-bar,
  .site-header,
  .site-footer,
  .document-sidebar,
  .editor-topbar,
  .format-toolbar,
  .editor-footer {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .shell,
  .writer-app,
  .editor-panel {
    width: auto;
    display: block;
    padding: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
  }

  .writer-editor {
    border: 0;
    padding: 0;
  }

  .split-tool .utility-intro,
  .split-tool .tool-form,
  .split-tool ~ * {
    display: none !important;
  }

  .split-tool,
  .preview-panel {
    display: block;
    position: static;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
}

@media (max-width: 940px) {
  .hero,
  .detail-layout,
  .filter-panel,
  .writer-app,
  .split-tool {
    grid-template-columns: 1fr;
  }

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

  .principles-strip,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preview-panel {
    position: static;
  }

  .detail-layout {
    align-items: stretch;
  }

  .product-art {
    min-height: 180px;
  }
}

@media (max-width: 640px) {
  .boot-bar,
  .product-grid,
  .category-grid,
  .detail-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .site-header,
  .section-heading,
  .sidebar-header,
  .editor-topbar {
    display: grid;
  }

  .site-header nav {
    justify-content: start;
  }

  .section-heading p {
    text-align: left;
  }

  .shell,
  .site-header,
  .site-footer {
    width: min(100% - 20px, 1180px);
  }

  .hero,
  .page-title,
  .admin-guard,
  .not-found,
  .detail-layout {
    padding: 18px;
    box-shadow: 5px 5px 0 var(--shadow);
  }

  .hero-screen strong {
    font-size: 2.2rem;
  }

  .modal menu,
  .hero-actions,
  .card-actions,
  .detail-actions,
  .writer-actions,
  .editor-footer,
  .dispatch-box,
  .principles-list {
    display: grid;
  }

  .principles-strip,
  .metric-grid {
    grid-template-columns: 1fr;
  }


  .tool-form,
  .line-item,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}
