/* Miners Yearbook :: clean, compact school media-library styling.
   Neutral placeholder branding that can be themed later.
   Single-column on phones; multi-column grid on larger screens. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --ink: #1f2733;
  --ink-soft: #55606e;
  --line: #d4dae2;
  --brand: #1f4b8e;        /* neutral navy placeholder */
  --brand-ink: #ffffff;
  --accent: #b4802b;       /* muted gold accent placeholder */
  --danger: #a12b2b;
  --ok: #2f7d43;
  --focus: #1f6feb;
  --radius: 6px;
  --gap: 14px;
  --font: -apple-system, system-ui, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
a { color: var(--brand); }

/* ---- Layout ---- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--gap);
  padding: 10px 16px;
  background: var(--brand); color: var(--brand-ink);
  border-bottom: 3px solid var(--accent);
}
.app-header .brand { font-weight: 700; font-size: 1.15rem; letter-spacing: .3px; }
.app-header .brand small { font-weight: 400; opacity: .85; font-size: .8rem; display: block; }
.app-header .spacer { flex: 1; }
.app-header .session-info { font-size: .82rem; text-align: right; opacity: .95; }

.container { max-width: 1200px; margin: 0 auto; padding: 16px; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: end;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; margin-bottom: 16px;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: .78rem; color: var(--ink-soft); font-weight: 600; }
.field.grow { flex: 1 1 220px; }

/* ---- Controls ---- */
input, select, textarea, button {
  font: inherit; color: var(--ink);
}
input[type=text], input[type=search], input[type=email], input[type=password],
input[type=number], select, textarea {
  padding: 8px 10px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); min-height: 40px;
}
textarea { min-height: 70px; resize: vertical; }
label { color: var(--ink); }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 14px; cursor: pointer;
  border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  border-radius: var(--radius); font-weight: 600;
}
button.secondary, .btn.secondary {
  background: var(--surface); color: var(--brand); border-color: var(--line);
}
button.ghost { background: transparent; color: var(--brand-ink); border-color: rgba(255,255,255,.5); }
button.danger { background: var(--danger); border-color: var(--danger); }
button.small { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* Visible focus states everywhere (keyboard navigation). */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---- Gallery grid ---- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--gap);
}
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
}
.card .thumb {
  width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--surface-2);
  display: block; border: 0; cursor: pointer;
}
.card .card-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.card .card-title { font-weight: 600; font-size: .95rem; }
.card .card-meta { font-size: .78rem; color: var(--ink-soft); }
.card .card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.badge {
  display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 6px;
  border-radius: 3px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-soft);
}
.badge.student_visible { background: #e6f2e9; color: var(--ok); border-color: #bcd9c4; }
.badge.staff_only { background: #eef1f5; color: var(--ink-soft); }
.badge.restricted { background: #fdeede; color: var(--accent); border-color: #edcfa0; }
.badge.hidden { background: #f6e1e1; color: var(--danger); border-color: #e2b6b6; }

/* ---- Panels / sections ---- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 16px;
}
.panel h2 { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.list li .grow { flex: 1 1 200px; }
.muted { color: var(--ink-soft); }
.pill-phrase {
  font-size: 1.6rem; font-weight: 800; letter-spacing: 2px; color: var(--brand);
  background: var(--surface-2); border: 2px dashed var(--brand);
  padding: 12px 18px; border-radius: var(--radius); display: inline-block;
}

/* ---- Tabs ---- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tabs button { background: var(--surface); color: var(--brand); border-color: var(--line); }
.tabs button[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); }

/* ---- Modal ---- */
dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0;
  max-width: min(920px, 96vw); width: 100%; color: var(--ink);
}
dialog::backdrop { background: rgba(15, 22, 33, .55); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 16px; display: grid; grid-template-columns: 1fr; gap: 14px; }
.modal-figure img { width: 100%; height: auto; border-radius: var(--radius); background: var(--surface-2); }
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 6px; font-size: .9rem; }
.detail-grid div span { color: var(--ink-soft); }

/* ---- Notices ---- */
.notice { padding: 10px 12px; border-radius: var(--radius); margin: 10px 0; border: 1px solid var(--line); }
.notice.error { background: #fbeaea; border-color: #e2b6b6; color: var(--danger); }
.notice.ok { background: #e9f4ec; border-color: #bcd9c4; color: var(--ok); }
.notice.warn { background: #fdf3e2; border-color: #edcfa0; color: var(--accent); }

.hidden { display: none !important; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px; }

/* ---- Editor ---- */
.editor-wrap { display: grid; grid-template-columns: 1fr; gap: 16px; }
.editor-canvas-area { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; }
.editor-canvas-area canvas { max-width: 100%; height: auto; background: #fff; border: 1px solid var(--line); }
.editor-controls .control { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.editor-controls input[type=range] { width: 100%; }
.aspect-presets { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- Larger screens ---- */
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .modal-body { grid-template-columns: 1.4fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .editor-wrap { grid-template-columns: 1.6fr 1fr; }
}

/* ---- Phone: strictly single column ---- */
@media (max-width: 560px) {
  .gallery { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .field.grow { flex: 1 1 auto; }
  .app-header { flex-wrap: wrap; }
  .app-header .session-info { text-align: left; width: 100%; }
  body { font-size: 17px; }
  button, .btn { width: 100%; }
  .card .card-actions button { width: auto; }
  .row button { width: auto; }
}
