/* EMIL Archive styles. Change the colours here to match the rest of the site. */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #0f1418;
  --panel: #161d22;
  --line: #2a353d;
  --ink: #e6e1d6;
  --muted: #9aa3a8;
  --accent: #7fb7a4;
  --warn: #d79a6b;
  --paper: #f4efe4;
  --serif: 'EB Garamond', Garamond, Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--serif); font-size: 19px; line-height: 1.6;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  min-height: 100vh; display: flex; flex-direction: column;
}
input { -webkit-user-select: text; user-select: text; }
a { color: var(--accent); }

.emil-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.emil-brand { color: var(--ink); text-decoration: none; font-size: 1.1rem; letter-spacing: .02em; }
.emil-top nav { display: flex; gap: 18px; font-family: var(--mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.emil-top nav a { color: var(--muted); text-decoration: none; }
.emil-top nav a:hover { color: var(--ink); }
.emil-top .emil-end { color: var(--warn); }

.emil-main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 40px 16px 64px; }
h1 { font-weight: 500; font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1.15; margin: .2em 0 .4em; }
h2 { font-weight: 500; font-size: 1.4rem; margin: .1em 0 .3em; }
.emil-kicker, .emil-code, .emil-meta, .emil-status, .emil-hint, label, button, .emil-btn, #emil-count, .emil-help, .emil-note, .emil-error {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
}
.emil-kicker { color: var(--accent); margin: 0; }
.emil-code { color: var(--muted); margin: 0 0 .2em; }
.emil-lead { color: var(--ink); font-size: 1.15rem; max-width: 40em; }
.emil-hint { color: var(--muted); text-transform: none; letter-spacing: .02em; font-size: .85rem; }
.emil-note { color: var(--muted); }
.emil-error { color: var(--warn); }

.emil-gate { max-width: 620px; margin: 4vh auto 0; padding: 36px 32px; background: var(--panel); border: 1px solid var(--line); }
.emil-gate--small { margin-top: 48px; max-width: none; }
.emil-eye { font-size: 2rem; color: var(--accent); line-height: 1; }
.emil-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 18px 0; }
.emil-form label { width: 100%; color: var(--muted); }
.emil-form input { flex: 1 1 220px; min-width: 0; padding: 12px 14px; font: 1rem var(--mono); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 2px; }
.emil-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .emil-btn { cursor: pointer; padding: 12px 18px; background: transparent; color: var(--accent); border: 1px solid var(--accent); border-radius: 2px; text-decoration: none; display: inline-block; }
button:hover, .emil-btn:hover { background: var(--accent); color: var(--bg); }

.emil-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 28px; }
.emil-card { background: var(--panel); border: 1px solid var(--line); padding: 22px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.emil-card p { margin: 0 0 .6em; color: var(--muted); font-size: 1rem; }
.emil-card .emil-btn { margin-top: auto; }
.emil-meta { color: var(--muted); margin-top: 6px; }
.emil-card.is-closed { opacity: .6; }
.emil-card.is-closed h2 { color: var(--muted); }
.emil-status { color: var(--warn); margin-top: auto; }
.emil-back { font-family: var(--mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; text-decoration: none; }

/* Reader */
.emil-readhead { text-align: center; margin-bottom: 18px; }
.emil-readhead .emil-back { display: inline-block; margin-bottom: 18px; }
.emil-reader { display: flex; align-items: center; justify-content: center; gap: 8px; perspective: 1800px; }
.emil-sheet { position: relative; flex: 0 1 auto; max-width: 100%; min-height: 240px; min-width: 200px; background: var(--paper); box-shadow: 0 18px 40px rgba(0,0,0,.45); transform-origin: left center; touch-action: pan-y; }
.emil-sheet img { display: block; max-width: 100%; max-height: 78vh; width: auto; height: auto; pointer-events: none; -webkit-user-drag: none; }
.emil-shield { position: absolute; inset: 0; cursor: pointer; }
.emil-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #6b6458; font-family: var(--mono); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; }
.emil-sheet.is-ready .emil-loading { display: none; }
.emil-turn { flex: none; font-size: 2rem; line-height: 1; padding: 10px 14px; border-color: var(--line); color: var(--muted); }
.emil-turn:disabled { opacity: .25; cursor: default; }
.emil-turn:disabled:hover { background: transparent; color: var(--muted); }
/* Page turn: the leaf is built from thin vertical strips so the page can bend as it turns. */
.emil-reader { overflow: visible; }
.emil-shade { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: linear-gradient(to right, rgba(0,0,0,.55), rgba(0,0,0,.18) 35%, rgba(0,0,0,0) 70%); }
.emil-leaf { position: absolute; left: 0; top: 0; pointer-events: none; transform-style: preserve-3d; perspective: 2200px; display: none; }
.emil-leaf.is-turning { display: block; }
.emil-strip { position: absolute; top: 0; height: 100%; transform-style: preserve-3d; transform-origin: 0 50%; }
.emil-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background-repeat: no-repeat; overflow: hidden; }
.emil-face--back { transform: rotateY(180deg); }
.emil-thru { position: absolute; inset: 0; background-repeat: no-repeat; transform: scaleX(-1); opacity: .09; filter: grayscale(.3) blur(.5px); }
.emil-face i { position: absolute; inset: 0; }

.emil-controls { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 20px; }
.emil-controls button { padding: 8px 12px; }
#emil-count { color: var(--ink); min-width: 6em; text-align: center; }
.emil-help { text-align: center; color: var(--muted); text-transform: none; letter-spacing: .02em; font-size: .85rem; margin-top: 18px; }

.emil-foot { border-top: 1px solid var(--line); padding: 18px 24px; color: var(--muted); font-size: .85rem; text-align: center; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .emil-top { padding: 14px 16px; }
  .emil-gate { padding: 26px 20px; }
  .emil-turn { display: none; }
  .emil-sheet img { max-height: 70vh; }
}

/* Nothing prints. */
@media print { body * { display: none !important; } body::after { content: "EMIL Archive records cannot be printed."; display: block; padding: 2em; color: #000; } }
