/* ── Fonts ────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Code Pro LC';
  src: url('../Code Pro LC.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── MythOS98 theme ───────────────────────────────────────────── */
:root {
  --bg:       #3A6EA5;
  --bg-alt:   #ECE9D8;
  --border:   #848284;
  --text:     #000000;
  --text-dim: #6B6B6B;
  --accent:   #0A246A;

  --font-ui:   Tahoma, 'Trebuchet MS', 'MS Sans Serif', sans-serif;
  --font-body: 'Code Pro LC', monospace;

  --clip-w:             560px;
  --clip-pad:           2.2rem;
  --clip-pad-top:       9rem;   /* extra top offset to clear the clipboard image's title */
  --paper-font-size:    2rem;
}

html { font-size: 11px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100vh;
}

/* ── Utility ──────────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  clip: rect(0,0,0,0); overflow: hidden;
}

/* ───────────────────────────────────────────────────────────────
   WINDOW CHROME  (modal title bar + card title bars)
   ─────────────────────────────────────────────────────────────── */
.myth98-titlebar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 4px 6px;
  background: linear-gradient(to right, #0A246A 0%, #2060C0 30%, #4E9AE0 70%, #90C8F6 100%);
  flex-shrink: 0;
  user-select: none;
}

.myth98-titlebar-icon {
  display: inline;
  font-size: 14px;
  line-height: 1;
}

.myth98-titlebar-text {
  flex: 1;
  min-width: 0;
  color: #FFFFFF;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.myth98-titlebar-buttons { display: flex; gap: 0.25rem; flex-shrink: 0; }

.myth98-btn {
  width: 21px;
  height: 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to bottom, #FAFAFF 0%, #C8C4BC 100%);
  border: none;
  border-radius: 3px;
  color: #000;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  box-shadow:
    inset 1px 1px 0 rgba(255,255,255,0.9),
    inset -1px -1px 0 rgba(0,0,0,0.2),
    0 1px 2px rgba(0,0,0,0.3);
}

.myth98-btn:hover { background: linear-gradient(to bottom, #FFFFFF 0%, #DDD8D0 100%); }
button.myth98-btn:active { background: linear-gradient(to bottom, #C8C4BC 0%, #FAFAFF 100%); }

/* Min/Max are decorative — no pointer feedback */
.myth98-btn-min,
.myth98-btn-max { cursor: default; }

.myth98-btn-close {
  background: linear-gradient(135deg, #F06060 0%, #C03030 100%);
  color: #FFFFFF;
  border: none;
}
button.myth98-btn-close:hover  { background: linear-gradient(135deg, #FF7070 0%, #E04040 100%); }
button.myth98-btn-close:active { background: linear-gradient(135deg, #C03030 0%, #E05050 100%); }

/* Card title bars show the window chrome on every card */
.card-titlebar { display: flex; }

/* Hide buttons on cards — they only appear inside the open clipboard modal */
.card-titlebar .myth98-btn-min,
.card-titlebar .myth98-btn-max,
.card-titlebar .myth98-btn-close { display: none; }

/* ── Header ───────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(to bottom, #2060C0 0%, #1347A0 100%);
  border-bottom: 2px solid #0A246A;
  padding: 1rem 1rem;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.header-logo {
  height: 100px;
  width: auto;
  flex-shrink: 0;
  opacity: 0.85;
}

.header-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: #B8D4F4;
  text-transform: uppercase;
}

.header-title h1 {
  font-size: 1rem;
  font-weight: bold;
  color: #FFFFFF;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.header-controls {
  display: flex;
  gap: 0.75rem;
  margin-left: auto;
  flex-wrap: wrap;
  align-items: center;
}

.header-controls input,
.header-controls select {
  background: #FFFFFF;
  border: 2px solid;
  border-color: #848284 #FFFFFF #FFFFFF #848284;
  box-shadow: inset 1px 1px 1px rgba(0,0,0,0.2);
  color: #000;
  font-family: var(--font-ui);
  font-size: 11px;
  border-radius: 0;
  padding: 0.25rem 0.5rem;
  outline: none;
}

.header-controls input:focus,
.header-controls select:focus {
  border-color: #0A246A #FFFFFF #FFFFFF #0A246A;
}

.header-controls input[type="search"] { width: 220px; }

/* ── Grid ─────────────────────────────────────────────────────── */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.empty-state {
  text-align: center;
  color: #FFFFFF;
  padding: 4rem 0;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
}

/* ── Card ─────────────────────────────────────────────────────── */
.card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  overflow: hidden;
  border-radius: 0;
  border: 2px solid;
  border-color: #FFFFFF #848284 #848284 #FFFFFF;
  box-shadow: 1px 1px 0 #C8C4BC, 2px 2px 6px rgba(0,0,0,0.4);
  background: #ECE9D8;
  transition: box-shadow 0.15s ease;
}

.card:hover {
  box-shadow: 1px 1px 0 #C8C4BC, 3px 3px 12px rgba(0,0,0,0.55);
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Texture/thumbnail area — drives the card's height via aspect-ratio */
.card-body {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background-image: url('../texture_clipBoardPaper.png');
  background-size: cover;
  background-position: center;
}

/* Gradient overlay so text reads over the texture */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(10,8,5,0.72) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.6rem 0.6rem 0.5rem;
}

.card-badge {
  font-size: 1.2rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 0;
  border: 1px solid currentColor;
  align-self: flex-start;
  margin-bottom: 0;
  opacity: 0.92;
  background: rgba(0,0,0,0.5);
  font-family: Tahoma, sans-serif;
}

/* Title is shown in the card's myth98 titlebar instead */
.card-title { display: none; }

.card-preview {
  font-family: Tahoma, sans-serif;
  font-size: 1.25rem;
  color: #EEE;
  margin-top: 0.3rem;
  line-height: 1.4;
  opacity: 0.85;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Modal ────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
}

.modal-frame {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 90vh;
  width: min(var(--clip-w), 100%);
}

/* ── Clipboard widget ─────────────────────────────────────────── */
.clipboard {
  width: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  border: 2px solid;
  border-color: #FFFFFF #0A246A #0A246A #FFFFFF;
  box-shadow: 2px 2px 0 #C8C4BC, 4px 4px 14px rgba(0,0,0,0.65);
  overflow: hidden;
}

.clipboard-body-wrap {
  position: relative;
  background: #ECE9D8;
  padding: 3px;
}

.clipboard-paper {
  background-image: url('../texture_clipBoardPaper.png');
  background-size: cover;
  background-position: center;
  border: 1px solid #ACA899;
  box-shadow: inset 2px 2px 2px rgba(0,0,0,0.65);
  padding: 0;
  overflow-y: auto;
  aspect-ratio: 1198 / 1793;
  max-height: calc(90vh - 110px);
  isolation: isolate;
}

/* ── Paper frost ──────────────────────────────────────────────── */
.paper-frost {
  position: sticky;
  top: 0;
  width: 100%;
  height: 25rem;
  margin-bottom: -25rem;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.35s ease;
  -webkit-mask-image: linear-gradient(to bottom, black 20%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 20%, transparent 100%);
}

.paper-frost::before {
  content: '';
  position: absolute;
  inset: -16px;
  background-image: url('../texture_clipBoardPaper.png');
  background-size: cover;
  background-position: top left;
  filter: blur(10px);
}

.paper-frost.visible { opacity: 1; }

.paper-content {
  padding: var(--clip-pad);
  padding-top: var(--clip-pad-top);
  position: relative;
  z-index: 1;
}

.level-badge {
  font-size: 1.25rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 0;
  border: 1px solid currentColor;
  box-shadow: 0 0 8px 3px rgba(0,0,0,0.7), 0 2px 6px rgba(0,0,0,0.6);
  background: rgba(0,0,0,0.75);
  font-family: Tahoma, sans-serif;
}

.paper-title {
  font-family: var(--font-body);
  font-size: calc(var(--paper-font-size) * 1.3);
  font-weight: 700;
  color: #1a1008;
  margin-bottom: 1rem;
  line-height: 1.3;
  border-bottom: 1px solid rgba(0,0,0,0.12);
  padding-bottom: 0.75rem;
}

.paper-body {
  font-family: var(--font-body);
  font-size: var(--paper-font-size);
  line-height: 1.75;
  color: #1e1608;
  white-space: pre-wrap;
  word-break: break-word;
}

.paper-body strong { font-weight: 700; }

.paper-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.paper-source {
  font-size: 1.25rem;
  color: #000;
  letter-spacing: 0.08em;
  font-family: Tahoma, sans-serif;
}

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.modal:not(.hidden) .modal-frame { animation: fadeIn 0.18s ease forwards; }

/* ── Scrollbar — WinXP system style ──────────────────────────── */
.clipboard-paper::-webkit-scrollbar { width: 16px; }
.clipboard-paper::-webkit-scrollbar-track {
  background: #D4D0C8;
  border-left: 1px solid #ACA899;
}
.clipboard-paper::-webkit-scrollbar-thumb {
  background: linear-gradient(to right, #ECE9DE, #C8C4BC);
  border: 1px solid #848284;
  border-radius: 0;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.7);
}
.clipboard-paper::-webkit-scrollbar-button {
  display: block;
  background: #D4D0C8;
  border: 1px solid #848284;
  height: 16px;
}
