/*
  Ziduri Site Stylesheet
  Reset, typography, layout primitives and reusable components.
  Built on the tokens defined in tokens.css — a bold "clay" system of
  thick ink borders and hard offset shadows (no blur) that compress on
  hover/press, large radii, and a playful display face for headings.
*/

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100svh;
  font-family: var(--z-font-sans);
  font-size: var(--z-fs-md);
  line-height: var(--z-lh-normal);
  color: var(--z-text-primary);
  background: var(--z-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

button {
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: var(--z-text-link);
  text-decoration-thickness: from-font;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4 {
  font-family: var(--z-font-display);
  line-height: var(--z-lh-tight);
  font-weight: 600;
}

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

/* ---------- Focus ---------- */
:focus-visible {
  outline: 3px solid var(--z-focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: var(--z-space-3);
  top: -48px;
  background: var(--z-brand-700);
  color: #fff;
  padding: var(--z-space-2) var(--z-space-4);
  border-radius: var(--z-radius-sm);
  z-index: 100;
  transition: top var(--z-duration-base) var(--z-ease);
}

.skip-link:focus {
  top: var(--z-space-3);
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--z-container);
  margin-inline: auto;
  padding-inline: var(--z-gutter);
}

.container--narrow {
  max-width: var(--z-container-narrow);
}

.section {
  padding-block: calc(var(--z-space-9) * 0.667);
}

.section--tight {
  padding-block: calc(var(--z-space-7) * 0.667);
}

.section-head {
  max-width: 640px;
  margin-bottom: var(--z-space-7);
}

.section-head--center {
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: var(--z-fs-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--z-brand-700);
  margin-bottom: var(--z-space-3);
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: var(--z-radius-full);
  background: var(--z-brand-500);
  flex-shrink: 0;
}

.section-title {
  font-size: var(--z-fs-2xl);
  margin-bottom: var(--z-space-3);
}

.section-lede {
  color: var(--z-text-secondary);
  font-size: var(--z-fs-md);
}

.text-secondary {
  color: var(--z-text-secondary);
}

.text-tertiary {
  color: var(--z-text-tertiary);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--z-bg-raised);
  border-bottom: var(--z-border-w) solid var(--z-ink);
  box-shadow: 0 4px 0 0 var(--z-ink);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--z-space-5);
  padding-block: var(--z-space-3);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--z-space-2);
  font-family: var(--z-font-display);
  font-weight: 600;
  font-size: var(--z-fs-lg);
  color: var(--z-text-primary);
  text-decoration: none;
}

.brand__mark {
  width: 32px;
  height: 32px;
  border-radius: var(--z-radius-sm);
  border: var(--z-border-w-thin) solid var(--z-ink);
}

.nav-primary {
  display: flex;
  align-items: center;
  gap: var(--z-space-6);
}

.nav-primary__links {
  display: flex;
  align-items: center;
  gap: var(--z-space-2);
}

.nav-primary__links a {
  color: var(--z-text-secondary);
  text-decoration: none;
  font-size: var(--z-fs-sm);
  font-weight: 700;
  padding: var(--z-space-2) var(--z-space-3);
  border-radius: var(--z-radius-full);
  border: var(--z-border-w-thin) solid transparent;
  transition: color var(--z-duration-fast) var(--z-ease), border-color var(--z-duration-fast) var(--z-ease), background var(--z-duration-fast) var(--z-ease);
}

.nav-primary__links a:hover {
  color: var(--z-text-primary);
  background: var(--z-bg-subtle);
}

.nav-primary__links a[aria-current="page"] {
  color: var(--z-text-primary);
  border-color: var(--z-ink);
  background: var(--z-accent-mint);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--z-space-3);
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: var(--z-radius-sm);
  border: var(--z-border-w-thin) solid var(--z-ink);
  align-items: center;
  justify-content: center;
  color: var(--z-text-primary);
  background: var(--z-bg-raised);
}

.nav-toggle:hover {
  background: var(--z-bg-subtle);
}

/* Theme toggle */
.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: var(--z-radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--z-text-secondary);
  border: var(--z-border-w-thin) solid var(--z-ink);
  background: var(--z-bg-raised);
  transition: background var(--z-duration-fast) var(--z-ease), color var(--z-duration-fast) var(--z-ease), transform var(--z-duration-fast) var(--z-ease);
}

.theme-toggle:hover {
  background: var(--z-accent-lavender);
  color: var(--z-text-primary);
  transform: translate(1px, 1px);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
}
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--z-space-2);
  padding: 0.85rem 1.5rem;
  border-radius: var(--z-radius-md);
  font-weight: 700;
  font-size: var(--z-fs-sm);
  text-decoration: none;
  border: var(--z-border-w) solid var(--z-ink);
  box-shadow: var(--z-hard-md);
  transition: transform var(--z-duration-fast) var(--z-ease), box-shadow var(--z-duration-fast) var(--z-ease), background var(--z-duration-fast) var(--z-ease);
}

.btn:hover {
  box-shadow: var(--z-hard-md-press);
  transform: translate(2px, 2px);
}

.btn:active {
  box-shadow: var(--z-hard-sm-press);
  transform: translate(3px, 3px);
}

.btn-primary {
  background: var(--z-brand-500);
  color: var(--z-text-on-brand);
}

.btn-secondary {
  background: var(--z-bg-raised);
  color: var(--z-text-primary);
}

.btn-ghost {
  color: var(--z-text-secondary);
  border-color: transparent;
  box-shadow: none;
}

.btn-ghost:hover {
  color: var(--z-text-primary);
  background: var(--z-bg-subtle);
  box-shadow: none;
  transform: none;
}

.btn--sm {
  padding: 0.5rem 1rem;
  font-size: var(--z-fs-xs);
  border-width: var(--z-border-w-thin);
  box-shadow: 2px 2px 0 0 var(--z-ink);
}

.btn--sm:hover {
  box-shadow: 1px 1px 0 0 var(--z-ink);
  transform: translate(1px, 1px);
}

.btn--block {
  width: 100%;
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--z-space-1);
  padding: 0.25rem 0.75rem;
  border-radius: var(--z-radius-full);
  border: var(--z-border-w-thin) solid currentColor;
  font-size: var(--z-fs-xs);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.badge--info { background: var(--z-info-bg); color: var(--z-info); }
.badge--success { background: var(--z-success-bg); color: var(--z-success); }
.badge--warning { background: var(--z-warning-bg); color: var(--z-warning); }
.badge--neutral { background: var(--z-bg-inset); color: var(--z-text-secondary); }

/* ---------- Card ---------- */
.card {
  background: var(--z-bg-raised);
  border: var(--z-border-w) solid var(--z-ink);
  border-radius: var(--z-radius-lg);
  box-shadow: var(--z-hard-lg), var(--z-clay-inset);
  transition: box-shadow var(--z-duration-base) var(--z-ease), transform var(--z-duration-base) var(--z-ease);
}

/* ---------- Product card ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--z-space-6);
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: var(--z-space-4);
  padding: var(--z-space-6);
  text-decoration: none;
  color: inherit;
}

.product-card:hover {
  box-shadow: var(--z-hard-lg-press), var(--z-clay-inset);
  transform: translate(2px, 2px);
}

.product-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--z-space-3);
}

.product-card__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--z-radius-md);
  object-fit: cover;
  background: var(--z-bg-subtle);
  border: var(--z-border-w-thin) solid var(--z-ink);
}

.product-card__name {
  font-family: var(--z-font-display);
  font-weight: 600;
  font-size: var(--z-fs-lg);
  margin-bottom: var(--z-space-1);
}

.product-card__desc {
  color: var(--z-text-secondary);
  font-size: var(--z-fs-sm);
}

.product-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--z-space-2);
  margin-top: auto;
}

/* Coming-soon category card */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--z-space-4);
}

.category-card {
  padding: var(--z-space-5);
  display: flex;
  flex-direction: column;
  gap: var(--z-space-2);
}

.category-card__title {
  font-family: var(--z-font-display);
  font-size: var(--z-fs-md);
  font-weight: 600;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-block: calc(var(--z-space-9) * 0.667) calc(var(--z-space-8) * 0.667);
}

.hero__content {
  max-width: 780px;
}

.hero__title {
  font-size: var(--z-fs-4xl);
  margin-bottom: var(--z-space-5);
}

.hero__lede {
  font-size: var(--z-fs-lg);
  color: var(--z-text-secondary);
  max-width: 640px;
  margin-bottom: var(--z-space-6);
  line-height: var(--z-lh-snug);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--z-space-3);
}

/* ---------- Feature grid ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--z-space-5);
}

.feature-item {
  padding: var(--z-space-5);
  border-radius: var(--z-radius-md);
  background: var(--z-bg-raised);
  border: var(--z-border-w) solid var(--z-ink);
  box-shadow: var(--z-hard-sm);
}

.feature-item__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--z-radius-sm);
  background: var(--z-accent-lavender);
  border: var(--z-border-w-thin) solid var(--z-ink);
  color: var(--z-accent-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--z-space-3);
}

.feature-grid .feature-item:nth-of-type(4n+2) .feature-item__icon { background: var(--z-accent-mint); }
.feature-grid .feature-item:nth-of-type(4n+3) .feature-item__icon { background: var(--z-accent-coral); }
.feature-grid .feature-item:nth-of-type(4n+4) .feature-item__icon { background: var(--z-accent-sky); }

.feature-item__title {
  font-family: var(--z-font-display);
  font-weight: 600;
  font-size: var(--z-fs-md);
  margin-bottom: var(--z-space-2);
}

.feature-item__desc {
  color: var(--z-text-secondary);
  font-size: var(--z-fs-sm);
}

/* ---------- Numbered steps ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--z-space-5);
  counter-reset: step;
}

.step {
  position: relative;
  padding-left: var(--z-space-6);
}

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: var(--z-radius-full);
  background: var(--z-accent-mint);
  border: var(--z-border-w-thin) solid var(--z-ink);
  color: var(--z-accent-fg);
  font-size: var(--z-fs-xs);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step__title {
  font-family: var(--z-font-display);
  font-weight: 600;
  font-size: var(--z-fs-md);
  margin-bottom: var(--z-space-1);
}

.step__desc {
  color: var(--z-text-secondary);
  font-size: var(--z-fs-sm);
}

/* ---------- FAQ ---------- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--z-space-3);
}

.faq-item {
  border: var(--z-border-w) solid var(--z-ink);
  border-radius: var(--z-radius-md);
  background: var(--z-bg-raised);
  box-shadow: var(--z-hard-sm);
  overflow: hidden;
}

.faq-item > summary {
  list-style: none;
  cursor: pointer;
  padding: var(--z-space-4) var(--z-space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--z-space-3);
  font-family: var(--z-font-display);
  font-weight: 600;
}

.faq-item > summary::-webkit-details-marker {
  display: none;
}

.faq-item__chevron {
  flex-shrink: 0;
  transition: transform var(--z-duration-base) var(--z-ease);
}

.faq-item[open] .faq-item__chevron {
  transform: rotate(180deg);
}

.faq-item__body {
  padding: 0 var(--z-space-5) var(--z-space-5);
  color: var(--z-text-secondary);
  font-size: var(--z-fs-sm);
}

/* ---------- Callout ---------- */
.callout {
  display: flex;
  gap: var(--z-space-3);
  padding: var(--z-space-4) var(--z-space-5);
  border-radius: var(--z-radius-md);
  border: var(--z-border-w-thin) solid var(--z-ink);
  background: var(--z-bg-subtle);
  font-size: var(--z-fs-sm);
  font-weight: 600;
}

.callout--info { background: var(--z-info-bg); }
.callout--warning { background: var(--z-warning-bg); }
.callout--success { background: var(--z-success-bg); }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--z-space-2);
  font-size: var(--z-fs-xs);
  font-weight: 700;
  color: var(--z-text-tertiary);
  padding-block: var(--z-space-5) var(--z-space-3);
}

.breadcrumb a {
  color: var(--z-text-tertiary);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--z-text-primary);
}

.breadcrumb__sep {
  opacity: 0.6;
}

/* ---------- Permission table ---------- */
.perm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--z-fs-sm);
}

.perm-table th,
.perm-table td {
  text-align: left;
  padding: var(--z-space-3) var(--z-space-4);
  border-bottom: var(--z-border-w-thin) solid var(--z-border);
  vertical-align: top;
}

.perm-table th {
  color: var(--z-text-tertiary);
  font-size: var(--z-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 800;
}

.perm-table code {
  font-family: var(--z-font-mono);
  font-size: 0.85em;
  background: var(--z-bg-inset);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

/* Wide tables scroll instead of overflowing the page */
.table-scroll {
  overflow-x: auto;
  border: var(--z-border-w) solid var(--z-ink);
  border-radius: var(--z-radius-md);
  box-shadow: var(--z-hard-sm);
}

.table-scroll .perm-table th:first-child,
.table-scroll .perm-table td:first-child {
  padding-left: var(--z-space-5);
}

/* ---------- Concept illustration ---------- */
.illustration {
  border-radius: var(--z-radius-lg);
  border: var(--z-border-w) solid var(--z-ink);
  background: var(--z-bg-subtle);
  box-shadow: var(--z-hard-lg), var(--z-clay-inset);
  padding: var(--z-space-6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.illustration img,
.illustration svg {
  max-width: 100%;
  height: auto;
}

/* ---------- Article / blog ---------- */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--z-space-5);
}

.article-card {
  padding: var(--z-space-5);
  display: flex;
  flex-direction: column;
  gap: var(--z-space-2);
  text-decoration: none;
  color: inherit;
}

.article-card:hover {
  box-shadow: var(--z-hard-lg-press), var(--z-clay-inset);
  transform: translate(2px, 2px);
}

.article-card__meta {
  font-size: var(--z-fs-xs);
  color: var(--z-text-tertiary);
}

.article-card__title {
  font-family: var(--z-font-display);
  font-weight: 600;
  font-size: var(--z-fs-lg);
}

.prose {
  max-width: 720px;
  font-size: var(--z-fs-md);
  line-height: var(--z-lh-normal);
}

.prose h2 {
  font-size: var(--z-fs-xl);
  margin-top: var(--z-space-7);
  margin-bottom: var(--z-space-3);
}

.prose h3 {
  font-size: var(--z-fs-lg);
  margin-top: var(--z-space-6);
  margin-bottom: var(--z-space-2);
}

.prose p,
.prose ul,
.prose ol {
  margin-bottom: var(--z-space-4);
  color: var(--z-text-secondary);
}

.prose li {
  margin-bottom: var(--z-space-2);
  color: var(--z-text-secondary);
  list-style: disc;
  margin-left: var(--z-space-5);
}

.prose ol li {
  list-style: decimal;
}

.prose a {
  color: var(--z-text-link);
}

.prose strong {
  color: var(--z-text-primary);
}

/* ---------- Form (contact) ---------- */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--z-space-2);
  margin-bottom: var(--z-space-4);
}

.form-field label {
  font-size: var(--z-fs-sm);
  font-weight: 700;
}

.form-field input,
.form-field textarea {
  padding: var(--z-space-3);
  border-radius: var(--z-radius-sm);
  border: var(--z-border-w-thin) solid var(--z-ink);
  background: var(--z-bg-raised);
  color: var(--z-text-primary);
}

.form-field input:focus,
.form-field textarea:focus {
  outline: 3px solid var(--z-focus-ring);
  outline-offset: 1px;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: var(--z-border-w) solid var(--z-ink);
  padding-block: calc(var(--z-space-8) * 0.667) calc(var(--z-space-6) * 0.667);
  margin-top: calc(var(--z-space-9) * 0.667);
  background: var(--z-bg-subtle);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--z-space-6);
  margin-bottom: var(--z-space-7);
}

.footer-brand__desc {
  color: var(--z-text-secondary);
  font-size: var(--z-fs-sm);
  margin-top: var(--z-space-3);
  max-width: 280px;
}

.footer-col__title {
  font-size: var(--z-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: var(--z-text-tertiary);
  margin-bottom: var(--z-space-3);
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: var(--z-space-2);
}

.footer-col a {
  color: var(--z-text-secondary);
  text-decoration: none;
  font-size: var(--z-fs-sm);
  font-weight: 600;
}

.footer-col a:hover {
  color: var(--z-text-primary);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--z-space-3);
  padding-top: var(--z-space-5);
  border-top: var(--z-border-w-thin) solid var(--z-border-strong);
  font-size: var(--z-fs-xs);
  font-weight: 600;
  color: var(--z-text-tertiary);
}

/* ---------- 404 ---------- */
.error-page {
  padding-block: calc(var(--z-space-10) * 0.667);
  text-align: center;
}

.error-page__code {
  font-family: var(--z-font-display);
  font-size: var(--z-fs-4xl);
  -webkit-text-stroke: 2px var(--z-ink);
  color: var(--z-accent-mint);
  margin-bottom: var(--z-space-3);
}

.error-page__actions {
  display: flex;
  gap: var(--z-space-3);
  justify-content: center;
  margin-top: var(--z-space-6);
  flex-wrap: wrap;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .nav-primary__links {
    position: fixed;
    inset: 68px var(--z-space-4) auto var(--z-space-4);
    flex-direction: column;
    align-items: stretch;
    background: var(--z-bg-raised);
    border: var(--z-border-w) solid var(--z-ink);
    border-radius: var(--z-radius-md);
    box-shadow: var(--z-hard-lg);
    padding: var(--z-space-4);
    gap: var(--z-space-1);
    display: none;
  }

  .nav-primary__links a {
    padding: var(--z-space-3) var(--z-space-3);
    border-radius: var(--z-radius-sm);
  }

  .nav-primary[data-open="true"] .nav-primary__links {
    display: flex;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .hero__title {
    font-size: var(--z-fs-3xl);
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .hero__title {
    font-size: var(--z-fs-2xl);
  }

  .section-title {
    font-size: var(--z-fs-xl);
  }
}
