/*
 * Wicket — a small gate for one person at a time
 *
 * Typography: Martina Plantijn (Typotheque) over Georgia/serif fallback.
 * Color: dark olive accent on warm cream. Not a design system — a tool
 * that looks like someone made it on purpose.
 */

@font-face {
  font-family: 'Martina Plantijn';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/MartinaPlantijn-Regular.otf) format('opentype');
}
@font-face {
  font-family: 'Martina Plantijn';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/static/MartinaPlantijn-Medium.otf) format('opentype');
}
@font-face {
  font-family: 'Martina Plantijn';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/static/MartinaPlantijn-Bold.otf) format('opentype');
}

@font-face {
  font-family: 'Söhne Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/SoehneMono-Buch.otf') format('opentype');
}
@font-face {
  font-family: 'Söhne Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/SoehneMono-Halbfett.otf') format('opentype');
}

/* --- Reset & base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  font-family: 'Martina Plantijn', Georgia, 'Times New Roman', serif;
  background: #f5f2eb;
  color: #222;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

:root {
  --accent: #4a5d23;
  --accent-hover: #5a7029;
  --accent-active: #3e4f1d;
  --surface: #fff;
  --bg: #f5f2eb;
  --text: #222;
  --text-mid: #555;
  --text-light: #888;
  --border: #ddd8ce;
  --danger: #a33;
  --success: #3a7a3a;
  --code-bg: #edeade;
  --mono: 'Söhne Mono', 'SF Mono', 'Menlo', 'Consolas', monospace;
}

/* --- Centered layouts (podium, login, enroll, etc.) --- */
.centered {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1rem;
}

.card {
  background: var(--surface);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 360px;
}
.card--wide { max-width: 440px; }

/* --- Typography --- */
h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1rem;
}
h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
}
label {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.25rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { background: var(--accent-active); }
.btn:disabled { background: #999; cursor: not-allowed; }
.btn--full { width: 100%; }

.btn--secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--border);
}
.btn--secondary:hover { border-color: var(--accent); }

.btn--small {
  font-size: 0.875rem;
  padding: 0.4rem 0.75rem;
  min-height: 36px;
}

.btn--delete {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  min-height: 36px;
}
.btn--delete:hover { border-color: var(--danger); color: var(--danger); }

/* --- Code input (podium) --- */
.code-input {
  font-family: var(--mono);
  font-size: 2rem;
  text-align: center;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  width: 100%;
  padding: 0.5rem;
  border: 2px solid #ccc;
  border-radius: 4px;
  margin: 1rem 0;
  background: #fff;
  color: var(--text);
}
.code-input:focus {
  border-color: var(--accent);
  outline: none;
}
.code-input::placeholder {
  color: #ccc;
  letter-spacing: 0.2em;
}

/* --- Code display (the important element) --- */
.code-display {
  font-family: var(--mono);
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-align: center;
  padding: 1rem;
  margin: 0.5rem 0;
  background: var(--code-bg);
  border-radius: 4px;
  color: var(--text);
  text-indent: 0.3em;
  user-select: all;
  -webkit-user-select: all;
}
.code-actions {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 0.5rem 0 0.25rem;
}
.copy-link {
  font-size: 0.85rem;
  color: var(--accent);
  cursor: pointer;
}
.copy-link:hover { text-decoration: underline; }

.code-meta {
  text-align: center;
  color: var(--text-mid);
  font-size: 0.85rem;
}

/* --- Management page --- */
.manage {
  max-width: 560px;
  margin: 0 auto;
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}
.manage-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.manage-header h1 { margin-bottom: 0; }
.manage-header a {
  font-size: 0.85rem;
  color: var(--text-mid);
  text-decoration: none;
}
.manage-header a:hover { color: var(--accent); }

.section {
  background: var(--surface);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 0.75rem;
}

.list-header {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  margin: 1rem 0 0.5rem;
}

/* --- File & snippet cards --- */
.item-card {
  background: var(--surface);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 0.5rem;
}
.item-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}
.item-meta {
  color: var(--text-mid);
  font-size: 0.85rem;
  margin-top: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
}
.item-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.item-controls .spacer { margin-left: auto; }

/* --- Form elements --- */
select {
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  min-height: 36px;
}
input[type="file"] {
  font-family: inherit;
  font-size: 0.9rem;
  margin: 0.5rem 0;
}
textarea {
  width: 100%;
  min-height: 4rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.875rem;
  resize: vertical;
  margin: 0.5rem 0;
  color: var(--text);
  line-height: 1.5;
}
textarea:focus, select:focus {
  border-color: var(--accent);
  outline: none;
}
textarea::placeholder { color: #aaa; }

/* --- Snippet view --- */
.snippet-content {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-all;
  font-family: var(--mono);
  font-size: 0.9rem;
  max-height: 60vh;
  overflow-y: auto;
  user-select: all;
  -webkit-user-select: all;
  line-height: 1.6;
  color: var(--text);
}
.hint {
  color: var(--text-light);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

/* --- Exchange page --- */
.divider {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
}
.download-btn {
  display: block;
  text-align: center;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 0.75rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  transition: background 0.15s;
  min-height: 44px;
}
.download-btn:hover { background: var(--accent-hover); }
.filename {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}
.file-size-display {
  color: var(--text-mid);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.timer {
  color: var(--text-mid);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* --- Success --- */
.check-icon { font-size: 3rem; color: var(--success); }

/* --- Status & errors --- */
.error { color: var(--danger); font-size: 0.9rem; margin-top: 1rem; }
.status { color: var(--text-mid); font-size: 0.9rem; margin-top: 1rem; }
.status.success { color: var(--success); }
.status.error { color: var(--danger); }

/* --- About page --- */
.about {
  max-width: 560px;
  margin: 0 auto;
  padding: 2rem 1rem;
}
.about section {
  background: var(--surface);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 0.75rem;
}
.about p {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.about table { width: 100%; font-size: 0.9rem; border-collapse: collapse; }
.about td { padding: 0.35rem 0; }
.about td:first-child { color: var(--text-mid); width: 55%; }
.about td:last-child { font-family: var(--mono); font-size: 0.85rem; }
.about a { color: var(--accent); text-decoration: none; }
.about a:hover { text-decoration: underline; }
.back-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-mid);
  text-decoration: none;
}
.back-link:hover { color: var(--accent); }

/* --- Empty state --- */
.empty {
  color: var(--text-mid);
  text-align: center;
  padding: 2rem;
  font-size: 0.95rem;
}
