/* ============================================================
   Homework Hub — Default Brand
   v1 · 2026-05-08
   Concept: "Quiet pride in finished work."
   Tagline: "Finish well."

   Tenants override --brand-primary, --brand-deep, --brand-accent,
   --font-display, --font-body via [data-tenant] selector.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Geist:wght@300;400;500;600;700&display=swap');

:root {
  /* ---- palette: default brand ---- */
  --brand-primary:   #5B4B7A;  /* Dusk Plum */
  --brand-deep:      #2E2440;  /* Midnight Plum */
  --brand-soft:      #EFE8F1;  /* Linen Mauve */
  --brand-accent:    #E8A951;  /* Amber Ribbon */

  --ink:             #1F1B2E;  /* Graphite */
  --ink-soft:        #6E6884;  /* Slate Lavender */
  --paper:           #FAF7F2;  /* Cream Paper */
  --rail:            #D9D2DE;  /* Whisper Lilac */

  /* status colors */
  --good:            #2A8F66;
  --warn:            #C8941E;
  --bad:             #B85454;

  /* ---- type ---- */
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body:    'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --fs-display-xl: clamp(2rem, 5vw + 1rem, 2.75rem);
  --fs-display-l:  clamp(1.625rem, 3vw + 0.75rem, 2rem);
  --fs-heading:    1.375rem;
  --fs-body:       1.0625rem;
  --fs-ui:         0.9375rem;
  --fs-caption:    0.8125rem;
  --lh-body:       1.55;

  /* ---- space ---- */
  --space-1:  4px;  --space-2:  8px;  --space-3: 12px;
  --space-4: 16px;  --space-5: 24px;  --space-6: 32px;
  --space-7: 48px;  --space-8: 72px;

  /* ---- shape ---- */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   18px;
  --radius-pill: 999px;
  --hairline:    1px solid var(--rail);

  /* ---- motion ---- */
  --dur-short:  160ms;
  --dur-med:    280ms;
  --dur-long:   480ms;
  --ease-out:   cubic-bezier(0.2, 0.7, 0.2, 1);

  /* ---- touch ---- */
  --tap-min: 44px;

  /* ---- elevation (subtle, single layer) ---- */
  --shadow-1: 0 1px 2px rgba(31, 27, 46, 0.04), 0 0 0 1px rgba(31, 27, 46, 0.04);
  --shadow-2: 0 8px 24px rgba(46, 36, 64, 0.08);
  --shadow-3: 0 24px 48px rgba(46, 36, 64, 0.14);
}

/* ---- base resets ---- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--brand-deep);
  margin: 0 0 var(--space-3);
}
h1 { font-size: var(--fs-display-xl); }
h2 { font-size: var(--fs-display-l); }
h3 { font-size: var(--fs-heading); }

button, .btn {
  min-height: var(--tap-min);
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  border: 1px solid var(--rail);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-ui);
  cursor: pointer;
  transition: background var(--dur-short) var(--ease-out),
              transform var(--dur-short) var(--ease-out),
              border-color var(--dur-short) var(--ease-out);
}
button:hover, .btn:hover { border-color: var(--brand-primary); }
button:disabled, .btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: var(--brand-primary); color: var(--paper); border-color: var(--brand-primary); }
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn-primary:active { transform: scale(0.98); }

.btn-ghost { background: transparent; border-color: var(--rail); }

/* ---- Premium form controls ---- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="tel"], input[type="search"], textarea, select {
  width: 100%;
  min-height: 56px;
  padding: 16px 18px;
  border: 1.5px solid var(--rail);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 500;
  line-height: 1.4;
  -webkit-appearance: none; appearance: none;
  /* Subtle ambient shadow gives the field depth without feeling heavy */
  box-shadow:
    0 1px 0 rgba(46, 36, 64, 0.02),
    0 0 0 1px rgba(46, 36, 64, 0.015) inset;
  transition:
    border-color var(--dur-short) var(--ease-out),
    box-shadow   var(--dur-short) var(--ease-out),
    background   var(--dur-short) var(--ease-out),
    transform    var(--dur-short) var(--ease-out);
}
input::placeholder, textarea::placeholder {
  color: var(--ink-soft);
  font-weight: 400;
  opacity: 0.5;
  font-style: italic;
}
input:hover, textarea:hover, select:hover {
  border-color: color-mix(in srgb, var(--brand-primary) 40%, var(--rail));
  box-shadow:
    0 2px 6px rgba(46, 36, 64, 0.04),
    0 0 0 1px rgba(46, 36, 64, 0.02) inset;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand-primary);
  background: white;
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--brand-primary) 14%, transparent),
    0 1px 3px rgba(46, 36, 64, 0.06),
    0 1px 2px rgba(31, 27, 46, 0.04) inset;
}
input:disabled, textarea:disabled, select:disabled { background: var(--brand-soft); color: var(--ink-soft); cursor: not-allowed; }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%236E6884' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Field label helper — for label-above-input pattern */
.fld-label,
label.fld {
  display: block;
  font-size: var(--fs-caption);
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.fld-hint {
  font-size: var(--fs-caption);
  color: var(--ink-soft);
  margin-top: 6px;
  line-height: 1.4;
}

/* `label.fld` is used heavily in older admin templates as `<label class="fld">Label <input>`
   That puts the input inside the label. Patch the inner control too. */
label.fld input,
label.fld select,
label.fld textarea { margin-top: 6px; }

/* Modal cards — make sure their inputs feel premium (some inline modals were inheriting
   plain HTML defaults). */
.modal-card input[type="text"],
.modal-card input[type="email"],
.modal-card input[type="password"],
.modal-card input[type="number"],
.modal-card input[type="date"],
.modal-card textarea,
.modal-card select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid var(--rail);
  border-radius: var(--radius-md);
  background: white;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  margin-top: 6px;
}
.modal-card input:focus,
.modal-card textarea:focus,
.modal-card select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-primary) 14%, transparent);
}

/* Compact two-up + three-up grid helpers — admin pages already use these names */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-3); }
@media (max-width: 600px) { .row2, .row3 { grid-template-columns: 1fr; } }

/* Read-only / copy-target inputs (e.g. the Student URL field) get a subtle paper bg */
input[readonly], textarea[readonly] {
  background: var(--brand-soft);
  cursor: text;
}
input[readonly]:focus, textarea[readonly]:focus {
  background: white;
}

/* Center small forms vertically inside their card if they're short */
.center-form { display: flex; flex-direction: column; gap: var(--space-3); }

/* ============ Premium input-with-icon ============ */
.input-icon {
  position: relative;
  display: flex; align-items: center;
  background: white;
  border: 1.5px solid var(--rail);
  border-radius: 14px;
  min-height: 56px;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(46, 36, 64, 0.02),
    0 0 0 1px rgba(46, 36, 64, 0.015) inset;
  transition: border-color var(--dur-short) var(--ease-out),
              box-shadow var(--dur-short) var(--ease-out);
}
.input-icon:hover {
  border-color: color-mix(in srgb, var(--brand-primary) 40%, var(--rail));
  box-shadow:
    0 2px 6px rgba(46, 36, 64, 0.04),
    0 0 0 1px rgba(46, 36, 64, 0.02) inset;
}
.input-icon:focus-within {
  border-color: var(--brand-primary);
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--brand-primary) 14%, transparent),
    0 1px 3px rgba(46, 36, 64, 0.06),
    0 1px 2px rgba(31, 27, 46, 0.04) inset;
}
.input-icon > svg,
.input-icon > .icon {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  margin: 0 14px 0 18px;
  color: var(--ink-soft);
  pointer-events: none;
  transition: color var(--dur-short) var(--ease-out);
  stroke-width: 1.6;
}
.input-icon:focus-within > svg,
.input-icon:focus-within > .icon { color: var(--brand-primary); }
.input-icon > input,
.input-icon > select,
.input-icon > textarea {
  flex: 1; min-width: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 16px 18px 16px 0 !important;
  min-height: auto;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--ink);
  font-weight: 500;
  outline: none;
}
.input-icon > input:focus,
.input-icon > select:focus,
.input-icon > textarea:focus { box-shadow: none !important; border: 0 !important; }

/* ============ Premium color-picker pill ============
   Layout: a left swatch zone (the native color input rendered as a 56px square)
   + a right hex text input. Both share the wrapper's border + focus glow. */
.input-color {
  display: flex;
  align-items: stretch;
  background: white;
  border: 1.5px solid var(--rail);
  border-radius: 14px;
  min-height: 56px;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(46, 36, 64, 0.02),
    0 0 0 1px rgba(46, 36, 64, 0.015) inset;
  transition: border-color var(--dur-short) var(--ease-out),
              box-shadow var(--dur-short) var(--ease-out);
}
.input-color:hover { border-color: color-mix(in srgb, var(--brand-primary) 35%, var(--rail)); }
.input-color:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-primary) 14%, transparent);
}
.input-color input[type="color"] {
  flex: 0 0 auto;
  width: 56px;
  height: auto;
  align-self: stretch;
  padding: 6px;
  margin: 0;
  border: 0 !important;
  border-right: 1px solid var(--rail) !important;
  border-radius: 0 !important;
  min-height: auto;
  background: var(--paper);
  cursor: pointer;
  box-shadow: none !important;
  outline: none !important;
  -webkit-appearance: none; appearance: none;
}
.input-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.input-color input[type="color"]::-webkit-color-swatch { border: 1px solid var(--rail); border-radius: 6px; }
.input-color input[type="color"]::-moz-color-swatch { border: 1px solid var(--rail); border-radius: 6px; }
.input-color input[type="text"] {
  flex: 1; min-width: 0;
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  padding: 14px 16px !important; min-height: auto;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: var(--fs-ui);
  font-weight: 600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  outline: none;
}
.input-color input[type="text"]:focus { box-shadow: none !important; border: 0 !important; }

/* ============ Premium "input + button" combo (for "Add a student") ============ */
.input-with-action {
  display: flex; gap: 0;
  align-items: stretch;
}
.input-with-action > input { flex: 1; border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
.input-with-action > button {
  border-top-left-radius: 0; border-bottom-left-radius: 0;
  min-height: 52px; padding: 0 22px;
  background: var(--brand-primary); color: var(--paper);
  border: 1.5px solid var(--brand-primary);
  font-weight: 700; font-size: var(--fs-ui);
  cursor: pointer;
  transition: background var(--dur-short) var(--ease-out);
}
.input-with-action > button:hover { background: var(--brand-deep); border-color: var(--brand-deep); }

a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--brand-deep); }

.card {
  background: white;
  border: var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-1);
  animation: inkSettle var(--dur-med) var(--ease-out) both;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--brand-primary);
}

.tagline {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-soft);
}

.ribbon-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand-accent);
  display: inline-block;
  vertical-align: middle;
  animation: ribbonClasp var(--dur-med) var(--ease-out) both;
}

.hairline { border: none; border-top: 1px solid var(--rail); margin: var(--space-5) 0; }

/* ---- signature keyframes ---- */
@keyframes inkSettle {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ribbonClasp {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}
@keyframes pageTurnOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-12px); }
}
@keyframes pageTurnIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---- accessibility ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 120ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 120ms !important;
  }
}

/* ---- shared shell layouts ---- */
.shell {
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.appbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: rgba(250, 247, 242, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: var(--hairline);
}
.lockup { display: flex; align-items: center; gap: var(--space-3); }
.lockup .mark {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--brand-primary);
  display: flex; align-items: center; justify-content: center;
  color: var(--paper); font-family: var(--font-display); font-weight: 700;
}

/* ---- Homework Hub real logo, applied wherever .mark or .mark-large appears.
       The bg image covers any inline placeholder text (e.g. "H").             */
.mark, .mark-large {
  background-image: url("/static/homework-logo.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: var(--brand-primary);
  color: transparent !important;
  text-indent: -9999px;
  font-size: 0 !important;
  overflow: hidden;
  flex-shrink: 0;
}
.lockup .name { font-family: var(--font-display); font-weight: 600; color: var(--brand-deep); font-size: 1.05rem; }
.lockup .name small { display: block; font-family: var(--font-body); color: var(--ink-soft); font-size: 0.75rem; font-weight: 400; letter-spacing: 0.04em; }

.center-stage {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-7) var(--space-4);
}
.center-stage .panel { width: 100%; max-width: 460px; }

/* ---- Language switcher pill ---- */
.lang-switch {
  display: inline-flex; align-items: center; gap: 0;
  background: white;
  border: 1px solid var(--rail);
  border-radius: var(--radius-pill);
  padding: 3px;
  font-family: var(--font-body);
}
.lang-switch-btn {
  padding: 0 12px;
  height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-pill);
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  transition: background var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
  min-width: 36px;
}
.lang-switch-btn:hover { color: var(--brand-primary); }
.lang-switch-btn.active {
  background: var(--brand-primary);
  color: var(--paper);
}
