/* PayPeriodCalculator: one stylesheet for every page. System fonts only; nothing loads from another site. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --bg-2: #f5f5f7;
  --field-bg: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --border: #86868b;
  --separator: #d2d2d7;
  --accent: #0066cc;
  --accent-fill: #0066cc;
  --accent-fill-hover: #0058b0;
  --on-accent: #ffffff;
  --danger: #d70015;
  --disabled-text: #8e8e93;
  --disabled-fill: #e8e8ed;
  --focus: var(--accent);
  --pad: clamp(0.75rem, 4vw, 1.5rem);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-2: #1c1c1e;
    --field-bg: #1c1c1e;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --border: #8e8e93;
    --separator: #38383a;
    --accent: #2997ff;
    --accent-fill: #0071e3;
    --accent-fill-hover: #0062c4;
    --danger: #ff6961;
    --disabled-text: #636366;
    --disabled-fill: #2c2c2e;
  }
}

[hidden] { display: none !important; }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  scroll-padding-top: 4rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.35;
  overflow-wrap: break-word;
}

h1, h2, p, ul { margin: 0; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: 0.15em; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

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

/* ---------- page column ---------- */

.page,
.site-footer,
.site-header {
  max-width: calc(46rem + 2 * var(--pad));
  margin-inline: auto;
  padding-inline: var(--pad);
}

.page { padding-top: 1rem; padding-bottom: 1rem; }

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.subtitle {
  margin-top: 0.5rem;
  color: var(--text-2);
  font-size: 1.0625rem;
}

h2 { font-size: 1.375rem; font-weight: 600; line-height: 1.25; }

/* ---------- controls ---------- */

input, select, button, textarea {
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 2.75rem;
  padding-inline: 0.5rem;
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: 0.625rem;
}
.field:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.field.invalid { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }

.field input {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  outline: none;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.field input::placeholder { color: var(--text-2); opacity: 1; }

/* The time input fills the field (the whole box is the tap target); its one line is as tall as the box, so the
   value sits in the middle. iOS WebKit otherwise paints the value at the top of a stretched input. */
.field input[type="time"] { line-height: calc(2.75rem - 2px); }
input[type="time"]::-webkit-date-and-time-value { margin: 0; text-align: left; min-height: 1.5em; line-height: calc(2.75rem - 2px); }
input[type="time"]::-webkit-calendar-picker-indicator { display: none; }

.ph {
  position: absolute;
  inset: 0 0.5rem;
  display: flex;
  align-items: center;
  background: var(--field-bg);
  color: var(--text-2);
  pointer-events: none;
  visibility: hidden;
  white-space: nowrap;
  overflow: hidden;
}
.field.is-empty:not(:focus-within) .ph { visibility: visible; }

.suffix, .prefix { flex: none; color: var(--text-2); }
.suffix { margin-left: 0.25rem; }
.prefix { margin-right: 0.25rem; }
.field input:placeholder-shown + .suffix { visibility: hidden; }

.select { position: relative; display: inline-flex; min-width: 0; max-width: 100%; }
.select select {
  max-width: 100%;
  min-width: 0;
  height: 2.75rem;
  padding: 0 1.75rem 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: var(--field-bg);
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.select::after {
  content: "";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--text-2);
  border-bottom: 2px solid var(--text-2);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.btn {
  min-height: 3rem;
  min-width: 0;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover:not(:disabled), .btn:active:not(:disabled) { background: var(--bg-2); }
.btn-danger { color: var(--danger); }
.btn:disabled { border-color: var(--separator); color: var(--disabled-text); cursor: default; }
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-inline: 1.25rem;
  text-decoration: none;
}
.btn-filled { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.btn-filled:hover, .btn-filled:active { background: var(--accent-fill-hover); }

/* ---------- settings ---------- */

.calculator { margin-top: 1.5rem; }

.settings { border-top: 1px solid var(--separator); border-bottom: 1px solid var(--separator); }
.setting {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.375rem 0.5rem;
  padding-block: 0.375rem;
  min-height: 3.5rem;
}
.setting + .setting { border-top: 1px solid var(--separator); }

/* ---------- weeks ---------- */

.week { margin-top: 1.5rem; }

.week-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  column-gap: 0.5rem;
  margin-inline: calc(-1 * var(--pad));
  padding: 0.5rem var(--pad);
  background: var(--bg-2);
  border-bottom: 1px solid var(--separator);
  font-variant-numeric: tabular-nums;
}
.wh-title { font-size: 1.0625rem; font-weight: 600; line-height: 1.35; }
.wh-range, .wh-period { color: var(--text-2); font-size: 0.9375rem; }
.wh-right { text-align: right; margin-left: auto; }
.wh-total { font-weight: 600; }

.break-all {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-block: 0.75rem;
}
.ba-text { display: flex; flex-direction: column; font-size: 0.9375rem; }
.ba-hint { color: var(--text-2); }
.ba-buttons { display: flex; align-items: center; gap: 0.375rem; }
.ba-unit { color: var(--text-2); font-size: 0.9375rem; margin-left: 0.125rem; }
.preset {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.preset[aria-pressed="true"] { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }

/* Day row: phone layout (300-767 px) is two lines; result on line 1, fields on line 2. */
.day {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 3.5rem 2.75rem;
  grid-template-areas:
    "day note tag hours clear"
    "fields fields fields fields fields";
  column-gap: 0.5rem;
  row-gap: 0.25rem;
  align-items: center;
  padding-block: 0.375rem;
  border-top: 1px solid var(--separator);
}
.day-label { grid-area: day; font-weight: 600; min-width: 2.25rem; }
.fields { grid-area: fields; display: flex; flex-wrap: wrap; gap: 0.5rem; min-width: 0; }
.f-time { flex: 1 1 5.75rem; }
.f-break { flex: 0 0 5rem; }
.note { grid-area: note; min-width: 0; color: var(--text-2); font-size: 0.8125rem; line-height: 1.25; }
.note.is-error { color: var(--danger); }
.tag { grid-area: tag; color: var(--text-2); font-size: 0.8125rem; white-space: nowrap; }
.hours {
  grid-area: hours;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.h-vis.is-dash { color: var(--text-2); font-weight: 400; }

.clear {
  grid-area: clear;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  visibility: hidden;
}
.day.has-time .clear { visibility: visible; }
.x {
  position: relative;
  display: block;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  background: var(--text-2);
}
.x::before, .x::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.75rem;
  height: 2px;
  margin: -1px 0 0 -0.375rem;
  background: var(--bg);
  transform: rotate(45deg);
}
.x::after { transform: rotate(-45deg); }

@media (forced-colors: active) {
  .x { forced-color-adjust: none; background: CanvasText; }
  .x::before, .x::after { background: Canvas; }
}

/* ---------- rate ---------- */

.rate-row { margin-top: 1.5rem; border-top: 1px solid var(--separator); border-bottom: 1px solid var(--separator); padding-top: 0.375rem; }
.rate-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.375rem 0.5rem;
}
.f-rate { flex: 0 1 11rem; }
.msg { min-height: 1.6rem; padding-block: 0.25rem; color: var(--danger); font-size: 0.9375rem; }

/* ---------- results ---------- */

.results {
  margin-top: 2rem;
  padding: 1rem;
  border-radius: 0.75rem;
  background: var(--bg-2);
  font-variant-numeric: tabular-nums;
}
.r-hours { max-width: 28rem; }
.r-total { margin-top: 0.5rem; font-size: 2.125rem; font-weight: 700; line-height: 1.1; }
.r-total-dec, .r-rounding, .r-sub, .r-dec, .r-note, .r-empty { color: var(--text-2); font-size: 0.9375rem; }
.r-empty, .r-leftout, .r-rounding { margin-top: 0.5rem; }
.r-leftout { font-size: 0.9375rem; }
.r-group, .r-pay { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--separator); }
.r-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  column-gap: 0.5rem;
}
.r-line + .r-line, .r-sub + .r-line { margin-top: 0.25rem; }
.r-val { white-space: nowrap; font-weight: 600; }
/* The decimal hours take a fixed width, right-aligned, so the h:mm figures beside them share one right edge.
   9ch holds the widest possible value, "336.00 hrs" (14 days of 24 hours). */
.r-dec { display: inline-block; min-width: 9ch; margin-left: 0.25rem; font-weight: 400; text-align: right; }
.r-gross { margin-top: 0.5rem; font-weight: 700; }
.r-gross .r-val { font-weight: 700; }
.r-note { margin-top: 0.5rem; }
.r-noscript { margin-top: 0.75rem; }

/* ---------- actions ---------- */

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.save-line {
  min-height: 2.7em;
  margin-top: 0.5rem;
  color: var(--text-2);
  font-size: 0.9375rem;
  visibility: hidden;
}
.save-line.is-shown { visibility: visible; }

.copy-box { margin-top: 0.5rem; }
.copy-box label { display: block; margin-bottom: 0.375rem; font-weight: 600; }
.copy-box textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: var(--field-bg);
  font-size: 1.0625rem;
  resize: vertical;
}

.ad-slot:empty { display: none; }

/* ---------- prose, FAQ ---------- */

.prose { max-width: 40rem; line-height: 1.5; overflow-wrap: anywhere; }
.prose h2 { margin-top: 2rem; margin-bottom: 0.75rem; }
.prose p + p, .prose p + ul, .prose ul + p { margin-top: 0.75rem; }
.prose ul { padding-left: 1.25rem; }
.prose li + li { margin-top: 0.5rem; }
.explain { margin-top: 1.5rem; }

.faq details { border-bottom: 1px solid var(--separator); }
.faq details:first-of-type { border-top: 1px solid var(--separator); }
.faq summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.625rem 2rem 0.625rem 0;
  font-weight: 600;
  line-height: 1.35;
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 0.5rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--text-2);
  border-bottom: 2px solid var(--text-2);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.15s;
}
.faq details[open] > summary::after { transform: translateY(-30%) rotate(225deg); }
.faq details p { padding-bottom: 1rem; }

@media (prefers-reduced-motion: reduce) {
  .faq summary::after { transition: none; }
}

/* ---------- other pages ---------- */

.site-header { padding-top: 0.25rem; }
.home-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.doc { padding-top: 0.5rem; }
.doc h1 { margin-bottom: 0.5rem; }
.updated { color: var(--text-2); font-size: 0.9375rem; }
.doc .lead { margin-top: 1rem; }
.notfound p { margin-top: 0.75rem; }
.notfound .btn { margin-top: 1.5rem; }

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

.site-footer {
  margin-top: 2rem;
  padding-bottom: 2rem;
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}
.site-footer nav { border-top: 1px solid var(--separator); }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.5rem;
  margin-inline: -0.5rem;
  padding: 0;
  list-style: none;
}
.footer-links a { display: inline-block; min-width: 2.75rem; padding: 0.75rem 0.5rem; text-align: center; }
.footer-links a[aria-current="page"] { color: var(--text); }
.copyright { color: var(--text-2); }

/* ---------- narrow screens ---------- */

@media (max-width: 359px) {
  .field input, .select select { font-size: 1rem; }
}

/* Below 300 px (a phone zoomed to 150 % or more): note and tag get their own line, one field per line. */
@media (max-width: 299px) {
  .day {
    grid-template-columns: auto minmax(0, 1fr) 3.5rem 2.75rem;
    grid-template-areas:
      "day . hours clear"
      "tag note note note"
      "fields fields fields fields";
  }
  .fields > .field { flex: 1 1 100%; }
  .actions { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- wider screens ---------- */

@media (min-width: 480px) {
  .actions { grid-template-columns: 8.5rem 8.5rem minmax(0, 1fr); }
  #btn-clear { justify-self: end; width: 8.5rem; }
  .save-line { min-height: 1.35em; }
}

@media (min-width: 768px) {
  h1 { font-size: 2.5rem; }
  .page { padding-top: 2rem; }
  /* One left edge: each day's end-time field starts exactly where the settings, preset and rate controls do.
     The day-name column takes up the difference (label column - column gap - start field - field gap), so the
     13.5rem label column keeps "Same unpaid break every day" clear of the 0 button. */
  :root {
    --label-col: 13.5rem;
    --day-gap: 0.75rem;
    --time-w: 8rem;
    --fields-gap: 0.5rem;
    --day-col: calc(var(--label-col) - var(--day-gap) - var(--time-w) - var(--fields-gap));
  }
  .setting, .rate-line, .break-all { justify-content: flex-start; column-gap: 0; }
  .setting > label, .rate-line > label, .ba-text { flex: 0 0 var(--label-col); }
  .week { margin-top: 2rem; }
  .week-head { margin-inline: 0; border-radius: 0.625rem; border-bottom: 0; }
  .day {
    grid-template-columns: var(--day-col) 22rem minmax(0, 1fr) auto 3.5rem 2.75rem;
    grid-template-areas: "day fields note tag hours clear";
    column-gap: var(--day-gap);
  }
  .fields { gap: var(--fields-gap); }
  .f-time { flex: 0 0 var(--time-w); }
  input[type="time"]::-webkit-calendar-picker-indicator { display: block; margin-left: 0.25rem; }
  .f-rate { flex: 0 0 9rem; }
  .results { margin-top: 2.5rem; padding: 1.5rem; }
  .results.has-pay .r-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; }
  .results.has-pay .r-pay { margin-top: 0.5rem; padding-top: 0; border-top: 0; }
  .prose h2 { margin-top: 3rem; }
}

/* ---------- print ---------- */

@media screen {
  .print-sheet { display: none; }
}

@media print {
  :root { color-scheme: light; }
  * { color: #000 !important; background: #fff !important; box-shadow: none !important; }
  @page { margin: 12mm; }
  body { font-size: 10.5pt; line-height: 1.35; }
  body.home > *:not(.print-sheet) { display: none !important; }
  .site-footer { display: none !important; }
  a { text-decoration: none; }
  .print-sheet { display: block; }
  .ps-title { font-size: 13pt; font-weight: 700; }
  .ps-meta, .ps-line, .ps-summary, .ps-pay, .ps-note, .ps-leftout, .ps-foot { margin-top: 6pt; }
  .ps-line { white-space: pre-wrap; }
  .ps-sign { margin-top: 18pt; }
  .ps-table { width: 100%; margin-top: 8pt; border-collapse: collapse; font-variant-numeric: tabular-nums; }
  .ps-table th, .ps-table td { padding: 2pt 4pt; border: 0.75pt solid #000; text-align: left; font-weight: 400; }
  .ps-table thead th { font-weight: 700; }
  .ps-table tbody { break-inside: avoid; }
  .ps-week th { font-weight: 700; }
  .ps-total td { font-weight: 700; }
  .ps-table .ps-num { text-align: right; }
  .ps-table .ps-time, .ps-table .ps-num { white-space: nowrap; }
}

/* About, Terms, Privacy: the page column stays aligned with the header and footer; text keeps a 40rem measure. */
.page.prose { max-width: calc(46rem + 2 * var(--pad)); }
.page.prose > * { max-width: 40rem; }
