/*
  Mashq stylesheet.

  - Phone first: base styles are for small screens; wider screens add to them.
  - No web fonts: the phone's own fonts load instantly and cost no data.
  - "inline" / "block" properties (margin-inline-start etc.) instead of
    left/right, so the layout flips correctly for right-to-left Urdu later.
*/

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1f23;
  --muted: #5b6470;
  --border: #d9dde2;
  --accent: #0b6e4f;
  --accent-text: #ffffff;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #c62828;
  --radius: 10px;
  --space: 1rem;
  --max-width: 60rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416;
    --surface: #1b1e21;
    --text: #e8eaed;
    --muted: #a3acb6;
    --border: #30353b;
    --accent: #3fb68b;
    --accent-text: #0b1410;
    --ok: #4ac26b;
    --warn: #d4a72c;
    --bad: #f47067;
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  padding-block: calc(var(--space) * 1.5);
}

h1, h2, h3 {
  line-height: 1.25;
  margin-block: 0 0.5em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; margin-block-start: 1.5em; }

p { margin-block: 0 1em; }

a { color: var(--accent); }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space);
}

/* Accessibility: a hidden link that appears when you press Tab. */
.skip-link {
  position: absolute;
  inset-inline-start: -999px;
}
.skip-link:focus {
  inset-inline-start: var(--space);
  top: var(--space);
  background: var(--surface);
  padding: 0.5rem 1rem;
  z-index: 10;
}

/* Header and footer */
.site-header {
  background: var(--surface);
  border-block-end: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
  min-height: 3.5rem;
}
.brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
}
.site-nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
/* On narrow phones the menu gets its own row under the logo. */
@media (max-width: 30rem) {
  .site-header__inner {
    flex-wrap: wrap;
    row-gap: 0;
  }
  .site-nav {
    flex-basis: 100%;
    gap: 0.25rem 0.75rem;
    padding-block-end: 0.5rem;
  }
}

.site-footer {
  color: var(--muted);
  font-size: 0.875rem;
  padding-block: var(--space);
  border-block-start: 1px solid var(--border);
}

/* Building blocks */
.lead {
  font-size: 1.125rem;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space);
  margin-block: var(--space);
}
.card > :first-child { margin-block-start: 0; }
.card > :last-child { margin-block-end: 0; }

.steps {
  padding-inline-start: 1.25rem;
}
.steps li { margin-block-end: 0.5rem; }

.button {
  display: inline-block;
  min-height: 2.75rem; /* big enough to tap with a thumb */
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button--secondary {
  background: transparent;
  color: var(--accent);
}

.messages {
  list-style: none;
  padding: 0;
  margin-block: 0 var(--space);
}
.message {
  padding: 0.75rem var(--space);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.message--success { border-color: var(--ok); }
.message--warning { border-color: var(--warn); }
.message--error { border-color: var(--bad); }

/* Wider screens */
@media (min-width: 40rem) {
  h1 { font-size: 2.25rem; }
  main { padding-block: calc(var(--space) * 2.5); }
}

/* Forms */
.form-page {
  max-width: 28rem;
}
.form-page__switch {
  margin-block-start: 1.5rem;
}
.muted {
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-block-end: 1rem;
}
.field label {
  font-weight: 600;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.field [aria-invalid="true"] {
  border-color: var(--bad);
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.helptext {
  color: var(--muted);
  font-size: 0.875rem;
}
.errorlist {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--bad);
  font-size: 0.9rem;
}
.errorlist.nonfield {
  border: 1px solid var(--bad);
  border-radius: var(--radius);
  padding: 0.75rem var(--space);
  margin-block-end: var(--space);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-block: var(--space);
}
.button--full {
  width: 100%;
}
.button--small {
  min-height: 2.25rem;
  padding: 0.35rem 0.8rem;
}
.inline-form {
  display: inline;
  margin: 0;
}
.link-button {
  background: none;
  border: 0;
  padding: 0.5rem 0;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* Practice pages */
.small {
  font-size: 0.875rem;
}
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-block-end: 0.25rem;
}
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.9rem;
  margin-block-end: var(--space);
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.badge--progress {
  border-color: var(--warn);
  color: var(--warn);
}
.badge--solved {
  border-color: var(--ok);
  color: var(--ok);
}

.progress-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
progress {
  width: 10rem;
  height: 0.6rem;
  accent-color: var(--accent);
}

.track-card h2 {
  margin-block-start: 0;
}

.ticket-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}
.ticket-card {
  display: flex;
  gap: var(--space);
  padding: var(--space);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.ticket-card:hover {
  border-color: var(--accent);
}
.ticket-card__number {
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  font-weight: 700;
}
.ticket-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.ticket-card__title {
  color: var(--accent);
}
.ticket-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

/* The request, shown like an email */
.ticket-message {
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--space);
  margin-block: var(--space);
}
.ticket-message__from {
  color: var(--muted);
  font-size: 0.9rem;
  margin-block-end: 0.5rem;
}
.ticket-message__body > :last-child {
  margin-block-end: 0;
}
.things-to-know ul,
.hints__list {
  padding-inline-start: 1.25rem;
}
.things-to-know li,
.hints__list li {
  margin-block-end: 0.4rem;
}
.tags {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tags li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.9rem;
}

/* Workspace: ticket panel + console. Stacked on phones, side by side on wide screens. */
.workspace {
  display: grid;
  gap: var(--space);
}
/* Let the columns shrink below their content's natural width (a wide
   dropdown or tab row scrolls inside instead of widening the page). */
.workspace > * {
  min-width: 0;
}
.ticket-panel details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem var(--space);
}
.ticket-panel summary {
  cursor: pointer;
  list-style-position: outside;
  min-height: 2.75rem;
}
.ticket-panel__title {
  font-weight: 700;
}
.ticket-panel h2 {
  font-size: 1.05rem;
  margin-block-start: 1.25em;
}
.console-placeholder {
  color: var(--muted);
  text-align: center;
  padding-block: 3rem;
}

@media (min-width: 60rem) {
  .page--wide .container {
    max-width: 80rem;
  }
  .workspace {
    grid-template-columns: minmax(18rem, 24rem) 1fr;
    align-items: start;
  }
  .ticket-panel {
    position: sticky;
    top: var(--space);
  }
}

.button--danger {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* On phones the ticket panel comes first, so offer a shortcut to the console. */
.jump-link {
  display: block;
  margin-block-end: 0.75rem;
  font-weight: 600;
}
@media (min-width: 60rem) {
  .jump-link {
    display: none;
  }
}

/* Submit bar under the console */
.submit-bar {
  margin-block-start: var(--space);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space);
}
.submit-bar h2 {
  font-size: 1.1rem;
  margin-block: 0 0.25rem;
}
.submit-bar .actions {
  margin-block-end: 0;
}

/* Feedback page */
.result-banner {
  border-radius: var(--radius);
  padding: var(--space);
  margin-block: var(--space);
  border: 2px solid var(--border);
  background: var(--surface);
}
.result-banner > :last-child {
  margin-block-end: 0;
}
.result-banner__headline {
  font-size: 1.35rem;
  font-weight: 700;
  margin-block-end: 0.25rem;
}
.result-banner--solved {
  border-color: var(--ok);
}
.result-banner--solved .result-banner__headline {
  color: var(--ok);
}
.result-banner--not-yet {
  border-color: var(--warn);
}
.fb-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space);
  display: grid;
  gap: 0.6rem;
}
.fb-item {
  display: flex;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start-width: 4px;
  border-radius: var(--radius);
  padding: 0.75rem var(--space);
}
.fb-item--fix {
  border-inline-start-color: var(--bad);
}
.fb-item--tip {
  border-inline-start-color: var(--warn);
}
.fb-item--well {
  border-inline-start-color: var(--ok);
}
.fb-item__icon {
  font-weight: 700;
  width: 1.25rem;
  flex: none;
}
.fb-item--fix .fb-item__icon {
  color: var(--bad);
}
.fb-item--well .fb-item__icon {
  color: var(--ok);
}
.fb-item__message {
  margin: 0.2rem 0 0;
}
.lesson {
  border-inline-start: 4px solid var(--accent);
}
.lesson h2 {
  margin-block-start: 0;
}

/* Progress page */
.progress-list {
  padding-inline-start: 1.25rem;
  margin: 0;
}
.progress-item {
  margin-block-end: 0.75rem;
}
.progress-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.progress-item p {
  margin: 0.2rem 0 0;
}

/* Footer, privacy and account pages */
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}
.prose {
  max-width: 42rem;
}
.privacy h2 {
  font-size: 1.15rem;
}
.privacy__summary {
  border-inline-start: 4px solid var(--accent);
}
.privacy__summary ul {
  margin: 0;
  padding-inline-start: 1.25rem;
}
.account-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
}
.account-facts dt {
  color: var(--muted);
}
.account-facts dd {
  margin: 0;
  word-break: break-all;
}
.card--danger {
  border-color: var(--bad);
}
.password-help {
  margin-block-start: var(--space);
}
.password-help summary {
  cursor: pointer;
  min-height: 2.25rem;
  color: var(--accent);
}
/* Tick boxes sit to the start of their label. */
.field--checkbox {
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 0.6rem;
}
.field--checkbox input {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-block-start: 0.15rem;
}
.field--checkbox label {
  font-weight: normal;
}

/* The sign-up trap box: moved off-screen, so people never see or reach it. */
.trap {
  position: absolute;
  inset-inline-start: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
