/* ronaldmcqueen.com
 *
 * Theme-aware by tokens: the complete light palette is defined on bare :root,
 * and ONLY the tokens are redefined for dark. No colour gets its sole
 * definition inside a media query — a page whose light theme lives only in
 * @media renders unstyled for anyone whose browser reports no preference.
 *
 * McQueen red #B00000 is the house brand colour and is used as the accent, so
 * this site reads as a sibling of the McQueen Homes properties rather than a
 * stranger.
 */

:root {
  --bg:        #f7f6f4;
  --surface:   #ffffff;
  --surface-2: #f0eeea;
  --text:      #1a1a1a;
  --text-dim:  #5f5c58;
  --border:    #ddd9d3;
  --accent:    #b00000;
  --accent-dim:#8a0000;
  --focus:     #b00000;

  --sev-now:     #c62828;
  --sev-soon:    #e07000;
  --sev-monitor: #b8960b;
  --sev-routine: #2e7d32;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 20px rgba(0,0,0,.05);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #14140f;
    --surface:   #1d1d19;
    --surface-2: #262620;
    --text:      #ece9e3;
    --text-dim:  #a09c94;
    --border:    #34342c;
    --accent:    #ff6b6b;
    --accent-dim:#ff9494;

    --sev-now:     #ff6b6b;
    --sev-soon:    #ffa04d;
    --sev-monitor: #ffd24d;
    --sev-routine: #7bd88f;

    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
  }
}

:root[data-theme="dark"] {
  --bg:        #14140f;
  --surface:   #1d1d19;
  --surface-2: #262620;
  --text:      #ece9e3;
  --text-dim:  #a09c94;
  --border:    #34342c;
  --accent:    #ff6b6b;
  --accent-dim:#ff9494;

  --sev-now:     #ff6b6b;
  --sev-soon:    #ffa04d;
  --sev-monitor: #ffd24d;
  --sev-routine: #7bd88f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 100;
  background: var(--surface);
  padding: .6rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}

.brand {
  font-weight: 650;
  letter-spacing: -.015em;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--text);
}
.brand:hover { color: var(--accent); }

/* ---------- primary nav ----------
 * Items get real affordances: padding, a hover ground, and an ACTIVE state
 * that is a background + weight change, not colour alone. The first version of
 * this bar was three links with three different treatments and no hover — it
 * read as a status line rather than navigation, which is exactly how it was
 * received. */

.topnav {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-right: auto;      /* pushes the user menu to the far right */
  margin-left: 1.5rem;
  font-size: .92rem;
}

.topnav a {
  text-decoration: none;
  color: var(--text-dim);
  padding: .42rem .85rem;
  border-radius: 8px;
  font-weight: 500;
  transition: background .13s ease, color .13s ease;
}
.topnav a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.topnav a.on {
  color: var(--text);
  background: var(--surface-2);
  font-weight: 640;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.topnav .ghost {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
}
.topnav .ghost:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: transparent;
}

/* ---------- user menu (a <details> dropdown, no JS required) ---------- */

.usermenu { position: relative; }

.usermenu summary {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .3rem .7rem .3rem .35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: .9rem;
  color: var(--text);
  list-style: none;        /* kill the default disclosure triangle */
  user-select: none;
  transition: border-color .13s ease, background .13s ease;
}
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { border-color: var(--accent); background: var(--surface-2); }
.usermenu[open] summary { border-color: var(--accent); background: var(--surface-2); }

.usermenu .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .78rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.usermenu .uname { font-weight: 550; }

.usermenu .caret {
  font-size: .7rem;
  color: var(--text-dim);
  transition: transform .15s ease;
}
.usermenu[open] .caret { transform: rotate(180deg); }

.usermenu .menu {
  position: absolute;
  right: 0;
  top: calc(100% + .5rem);
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .35rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.usermenu .menu a {
  display: block;
  padding: .55rem .7rem;
  border-radius: 7px;
  text-decoration: none;
  color: var(--text);
  font-size: .9rem;
  white-space: nowrap;
}
.usermenu .menu a:hover { background: var(--surface-2); }
.usermenu .menu a.on {
  background: var(--surface-2);
  font-weight: 640;
  box-shadow: inset 2px 0 0 var(--accent);
}
.usermenu .menu a.danger { color: var(--accent); }
.usermenu .menu a.danger:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* Narrow screens: the brand and the user menu matter most; the nav wraps
   under them rather than crushing the bar. */
@media (max-width: 560px) {
  .topnav { margin-left: 0; gap: .1rem; font-size: .86rem; }
  .topnav a { padding: .35rem .6rem; }
  .usermenu .uname { display: none; }   /* avatar + caret still read as a menu */
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 4vw, 3rem) 4rem;
}

/* ---------- the public hub ---------- */

.hero { margin-bottom: 2.75rem; }

.hero h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.1;
  letter-spacing: -.03em;
  margin: 0 0 .5rem;
  font-weight: 680;
}

.hero .tag {
  color: var(--text-dim);
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  margin: 0;
  max-width: 44ch;
}

.hero .rule {
  width: 3.5rem;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin: 1.4rem 0 0;
}

.links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.links a {
  display: block;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease;
}
.links a:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.links .label {
  display: block;
  font-weight: 620;
  margin-bottom: .2rem;
}
.links .blurb {
  display: block;
  color: var(--text-dim);
  font-size: .9rem;
  line-height: 1.45;
}
.links .lock {
  display: inline-block;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: .05rem .5rem;
  margin-left: .45rem;
  vertical-align: 2px;
}

/* ---------- login ---------- */

.login-wrap {
  max-width: 380px;
  margin: clamp(1rem, 8vh, 5rem) auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.card h1 {
  margin: 0 0 1.25rem;
  font-size: 1.3rem;
  letter-spacing: -.02em;
}

label {
  display: block;
  font-size: .85rem;
  color: var(--text-dim);
  margin-bottom: .3rem;
}

input[type=text], input[type=password] {
  width: 100%;
  padding: .65rem .75rem;
  margin-bottom: 1rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
}

/* ---------- password field + show/hide eye ---------- */

.password-toggle-wrapper {
  position: relative;
  display: block;
}

/* The input inside a wrapper carries its own margin, and reserves room on the
   right so a long password never runs underneath the eye. */
.password-toggle-wrapper input[type=password],
.password-toggle-wrapper input[type=text] {
  padding-right: 2.9rem;
  margin-bottom: 1rem;
}

.password-toggle-btn {
  /* Reset the site's full-width primary button styling — this is an icon
     button sitting inside a field, not a form action. */
  position: absolute;
  top: .65rem;
  right: .4rem;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color .13s ease, background .13s ease;
}
.password-toggle-btn:hover {
  color: var(--accent);
  background: var(--surface-2);
}

.password-toggle-btn .eye {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

/* Default state: password hidden, so offer the "show" (open eye) icon.
   When toggled visible the button gains .is-visible and the crossed-out eye
   takes over — the icon shows what clicking will DO, which is the convention
   the McQueen Homes version follows too. */
.password-toggle-btn .eye-closed { display: none; }
.password-toggle-btn.is-visible .eye-open { display: none; }
.password-toggle-btn.is-visible .eye-closed { display: block; }
.password-toggle-btn.is-visible { color: var(--accent); }

button {
  width: 100%;
  padding: .7rem 1rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}
button:hover { background: var(--accent-dim); }

.err {
  background: color-mix(in srgb, var(--sev-now) 12%, transparent);
  border: 1px solid var(--sev-now);
  color: var(--text);
  border-radius: 7px;
  padding: .6rem .8rem;
  margin: 0 0 1rem;
  font-size: .9rem;
}

/* ---------- dashboard ---------- */

.page-head { margin-bottom: 2rem; }
.page-head h1 {
  margin: 0 0 .35rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -.025em;
}
.page-head p {
  margin: 0;
  color: var(--text-dim);
}

.agents {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.agents a {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease;
}
.agents a:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.agents .name {
  font-weight: 640;
  font-size: 1.06rem;
  letter-spacing: -.01em;
}
.agents .meta {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--text-dim);
  margin: .15rem 0 .55rem;
}
.agents .purpose {
  color: var(--text-dim);
  font-size: .88rem;
  line-height: 1.45;
  flex: 1;
}

.counts {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-top: .9rem;
  padding-top: .8rem;
  border-top: 1px solid var(--border);
}

.pill {
  font-size: .74rem;
  font-weight: 600;
  padding: .18rem .55rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  white-space: nowrap;
}
.pill.live   { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.pill.empty  { font-weight: 500; font-style: italic; }

/* ---------- ticket board ---------- */

.legend {
  color: var(--text-dim);
  font-size: .85rem;
  margin: 0 0 1rem;
}

.board-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table.board {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  min-width: 860px;
}

table.board th {
  text-align: left;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #fff;
  background: var(--accent);
  padding: .6rem .8rem;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

table.board td {
  padding: .7rem .8rem;
  border-top: 1px solid var(--border);
  vertical-align: top;
}

table.board tr.terminal td { opacity: .58; }
table.board tr.terminal .t-title { text-decoration: line-through; }

.t-ref {
  font-family: var(--mono);
  font-size: .82rem;
  white-space: nowrap;
  font-weight: 600;
}
.t-title { font-weight: 550; }
.t-notes {
  display: block;
  color: var(--text-dim);
  font-size: .84rem;
  margin-top: .3rem;
  line-height: 1.45;
}
.t-sev  { white-space: nowrap; font-size: .95rem; }
.t-next { color: var(--text-dim); font-size: .86rem; max-width: 34ch; }
.t-due  { white-space: nowrap; font-family: var(--mono); font-size: .82rem; }
.t-due.over { color: var(--sev-now); font-weight: 700; }
.t-docs {
  font-family: var(--mono);
  font-size: .74rem;
  word-break: break-all;
}

.paused {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  color: var(--sev-monitor);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: .02rem .45rem;
  margin-left: .35rem;
}

/* ---------- empty state ---------- */

.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  text-align: center;
  color: var(--text-dim);
}
.empty strong { color: var(--text); display: block; margin-bottom: .5rem; }
.empty code {
  font-family: var(--mono);
  font-size: .85rem;
  background: var(--surface-2);
  padding: .12rem .4rem;
  border-radius: 4px;
  color: var(--text);
}

.back {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-size: .88rem;
  text-decoration: none;
}

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--border);
  padding: 1.5rem clamp(1rem, 4vw, 3rem);
  color: var(--text-dim);
  font-size: .85rem;
}
.foot p { margin: 0; }
