/* Time Card Calculator. A buff punch-clock card with printed red rules; computed totals in stamp-pad violet.
   Barlow Condensed reads like the printed headings on a time card. */
:root {
  --wall: #e8e2d2;
  --card: #f6ecc9;
  --card-edge: #dccd9c;
  --ink: #23262b;
  --ink-soft: #5b5b55;
  --rule: #c0392b;
  --violet: #4b3f8f;
  --violet-dark: #382f6e;
  --head: "Barlow Condensed", "Arial Narrow", sans-serif;
  --text: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 40rem;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--wall); color: var(--ink); font-family: var(--text); font-size: 1.0625rem; line-height: 1.6; }
a { color: var(--violet); text-underline-offset: 0.18em; }
a:hover { color: var(--violet-dark); }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.wrap { max-width: 58rem; margin: 0 auto; padding: 0 1.25rem; }

.site-header { padding: 1.1rem 0 0.4rem; }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.4rem 1.5rem; }
.brand { font-family: var(--head); font-weight: 700; font-size: 1.5rem; color: var(--ink); text-decoration: none; letter-spacing: 0.01em; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; font-size: 0.97rem; }
.site-nav a { color: var(--ink-soft); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; }

h1 { font-family: var(--head); font-weight: 700; font-size: clamp(2.2rem, 5vw, 3.1rem); line-height: 1.05; margin: 1.5rem 0 0.5rem; }
h2 { font-family: var(--head); font-weight: 700; font-size: 1.7rem; line-height: 1.15; margin: 2.75rem 0 0.75rem; }
.lede { color: var(--ink-soft); max-width: var(--measure); margin: 0 0 1.5rem; font-size: 1.12rem; }
.prose { max-width: var(--measure); }
.prose p, .prose li { margin: 0 0 0.9rem; }

/* The card */
.card { background: var(--card); border: 1px solid var(--card-edge); border-radius: 4px; padding: 1.25rem 1.25rem 1rem; box-shadow: 0 12px 26px -18px rgba(35, 38, 43, 0.55); }
.card-small { max-width: 40rem; }
.card-top { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; margin-bottom: 1rem; }
.card-top label { display: flex; flex-direction: column; font-family: var(--head); font-weight: 500; font-size: 1rem; gap: 0.2rem; flex: 1 1 11rem; }
.card input, .card select { font: inherit; font-family: var(--text); font-size: 1.05rem; padding: 0.45rem 0.55rem; border: 1px solid #b9ab7c; border-radius: 3px; background: #fffbea; color: var(--ink); width: 100%; min-width: 0; }
.card input:focus, .card select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(75, 63, 143, 0.22); }
.money { display: flex; align-items: center; gap: 0.3rem; }

.table-wrap { overflow-x: auto; }
table.punch { width: 100%; border-collapse: collapse; }
.punch th, .punch td { border-bottom: 1px solid var(--rule); padding: 0.35rem 0.4rem; text-align: left; }
.punch thead th { font-family: var(--head); font-weight: 700; font-size: 0.95rem; color: var(--rule); border-bottom: 2px solid var(--rule); white-space: nowrap; }
.punch tbody th { font-family: var(--head); font-weight: 500; font-size: 1.05rem; white-space: nowrap; }
.punch td { min-width: 6.5rem; }
.punch input { padding: 0.35rem 0.45rem; }
.day-total { font-family: var(--head); font-weight: 700; font-size: 1.2rem; color: var(--violet); font-variant-numeric: tabular-nums; min-width: 4.5rem !important; }
tr.bad .day-total { color: var(--rule); font-size: 0.95rem; }

.card-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.btn, .btn-quiet { font: inherit; font-weight: 600; border-radius: 4px; padding: 0.5rem 0.95rem; cursor: pointer; }
.btn { background: var(--violet); color: #fff; border: 0; margin-left: auto; }
.btn:hover { background: var(--violet-dark); }
.btn-quiet { background: transparent; color: var(--ink); border: 1px solid #b9ab7c; }
.btn-quiet:hover { background: #fffbea; }

/* Totals stamped at the bottom of the card */
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0; margin: 0; border-top: 2px solid var(--rule); }
.totals div { padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--card-edge); }
.totals dt { font-family: var(--head); font-size: 0.95rem; color: var(--ink-soft); }
.totals dd { margin: 0; font-family: var(--head); font-weight: 700; font-size: 1.6rem; color: var(--violet); font-variant-numeric: tabular-nums; }
.totals .pay dd { font-size: 1.9rem; }
.hint { color: var(--ink-soft); font-size: 0.92rem; margin: 0.75rem 0 0; }

.stamp { margin: 0.25rem 0 0; font-family: var(--head); font-size: 1.3rem; color: var(--violet); }
.stamp strong { font-size: 2.6rem; font-weight: 700; margin-right: 0.2rem; }
.stamp span { color: var(--ink-soft); font-size: 1.1rem; }
.stamp.is-empty { color: var(--ink-soft); font-size: 1.05rem; }

/* Plain tables */
table { border-collapse: collapse; }
.table-wrap > table:not(.punch), .chart table { width: 100%; background: #fbf8ee; font-size: 0.97rem; }
.table-wrap > table:not(.punch) th, .table-wrap > table:not(.punch) td, .chart th, .chart td { text-align: left; padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--card-edge); }
.table-wrap > table:not(.punch) th, .chart th { font-family: var(--head); font-weight: 700; color: var(--rule); }
.chart { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; margin: 1rem 0; }
table.num td:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }

details { background: #fbf8ee; border-left: 3px solid var(--rule); margin: 0 0 0.6rem; padding: 0.7rem 1rem; max-width: var(--measure); }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 0.6rem 0 0.1rem; }

.site-footer { margin-top: 4rem; padding: 1.5rem 0 2.5rem; border-top: 1px solid var(--card-edge); color: var(--ink-soft); font-size: 0.92rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; }
.site-footer a { color: var(--ink-soft); }

@media (max-width: 640px) { .btn { margin-left: 0; } }

/* Print: just the card, as a timesheet */
@media print {
  body { background: #fff; }
  .site-header, .site-footer, .card-tools, .hint, h2, .prose, details, .lede { display: none !important; }
  .card { box-shadow: none; border: 1px solid #000; background: #fff; }
  .card input, .card select { border: 0; background: none; padding: 0.1rem; }
  h1::after { content: " (week)"; }
}
