/* Tigray Connect - base styles: colours, type, buttons, forms, shell.
   System fonts only (no downloads), so pages stay light on slow connections. */
:root {
  --ink: #1e2358;       /* night indigo: text and structure */
  --ink-2: #4a5080;     /* softer text */
  --paper: #f7f8fc;     /* page */
  --white: #fff;
  --daisy: #ffc21f;     /* Adey Abeba yellow: actions and finished blocks */
  --daisy-d: #d9a000;
  --daisy-bg: #fff3c7;
  --green: #167a4d;     /* correct, done */
  --green-bg: #e1f3ea;
  --sky: #2f5fd0;       /* links */
  --sky-bg: #e6edfb;
  --rose: #d6325c;      /* problems */
  --rose-bg: #fde7ed;
  --haze: #dde2f2;      /* borders */
  --haze-2: #eef0f8;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Ethiopic", "Nyala", "Kefa", "Abyssinica SIL", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 400 1.0625rem/1.6 var(--font); color: var(--ink); background: var(--paper); min-height: 100vh; display: flex; flex-direction: column; }
html[lang="am"] body, html[lang="ti"] body { font-size: 1.125rem; line-height: 1.75; }
#app { flex: 1; display: flex; flex-direction: column; }
main { flex: 1; padding-block: 1.75rem 3rem; outline: none; }
h1, h2, h3 { line-height: 1.12; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.015em; }
h1 { font-size: clamp(2rem, 1.2rem + 3.6vw, 3.4rem); letter-spacing: -.025em; }
h2 { font-size: clamp(1.45rem, 1.1rem + 1.5vw, 2rem); }
h3 { font-size: 1.15rem; }
html[lang="am"] :is(h1, h2, h3), html[lang="ti"] :is(h1, h2, h3) { letter-spacing: 0; line-height: 1.35; }
p { margin: 0 0 1em; max-width: 64ch; }
a { color: var(--sky); text-underline-offset: .18em; }
img, svg, video, iframe { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 4px; }
.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.narrow { width: min(640px, 100% - 2rem); margin-inline: auto; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1 1 0; min-width: 0; }
.muted { color: var(--ink-2); }
.small { font-size: .9rem; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gap > * + * { margin-top: 1.1rem; }

/* Buttons: a flat slab with a thicker lower edge that presses down when tapped. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 46px; padding: .55em 1.2em; border: 2px solid var(--ink); border-radius: 12px; background: var(--white); color: var(--ink); font-weight: 700; text-decoration: none; cursor: pointer; line-height: 1.2; text-align: center; }
.btn:hover { background: var(--haze-2); }
.btn:active { transform: translateY(2px); }
.btn.primary { background: var(--daisy); border-color: var(--daisy); border-bottom: 4px solid var(--daisy-d); }
.btn.primary:hover { background: #ffcd4d; }
.btn.primary:active { border-bottom-width: 2px; margin-top: 2px; transform: none; }
.btn.quiet { border-color: var(--haze); }
.btn.danger { color: var(--rose); border-color: var(--rose-bg); }
.btn.small { min-height: 38px; padding: .3em .8em; font-size: .92rem; border-radius: 10px; }
.btn.big { min-height: 56px; font-size: 1.1rem; padding-inline: 1.6em; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { flex: none; }
.iconbtn { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 10px; background: transparent; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.iconbtn:hover { background: var(--haze-2); color: var(--ink); }
.iconbtn[disabled] { opacity: .3; cursor: default; }

/* Forms */
.field { display: grid; gap: .35rem; }
.field > label, .field > .label { font-weight: 700; font-size: .96rem; }
.field input:not([type=checkbox], [type=radio], [type=file]), .field select, .field textarea, .input { width: 100%; min-height: 46px; padding: .55em .8em; background: var(--white); border: 2px solid var(--haze); border-radius: 10px; }
.field textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-bg); }
.field .help { font-size: .88rem; color: var(--ink-2); }
.field .err { font-size: .9rem; color: var(--rose); font-weight: 600; }
.field [aria-invalid=true] { border-color: var(--rose); }
.form { display: grid; gap: 1.1rem; }
.cols { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.picks { display: flex; flex-wrap: wrap; gap: .5rem; }
.pick { position: relative; }
.pick input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pick span { display: inline-block; padding: .45em 1em; border: 2px solid var(--haze); border-radius: 999px; background: var(--white); font-weight: 600; }
.pick:has(input:checked) span { background: var(--ink); border-color: var(--ink); color: var(--white); }
.pick:has(input:focus-visible) span { outline: 3px solid var(--sky); outline-offset: 2px; }

/* Messages: the coloured left edge tells how serious it is. */
.notice { padding: .85rem 1rem; border-radius: 10px; border-left: 6px solid var(--sky); background: var(--sky-bg); }
.notice.ok { border-color: var(--green); background: var(--green-bg); }
.notice.warn { border-color: var(--daisy-d); background: var(--daisy-bg); }
.notice.bad { border-color: var(--rose); background: var(--rose-bg); }
.notice > :last-child { margin-bottom: 0; }
.chip { display: inline-block; padding: .1em .65em; border-radius: 999px; background: var(--haze-2); font-size: .86rem; font-weight: 600; }
.chip.ok { background: var(--green-bg); color: var(--green); }
.chip.warn { background: var(--daisy-bg); }
.chip.bad { background: var(--rose-bg); color: var(--rose); }
.empty { padding: 2rem 1rem; text-align: center; border: 2px dashed var(--haze); border-radius: 16px; }

/* Shell */
.top { position: sticky; top: 0; z-index: 20; background: var(--white); border-bottom: 2px solid var(--haze); }
.top .wrap { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem 1rem; min-height: 64px; padding-block: .3rem; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; }
.brand img { width: 30px; height: 30px; }
.nav { display: flex; gap: .2rem; overflow-x: auto; flex: 1 1 auto; scrollbar-width: none; }
.nav a { padding: .5rem .8rem; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 650; white-space: nowrap; }
.nav a:hover { background: var(--haze-2); }
.nav a[aria-current=page] { background: var(--haze-2); box-shadow: inset 0 -3px 0 var(--daisy); }
.langs { display: flex; border: 2px solid var(--haze); border-radius: 12px; overflow: hidden; }
.langs button { border: 0; background: transparent; font-weight: 650; padding: .35rem .65rem; min-height: 38px; cursor: pointer; }
.langs button[aria-pressed=true] { background: var(--ink); color: var(--white); }
.langs .short { display: none; }
.account { display: flex; align-items: center; gap: .5rem; }
.who { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The account menu: the person's name opens it. */
.account-menu { position: relative; }
.account-menu > summary { display: flex; align-items: center; gap: .45rem; min-height: 42px; padding: .2rem .55rem .2rem .25rem; border: 2px solid var(--haze); border-radius: 999px; cursor: pointer; list-style: none; font-weight: 650; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover, .account-menu[open] > summary { border-color: var(--ink); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--daisy); font-weight: 800; flex: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 30; display: grid; min-width: 220px; max-width: min(300px, 100vw - 2rem); padding: .4rem; background: var(--white); border: 2px solid var(--haze); border-radius: 14px; box-shadow: 0 12px 32px rgba(30, 35, 88, .18); }
.menu-panel a, .menu-panel button { display: flex; align-items: center; gap: .6rem; padding: .65rem .7rem; border: 0; border-radius: 10px; background: none; color: var(--ink); text-decoration: none; font-weight: 650; text-align: left; cursor: pointer; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--haze-2); }
.menu-who { display: grid; padding: .5rem .7rem .6rem; margin-bottom: .2rem; border-bottom: 2px solid var(--haze); overflow-wrap: anywhere; }
/* Phones: name, language and account on the first line; the menu links get their own line below.
   The bar scrolls away with the page, so it never covers a lesson. */
@media (max-width: 760px) {
  .top { position: static; }
  .top .wrap { gap: .35rem .5rem; min-height: 0; padding-block: .45rem; }
  .top .wrap::after { content: ''; order: 4; flex: 0 0 100%; height: 0; }
  .brand { order: 1; flex: 1 1 auto; min-width: 0; white-space: nowrap; font-size: 1.05rem; gap: .45rem; }
  .brand img { width: 26px; height: 26px; }
  .langs { order: 2; }
  .langs button { padding-inline: .45rem; font-size: .85rem; min-height: 36px; }
  .langs .long { display: none; }
  .langs .short { display: inline; }
  .account { order: 3; }
  .account.row { order: 6; margin-left: auto; gap: .4rem; }
  .account-menu .who, .account-menu > summary > svg { display: none; }
  .account-menu > summary { padding: .15rem; }
  .nav { order: 5; flex: 1 1 auto; min-width: 0; margin-inline: -.35rem; }
  .nav a { padding: .45rem .55rem; font-size: .95rem; }
}
@media (max-width: 350px) {
  .brand { font-size: .95rem; }
  .langs button { padding-inline: .3rem; font-size: .78rem; }
}
.foot { border-top: 2px solid var(--haze); background: var(--white); padding-block: 1.5rem; font-size: .95rem; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--white); padding: .6rem 1rem; z-index: 50; }
.skip:focus { left: 0; }
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-size: clamp(1.7rem, 1.1rem + 2.4vw, 2.5rem); margin-bottom: .25em; }
.tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 2px solid var(--haze); margin-bottom: 1.25rem; }
.tabs button { border: 0; background: none; padding: .7rem 1rem; font-weight: 700; cursor: pointer; color: var(--ink-2); white-space: nowrap; border-bottom: 4px solid transparent; margin-bottom: -2px; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--daisy); }
@media (max-width: 480px) { .tabs button { padding-inline: .7rem; } }
.badge { display: inline-block; min-width: 1.5em; padding: 0 .45em; margin-left: .4em; border-radius: 999px; background: var(--rose); color: var(--white); font-size: .8rem; text-align: center; }

/* Dialogs (course builder editor, confirmations) */
dialog.sheet { border: 0; border-radius: 20px; padding: 0; width: min(680px, 100% - 1.5rem); max-height: 92vh; color: var(--ink); background: var(--white); box-shadow: 0 20px 60px rgba(30, 35, 88, .35); }
dialog.sheet::backdrop { background: rgba(30, 35, 88, .55); }
dialog.sheet[open] { display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 2px solid var(--haze); }
.sheet-head h2 { margin: 0; font-size: 1.3rem; }
.sheet-body { padding: 1.25rem; overflow-y: auto; }
.sheet-foot { display: flex; justify-content: flex-end; gap: .75rem; padding: .9rem 1.25rem; border-top: 2px solid var(--haze); background: var(--paper); border-radius: 0 0 20px 20px; }
@media (max-width: 600px) { dialog.sheet { width: 100%; max-width: 100%; max-height: 100%; height: 100%; border-radius: 0; margin: 0; } .sheet-foot { border-radius: 0; } }

/* Toasts */
#toasts { position: fixed; inset: auto 0 1rem 0; display: grid; justify-items: center; gap: .5rem; z-index: 100; pointer-events: none; padding-inline: 1rem; }
.toast { pointer-events: auto; max-width: 28rem; padding: .7rem 1rem; border-radius: 12px; background: var(--ink); color: var(--white); border-left: 6px solid var(--daisy); box-shadow: 0 6px 24px rgba(30, 35, 88, .3); font-weight: 600; }
.toast.bad { border-color: var(--rose); }
.toast.ok { border-color: var(--green); }

.table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: 12px; overflow: hidden; }
.table th, .table td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--haze); vertical-align: top; }
.table th { background: var(--haze-2); font-size: .9rem; }
.scroll-x { overflow-x: auto; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }
