/* Shelf Edge Writing Workbench - Styles */
:root {
  --color-bg: #FDF8F0;
  --color-surface: #FFFDF9;
  --color-surface-alt: #F5EDE0;
  --color-text: #2C2418;
  --color-text-muted: #6B5D4F;
  --color-text-light: #9A8B7A;
  --color-accent: #8B6914;
  --color-accent-hover: #6D5210;
  --color-accent-light: #F5E6C8;
  --color-border: #D4C5AD;
  --color-border-light: #E8DCC8;
  --color-success: #3A7D44;
  --color-error: #B33A3A;
  --color-strip-bg: #FFF9EE;
  --color-strip-border: #C4A96A;
  --color-strip-text: #2C2418;
  --font-body: Georgia, 'Times New Roman', serif;
  --font-mono: 'Courier New', Courier, monospace;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(44,36,24,0.08);
  --shadow-md: 0 4px 12px rgba(44,36,24,0.1);
  --shadow-lg: 0 8px 24px rgba(44,36,24,0.12);
  --max-width: 1120px;
  --header-height: 60px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--color-accent);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  z-index: 1000;
  font-family: var(--font-ui);
  font-size: 14px;
  text-decoration: none;
}

.skip-link:focus {
  top: 8px;
}

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--color-accent-hover);
}

img, svg {
  display: block;
  max-width: 100%;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-text);
}

.logo:hover {
  color: var(--color-text);
}

.logo-icon {
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.logo-text strong {
  font-weight: 700;
}

.site-nav {
  display: flex;
  gap: 20px;
  font-family: var(--font-ui);
  font-size: 14px;
}

.site-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.site-nav a:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent-light);
}

/* Hero */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 60px 20px 48px;
}

.hero-content {
  max-width: 640px;
}

.hero h1 {
  font-family: var(--font-ui);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.hero-sub {
  font-size: 18px;
  color: var(--color-text-muted);
  margin-bottom: 28px;
  max-width: 520px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.3;
}

.btn-primary {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: white;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-accent);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
  padding-left: 12px;
  padding-right: 12px;
}

.btn-ghost:hover {
  color: var(--color-text);
  background: var(--color-surface-alt);
}

.btn-small {
  font-size: 13px;
  padding: 6px 14px;
}

/* Section headings */
.section-heading {
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-intro {
  color: var(--color-text-muted);
  margin-bottom: 24px;
  max-width: 560px;
}

/* Workbench */
.workbench {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px 60px;
}

.workbench-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

/* Preview panel */
.preview-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: calc(var(--header-height) + 20px);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.preview-header h3 {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.preview-meta {
  display: flex;
  gap: 12px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--color-text-light);
}

.strip-preview {
  background: var(--color-strip-bg);
  border: 2px solid var(--color-strip-border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.strip-inner {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-strip-text);
  white-space: pre-wrap;
  word-break: break-word;
  width: 100%;
  text-align: left;
}

.strip-inner.uppercase {
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.04em;
}

.strip-inner.centered {
  text-align: center;
}

.strip-line:empty::before {
  content: '\00a0';
}

.preview-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* Controls panel */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-row {
  display: flex;
  gap: 16px;
}

.control-group-half {
  flex: 1;
}

.control-label {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.control-input,
.control-select {
  font-family: var(--font-ui);
  font-size: 15px;
  padding: 10px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.control-input:focus,
.control-select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

.control-input::placeholder {
  color: var(--color-text-light);
}

.field-hint {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--color-text-light);
}

/* Toggles */
.control-toggles {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 14px;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  width: 40px;
  height: 22px;
  background: var(--color-border);
  border-radius: 11px;
  position: relative;
  transition: background 0.15s;
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .toggle-track {
  background: var(--color-accent);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.toggle input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

.control-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-top: 4px;
}

/* Presets section */
.presets-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px 60px;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.preset-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm);
}

.preset-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.preset-label {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.preset-preview {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-muted);
  white-space: pre-line;
}

.saved-presets {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border-light);
}

.saved-presets h3 {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Guide section */
.guide-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px 80px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.guide-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 24px;
}

.guide-block h3 {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--color-text);
}

.guide-block p {
  font-size: 15px;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.guide-block p:last-child {
  margin-bottom: 0;
}

.guide-block ul {
  padding-left: 20px;
  font-size: 15px;
  color: var(--color-text-muted);
}

.guide-block li {
  margin-bottom: 6px;
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--color-surface-alt);
  border-top: 1px solid var(--color-border-light);
  padding: 32px 20px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-brand .logo-text {
  font-size: 14px;
}

.footer-tagline {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--color-text-light);
}

.footer-nav {
  display: flex;
  gap: 20px;
  font-family: var(--font-ui);
  font-size: 13px;
}

.footer-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.footer-note {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--color-text-light);
  width: 100%;
  text-align: center;
  padding-top: 8px;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-text);
  color: white;
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Print styles */
@media print {
  body {
    background: white;
  }
  .site-header,
  .site-footer,
  .hero,
  .presets-section,
  .guide-section,
  .controls-panel,
  .preview-actions,
  .preview-header,
  .toast {
    display: none !important;
  }
  .workbench {
    padding: 0;
  }
  .workbench-layout {
    display: block;
  }
  .preview-panel {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0;
  }
  .strip-preview {
    border: 2px solid #333;
    background: white;
  }
  .strip-inner {
    font-size: 16px;
  }
}

/* Responsive */
@media (max-width: 860px) {
  .workbench-layout {
    grid-template-columns: 1fr;
  }
  .preview-panel {
    position: static;
  }
  .control-row {
    flex-direction: column;
    gap: 20px;
  }
}

@media (max-width: 600px) {
  .header-inner {
    padding: 0 16px;
  }
  .site-nav {
    gap: 12px;
  }
  .site-nav a {
    font-size: 13px;
  }
  .hero {
    padding: 40px 16px 32px;
  }
  .workbench,
  .presets-section,
  .guide-section {
    padding-left: 16px;
    padding-right: 16px;
  }
  .preset-grid {
    grid-template-columns: 1fr;
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
  .preview-actions {
    flex-direction: column;
  }
  .preview-actions .btn {
    justify-content: center;
  }
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
  .footer-nav {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

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



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
