/* ─── Variables ────────────────────────────────────────── */
:root {
  --lilac:       #9A8CC5;
  --lilac-light: #EDE9F8;
  --lilac-mid:   #C4BAE4;
  --lilac-dark:  #7B6DB2;
  --text:        #1A1A2E;
  --text-muted:  #73739B;
  --bg:          #FFFFFF;
  --border:      #E5DFF2;
  --radius:      10px;
  --radius-sm:   6px;
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
input[type="file"]     { display: none; }

/* ─── Base ──────────────────────────────────────────────── */
html { font-size: 16px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  border-top: 3px solid var(--lilac);
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ────────────────────────────────────────────── */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Header ────────────────────────────────────────────── */
.site-header {
  padding: 52px 0 36px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
  animation: fadeUp 0.5s ease both;
}

.header-mark {
  width: 28px;
  height: 3px;
  background: var(--lilac);
  border-radius: 2px;
  margin-bottom: 18px;
}

.site-header h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 10px;
}

.subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
  font-weight: 300;
  max-width: 460px;
}

/* ─── Upload ────────────────────────────────────────────── */
.upload-section {
  animation: fadeUp 0.5s ease 0.08s both;
  margin-bottom: 48px;
}

.drop-zone {
  border: 1.5px dashed var(--lilac-mid);
  border-radius: var(--radius);
  padding: 56px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  outline: none;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone--active {
  border-color: var(--lilac);
  border-style: solid;
  background: var(--lilac-light);
}

.drop-zone__icon {
  color: var(--lilac);
  margin-bottom: 6px;
}

.drop-zone__icon svg {
  width: 46px;
  height: 46px;
  stroke: currentColor;
}

.drop-zone__primary {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.drop-zone__or {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.drop-zone__formats {
  font-size: 0.8125rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-top: 4px;
}

.drop-error {
  margin-top: 10px;
  font-size: 0.875rem;
  color: #B84F4F;
  text-align: center;
  min-height: 1.2em;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn--primary {
  background: var(--lilac);
  color: #fff;
  border-color: var(--lilac);
}
.btn--primary:hover { background: var(--lilac-dark); border-color: var(--lilac-dark); }

.btn--outline {
  background: transparent;
  color: var(--lilac);
  border-color: var(--lilac-mid);
}
.btn--outline:hover { border-color: var(--lilac); background: var(--lilac-light); }

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn--ghost:hover { background: var(--lilac-light); color: var(--text); }

/* ─── Results ───────────────────────────────────────────── */
.results-section {
  animation: fadeUp 0.35s ease both;
}

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.results-header h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  margin-bottom: 5px;
}

.results-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.results-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.print-only-date {
  display: none;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ─── Table ─────────────────────────────────────────────── */
.table-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}

.grades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.grades-table thead tr {
  background: var(--lilac-light);
}

.grades-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.grades-table th.num-col  { text-align: right; }
.grades-table th.final-col { color: var(--lilac-dark); }

.grades-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.grades-table tbody tr:last-child { border-bottom: none; }
.grades-table tbody tr:nth-child(even) { background: #FBFAFE; }
.grades-table tbody tr:hover { background: var(--lilac-light); }

.grades-table td {
  padding: 11px 16px;
  color: var(--text);
}

.grades-table td:first-child { font-weight: 500; }

.grades-table td.num-col {
  font-family: 'DM Mono', monospace;
  font-size: 0.875rem;
  text-align: right;
  color: var(--text);
}

.grades-table td.final-col {
  color: var(--lilac-dark);
  font-weight: 500;
}

/* ─── Row animation ─────────────────────────────────────── */
@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.row-animate { animation: rowIn 0.28s ease both; }

/* ─── Page animation ────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Footer ────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  padding: 40px 0 28px;
  text-align: center;
}
.site-footer p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 300;
  letter-spacing: 0.01em;
}

/* ─── Print ─────────────────────────────────────────────── */
@media print {
  .print-hide    { display: none !important; }
  .print-only-date { display: block; }

  body  { border-top: none; }

  .container { max-width: 100%; padding: 0 12px; }

  .site-header {
    padding: 14px 0 12px;
    margin-bottom: 18px;
    border-bottom: 1px solid #ccc;
    animation: none;
  }
  .site-header h1 { font-size: 1.5rem; }
  .subtitle { font-size: 0.8rem; display: block; }
  .header-mark { display: none; }

  .results-section { animation: none; }
  .results-header   { margin-bottom: 10px; }
  .results-header h2 { font-size: 1.2rem; }

  .table-wrapper {
    border: none;
    border-radius: 0;
    overflow: visible;
  }

  .grades-table { font-size: 0.875rem; }
  .grades-table th,
  .grades-table td { padding: 7px 10px; }

  .grades-table thead tr  { background: #ede9f8; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .grades-table tbody tr:nth-child(even) { background: #f9f7fe; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .grades-table tbody tr:hover { background: none; }
  .grades-table td.final-col { color: #5a4d9a; }

  @page { margin: 1.5cm 1cm; }
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .site-header { padding: 36px 0 26px; }
  .drop-zone { padding: 44px 20px; }
  .results-header { flex-direction: column; }
  .results-actions { width: 100%; }
  .results-actions .btn { flex: 1; text-align: center; justify-content: center; }
}
