/* Clay Corner – mobile first */
:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --text: #2a211c;
  --muted: #5c4f47;
  --line: #d9cbbf;
  --clay: #9a3d1d;
  --clay-dark: #7a2e14;
  --clay-soft: #f6e6dc;
  --ok-bg: #e5f2e7;
  --ok-text: #1e5a2b;
  --warn-bg: #fdf0d5;
  --warn-text: #6b4600;
  --err-bg: #fbe4e2;
  --err-text: #8f1d14;
  --info-bg: #e6eef6;
  --info-text: #1d4369;
  --focus: #1a56b8;
  --radius: 12px;
  --max: 1100px;
  font-size: 100%;
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--clay-dark);
  text-underline-offset: 3px;
}

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -100px;
  background: var(--surface);
  color: var(--text);
  padding: 0.75rem 1rem;
  z-index: 10;
  border-radius: 8px;
}

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

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

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
}

#site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
}

#site-nav a,
.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.75rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  background: none;
  border: 0;
  cursor: pointer;
}

#site-nav a:hover,
.link-button:hover {
  background: var(--clay-soft);
}

#site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
  text-decoration-color: var(--clay);
}

main {
  padding: 1.5rem 0 3rem;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: 1.85rem;
}

h2 {
  font-size: 1.4rem;
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 1rem;
}

.lead {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 60ch;
}

.hero {
  padding: 1rem 0 1.5rem;
}

.steps {
  display: grid;
  gap: 0.75rem;
  padding: 0;
  margin: 0 0 2rem;
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem 0.85rem 3.25rem;
  position: relative;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 0.8rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--clay);
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* Cards */
.class-list {
  display: grid;
  gap: 1rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.card-photo {
  margin: -1rem -1rem 0.5rem;
  border-radius: var(--radius) var(--radius) 0 0;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: calc(100% + 2rem);
  max-width: none;
  background: var(--clay-soft);
}

.card h3 {
  margin: 0;
}

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
}

.facts dt {
  color: var(--muted);
  font-weight: 600;
}

.facts dd {
  margin: 0;
}

.card .actions {
  margin-top: auto;
  padding-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.seats-low {
  color: var(--warn-text);
  font-weight: 700;
}

/* Badges */
.badge {
  display: inline-block;
  white-space: nowrap;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  border: 1px solid currentColor;
}

.badge-paid {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.badge-pending {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.badge-cancelled,
.badge-expired {
  background: #eee9e5;
  color: #4a3f39;
}

.badge-scheduled {
  background: var(--info-bg);
  color: var(--info-text);
}

/* Buttons */
.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 1.1rem;
  border-radius: 10px;
  border: 2px solid var(--clay);
  background: var(--clay);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--clay-dark);
  border-color: var(--clay-dark);
  color: #fff;
}

.button-secondary,
button.button-secondary {
  background: var(--surface);
  color: var(--clay-dark);
}

.button-secondary:hover {
  background: var(--clay-soft);
  color: var(--text);
}

.button[disabled],
.button[aria-disabled="true"] {
  background: #e7e0da;
  border-color: #b9aca2;
  color: #4a3f39;
  cursor: not-allowed;
}

/* Forms */
.form {
  display: grid;
  gap: 1rem;
  max-width: 34rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
}

.narrow {
  max-width: 34rem;
}

.field {
  display: grid;
  gap: 0.3rem;
}

.field label {
  font-weight: 600;
}

.hint {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 2px solid #8a7a6f;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  min-height: 44px;
  width: 100%;
  max-width: 100%;
}

textarea {
  min-height: 6rem;
  resize: vertical;
}

input[type="file"] {
  padding: 0.45rem;
}

input[aria-invalid="true"] {
  border-color: var(--err-text);
}

.row {
  display: grid;
  gap: 1rem;
}

.notice {
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  border: 1px solid currentColor;
}

.notice-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.notice-error {
  background: var(--err-bg);
  color: var(--err-text);
}

.notice-info {
  background: var(--info-bg);
  color: var(--info-text);
}

.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  color: var(--muted);
}

/* Admin */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.tabs button[aria-selected="true"] {
  background: var(--clay);
  color: #fff;
}

.toolbar {
  display: grid;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.data-table caption {
  text-align: left;
  font-weight: 600;
  padding: 0 0 0.5rem;
  color: var(--muted);
}

.data-table th,
.data-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  background: var(--clay-soft);
  white-space: nowrap;
}

.cell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cell-actions .button {
  padding: 0.35rem 0.8rem;
  white-space: nowrap;
}

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

.nowrap {
  white-space: nowrap;
}

.small {
  font-size: 0.9rem;
}

/* Small screens: each table row becomes a card */
@media (max-width: 799px) {
  .data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }
  .data-table {
    background: none;
  }
  .data-table caption {
    display: block;
  }
  .data-table td {
    overflow-wrap: anywhere;
  }
  .data-table tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
  }
  .data-table td {
    border: 0;
    padding: 0.3rem 0.9rem;
  }
  .data-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-weight: 700;
    color: var(--muted);
    font-size: 0.9rem;
  }
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (min-width: 640px) {
  .class-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .panel {
    padding: 1.5rem;
  }
}

@media (min-width: 800px) {
  .toolbar {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
  }
}

@media (min-width: 1000px) {
  h1 {
    font-size: 2.4rem;
  }
  .wrap {
    padding: 0 1.5rem;
  }
  .class-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .row-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

@media (prefers-reduced-motion: no-preference) {
  .button,
  #site-nav a,
  .link-button {
    transition: background-color 0.15s ease, color 0.15s ease;
  }
}

.form-wide {
  max-width: none;
}

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

.actions .booked,
.actions .hint {
  margin: 0;
  flex-basis: 100%;
}

.ref {
  word-break: break-all;
}

.table-scroll {
  margin-bottom: 1.75rem;
}
