/* Watchorn Electric hours app. Same palette and type as the public site: black, white and grey only. */

:root {
  --bg: #000;
  --field-bg: #0a0a0a;
  --text: #f0f0f0;      /* 18.4:1 */
  --text-2: #b4b4b4;    /* 10.1:1 */
  --text-3: #8f8f8f;    /*  6.5:1 */
  --line: #636363;      /* field borders, >= 3:1 */
  --rule: #262626;      /* decorative hairline only */
  --gutter: clamp(1.25rem, 5vw, 2rem);
  --col: 30rem;
  --font: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

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

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 4.5rem; /* keeps focused fields clear of the sticky eyebrow */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

main { flex: 1 0 auto; }

::selection { background: var(--text); color: #000; }

.col {
  width: 100%;
  max-width: calc(var(--col) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.col.wide { --col: 44rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

a { color: inherit; }

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

h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

.noscript { padding: 4rem var(--gutter); color: var(--text-2); }

/* ---------- Eyebrow (sticky) ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-inline: var(--gutter);
  background: var(--bg);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 64rem;
  margin-inline: auto;
  padding-block: 0.25rem;
  border-bottom: 1px solid var(--rule);
}

.bar-mark {
  display: block;
  flex: none;
  width: 2.75rem;
  height: auto;
  aspect-ratio: 780 / 466.8;
}

.bar-user {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  min-width: 0;
}
.bar-name {
  overflow: hidden;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- Front door (log in, first-run setup) ---------- */

.front { padding-block: clamp(3rem, 2rem + 6vw, 6rem) 2rem; }

.brand { margin-bottom: clamp(2.25rem, 1.75rem + 2vw, 3rem); }

.mark {
  display: block;
  width: clamp(8rem, 6rem + 8vw, 11rem);
  height: auto;
  aspect-ratio: 780 / 466.8;
  margin: 0 auto;
}

/* wordmark: heavy italic to echo the WE mark */
.name {
  margin-top: clamp(1.25rem, 1rem + 0.75vw, 1.75rem);
  font-family: "Saira", var(--font);
  font-size: clamp(1.375rem, 0.9rem + 1.25vw, 2.125rem);
  font-style: italic;
  font-weight: 900;
  font-stretch: 118%;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

/* sub-line in the wordmark's face, quieter */
.scope {
  margin-top: 0.5rem;
  font-family: "Saira", var(--font);
  font-size: clamp(0.8125rem, 0.72rem + 0.35vw, 0.9375rem);
  font-style: italic;
  font-weight: 900;
  font-stretch: 118%;
  line-height: 1.4;
  letter-spacing: 0.14em;
  padding-left: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* ---------- Headings and text ---------- */

.title {
  margin: clamp(2.25rem, 1.75rem + 2vw, 3rem) 0 1.75rem;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.front .title { margin-top: 0; }

.lede {
  margin: -0.75rem 0 1.75rem;
  color: var(--text-2);
  text-wrap: balance;
}

.rule {
  width: 100%;
  height: 1px;
  margin: clamp(2.75rem, 2.25rem + 2.5vw, 4rem) 0 0;
  border: 0;
  background: var(--rule);
}

/* tracked caps, used for labels and small headings */
.caps,
label,
.link,
.tab,
.week-head {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}

.empty {
  padding-block: 2rem;
  color: var(--text-3);
}

/* ---------- Forms ---------- */

form,
.pair {
  display: grid;
  gap: 1.375rem;
  text-align: left;
}

/* date and hours side by side; the date needs the wider share on small phones */
.pair { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.375rem 1rem; }

.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; min-width: 0; }

label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
label .opt { font-weight: 400; letter-spacing: 0.12em; text-align: right; }

::placeholder { color: var(--text-3); opacity: 1; }

input,
textarea,
select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 3rem;
  margin: 0;
  padding: 0.75rem 0.875rem;
  font: inherit;
  font-size: 1rem; /* 16px keeps iPhones from zooming in on focus */
  line-height: 1.5;
  color: var(--text);
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease;
}
textarea { min-height: 7.5rem; resize: vertical; }

input[type="date"] { text-align: left; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }

/* a drawn chevron, since appearance: none removes the native one */
select {
  padding-right: 2.5rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-2) 50%),
    linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 1.25rem) 50%, calc(100% - 0.9375rem) 50%;
  background-size: 0.3125rem 0.3125rem;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: 0;
  border-color: var(--text);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 100px var(--field-bg) inset;
  transition: background-color 600000s 0s;
}

button {
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.btn {
  width: 100%;
  min-height: 3.25rem;
  margin-top: 0.625rem;
  padding: 0 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  border: 1px solid var(--text-2);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn:focus-visible { outline-offset: 3px; }
.btn.quiet {
  min-height: 3rem;
  margin-top: 0;
  color: var(--text-2);
  border-color: var(--line);
}
[aria-disabled="true"] { cursor: progress; opacity: 0.55; }

/* text button: small tracked caps with a generous tap area */
.link {
  display: inline-block;
  padding: 0.75rem 0;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.2s ease;
}
.link.strong { color: var(--text); }

/* hover only where a real pointer hovers, so taps don't leave elements stuck */
@media (hover: hover) {
  input:hover,
  textarea:hover,
  select:hover { border-color: #808080; }
  .btn:not([aria-disabled="true"]):hover { background: var(--text); border-color: var(--text); color: #000; }
  .link:hover,
  .tab:hover { color: var(--text); }
}

.status {
  min-height: 1.6em;
  font-size: 0.9375rem;
  text-align: center;
  color: var(--text);
  text-wrap: balance;
}

/* the status line sits tight under its button, and the secondary actions tight under that */
form .status { margin-top: -0.5rem; }

.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 1.5rem;
  min-height: 2.75rem;
  margin-top: -1.125rem;
  text-align: center;
}

.confirm {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 1.25rem;
}
.confirm-note {
  flex-basis: 100%;
  font-size: 0.9375rem;
  color: var(--text-2);
}

/* ---------- Tabs (master) ---------- */

.tabs {
  display: flex;
  justify-content: center;
  gap: 2.25rem;
  margin: 0.5rem max(var(--gutter), calc((100% - 64rem) / 2)) 0; /* lines up with the eyebrow's rule */
  border-bottom: 1px solid var(--rule);
}
.tab {
  margin-bottom: -1px;
  padding: 1rem 0.125rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease;
}
.tab[aria-current="true"] { color: var(--text); border-bottom-color: var(--text); }

/* ---------- Hours lists ---------- */

.weeks { text-align: left; }
.status + .weeks,
.editor + .weeks { margin-top: 1rem; }

.week { margin-top: 2.25rem; }
.week:first-child { margin-top: 0; }

.week-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--rule);
}
.week-head .sum {
  color: var(--text);
  letter-spacing: 0.06em;
  text-transform: none;
  white-space: nowrap;
}

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.125rem 1rem;
  padding: 0.875rem 0 0.25rem;
  border-bottom: 1px solid var(--rule);
}
.entry .when { font-weight: 500; overflow-wrap: anywhere; }
.entry .hrs { font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry.fixed { padding-bottom: 0.875rem; } /* no Edit button to supply the bottom space */
.entry .what { min-width: 0; }
.entry.fixed .what { grid-column: 1 / -1; }
.entry .note {
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.entry .link { align-self: end; justify-self: end; }
.tag {
  margin-top: 0.25rem;
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.more { margin-top: 2rem; }

/* ---------- Master: filters, totals, people ---------- */

.filters {
  display: grid;
  gap: 1.375rem 1rem;
  margin-top: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  text-align: left;
}
@media (min-width: 36em) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.totals {
  width: 100%;
  margin-top: 2.25rem;
  border-collapse: collapse;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.totals th,
.totals td {
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--rule);
  font-weight: 400;
}
.totals thead th {
  padding-top: 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}
.totals th:first-child { overflow-wrap: anywhere; }
.totals .num { padding-left: 1rem; text-align: right; white-space: nowrap; }
.totals tfoot th,
.totals tfoot td { font-weight: 500; border-bottom: 0; }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1.5rem;
  margin-top: 1rem;
}

.editor {
  margin-top: 1.5rem;
  padding: 1.5rem 0 0.5rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 4.5rem;
}
.editor .title { margin-top: 0; text-align: center; }

.static { color: var(--text); }

.people { text-align: left; }
.person {
  padding: 0.875rem 0 0.25rem;
  border-bottom: 1px solid var(--rule);
}
.person .who { font-weight: 500; overflow-wrap: anywhere; }
.person .user { color: var(--text-2); overflow-wrap: anywhere; }
.person .row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.5rem;
}
.person form { margin: 0.5rem 0 0.75rem; }
.person .confirm { justify-content: flex-start; }
.person .confirm-note { margin-top: 0.5rem; }

/* ---------- Footer ---------- */

footer {
  padding: clamp(3.5rem, 3rem + 3vw, 5.5rem) 0 2.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
footer form { margin: 1rem 0 2rem; font-size: 1rem; letter-spacing: normal; }

.tip { margin: 0.25rem 0 1.5rem; }
.tip summary {
  display: inline-block;
  padding: 0.75rem 0;
  cursor: pointer;
  list-style: none;
}
.tip summary::-webkit-details-marker { display: none; }
.tip p {
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  letter-spacing: normal;
  color: var(--text-2);
  text-wrap: balance;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
