/* making-tax-digital-deadlines: the tax-year orrery. Filing tabs for the April you start, a card
   with the dial lying on ruled desk paper, the controls that turn its hand, a readout of what is
   due next, and the calendar file. The tabs, quarters and dial appear only once the script has
   the rules (.on); before that, and without the script, the card shows its table of facts. */

.orrery { margin: 34px 0 18px; }
.orr-tabs { display: flex; align-items: flex-end; gap: 4px; padding: 0 0 0 18px; position: relative; z-index: 1; }
.orrery:not(.on) .orr-tabs, .orrery:not(.on) .orr-kinds { display: none; }
.orr-tab { position: relative; flex: 0 1 auto; min-width: 0; min-height: 52px; margin-bottom: -1px; padding: 9px 22px 9px; border: 0; background: none; color: var(--ink-3); text-align: left; line-height: 1.2; cursor: pointer; isolation: isolate; }
.orr-tab::before { content: ""; position: absolute; inset: 0 -6px; z-index: -1; border: 1px solid var(--rule); border-bottom: 0; border-radius: 7px 7px 0 0; background: var(--wash); transform: perspective(60px) rotateX(5deg); transform-origin: bottom center; transition: background 160ms var(--ease); }
.orr-tab b { display: block; font-family: var(--mono); font-weight: 600; font-size: 15px; letter-spacing: -.01em; color: var(--ink-2); }
.orr-tab span { display: block; font-size: 12px; color: var(--ink-3); }
.orr-tab:hover::before { background: var(--wash-2); }
.orr-tab[aria-pressed="true"] { color: var(--ink); z-index: 2; }
.orr-tab[aria-pressed="true"]::before { background: var(--card); border-color: var(--ink); border-top-width: 3px; }
.orr-tab[aria-pressed="true"] b { color: var(--ink); }
.orr-tab:focus-visible { outline: none; }
.orr-tab:focus-visible::before { box-shadow: 0 0 0 2px var(--link); }

.orr-card { position: relative; background: var(--card); border: 1px solid var(--ink); box-shadow: 0 1px 0 var(--rule), 0 28px 60px -40px rgba(23, 32, 51, .5); }
.orrery:not(.on) .orr-card { border-color: var(--rule); }
.orr-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; padding: 14px 20px 14px; border-bottom: 1px solid var(--rule); }
.orr-title { margin: 0; font-family: var(--cond); font-size: 22px; letter-spacing: -.01em; }
.orr-kinds { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.orr-kind { position: relative; cursor: pointer; }
.orr-kind input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.orr-kind > span { display: block; min-height: 44px; padding: 6px 12px 6px 34px; border: 1px solid var(--rule); background: var(--paper); line-height: 1.2; transition: border-color 160ms var(--ease), background 160ms var(--ease); }
.orr-kind > span::before { content: ""; position: absolute; left: 12px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border: 1.5px solid var(--ink-3); border-radius: 50%; background: var(--card); }
.orr-kind b { display: block; font-size: 14px; font-weight: 600; }
.orr-kind small { display: block; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.orr-kind:hover > span { border-color: var(--ink-3); }
.orr-kind input:checked + span { border-color: var(--ink); background: var(--card); }
.orr-kind input:checked + span::before { border-color: var(--ink); background: radial-gradient(circle, var(--red) 0 3.5px, var(--card) 4px); }
.orr-kind input:focus-visible + span { outline: 2px solid var(--link); outline-offset: 2px; }

/* the dial, lying on ruled paper */
.orr-stage { background: repeating-linear-gradient(0deg, transparent 0 27px, var(--rule-2) 27px 28px), var(--paper); }
.orr-dial { position: relative; padding: 10px 8px 0; outline: none; user-select: none; -webkit-user-select: none; }
.orr-dial canvas { display: block; width: 100%; cursor: grab; touch-action: pan-y pinch-zoom; }
.orr-dial canvas:active { cursor: grabbing; }
.orr-dial:focus-visible { box-shadow: inset 0 0 0 2px var(--link); }
.orr-knob { position: absolute; left: 8px; top: 10px; width: 44px; height: 44px; border-radius: 50%; touch-action: none; cursor: grab; }
.orr-dial:focus-visible .orr-knob { box-shadow: 0 0 0 2px var(--link); }

.orr-turn { display: flex; flex-wrap: wrap; align-items: end; justify-content: center; gap: 10px; padding: 10px 20px 18px; }
.orr-step, .orr-now { min-height: 44px; padding: 8px 14px; border: 1px solid var(--ink); background: var(--card); color: var(--ink); font-family: var(--mono); font-size: 14px; font-weight: 600; cursor: pointer; transition: background 160ms var(--ease), color 160ms var(--ease); }
.orr-step:hover:not(:disabled), .orr-now:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.orr-step:disabled, .orr-now:disabled { opacity: .4; cursor: default; }
.orr-now { border-color: var(--rule); font-family: var(--sans); font-weight: 500; }
.orr-date { display: flex; flex-direction: column; gap: 2px; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.orr-date input { min-height: 44px; padding: 6px 10px; border: 1px solid var(--ink); border-radius: 0; background: var(--card); font-family: var(--mono); font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--ink); }

/* how to read the dial */
.orr-hint { position: absolute; left: 22px; top: 18px; max-width: 15em; margin: 0; font-size: 13px; line-height: 1.4; color: var(--ink-3); pointer-events: none; }
.entry-body .orr-key { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin: 4px 0 0; padding: 0 20px; list-style: none; font-size: 13px; color: var(--ink-3); }
.entry-body .orr-key li { margin: 0; display: flex; align-items: center; gap: 7px; }
.orr-key b { font-family: var(--mono); font-weight: 600; font-size: 12px; color: var(--ink); white-space: nowrap; }
.orr-key i { display: inline-block; width: 20px; height: 8px; }
.orr-key .k-old { background: repeating-linear-gradient(135deg, var(--mute) 0 1.3px, var(--wash) 1.3px 4.2px); }
.orr-key .k-new { background: var(--slate-3); opacity: .75; }
.orr-key .k-sent { background: var(--ink); }
.orr-key .k-send { height: 0; border-top: 2px dotted var(--red); }

/* what the hand says */
.orr-read { border-top: 2px solid var(--ink); background: var(--card); }
.orr-read .k { margin: 0 0 6px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.rd-now { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; padding: 12px 20px; border-bottom: 1px solid var(--rule); font-size: 15px; }
.rd-now .k { margin: 0; }
.rd-now b { font-family: var(--mono); font-weight: 600; font-size: 15px; }
.rd-today { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.rd-ty { color: var(--ink-3); font-size: 14px; }
.rd-pre { margin: 0; padding: 10px 20px; background: var(--wash-2); border-bottom: 1px solid var(--rule); font-size: 15px; color: var(--ink-2); }
.rd-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); }
.rd-grid > section { padding: 16px 20px 18px; font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.rd-grid > section + section { border-left: 1px solid var(--rule); }
.rd-grid p { margin: 0 0 8px; }
.rd-grid p:last-child { margin-bottom: 0; }
.rd-what { font-family: var(--cond); font-weight: 700; font-size: 22px; line-height: 1.1; color: var(--ink); }
.rd-what small { display: block; margin-top: 3px; font-family: var(--sans); font-weight: 400; font-size: 14px; color: var(--ink-3); }
.rd-date { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.rd-date b { font-family: var(--mono); font-weight: 600; font-size: 26px; letter-spacing: -.02em; color: var(--red); line-height: 1.1; }
.rd-ret .rd-date b { font-size: 21px; color: var(--ink); }
.rd-date span { font-size: 14px; color: var(--ink-3); }
.rd-days { font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.rd-send { font-size: 14px; color: var(--ink-3); }
.rd-wk { font-size: 14px; color: var(--red-deep); padding-left: 10px; border-left: 2px solid var(--red); }
.rd-verdict { font-family: var(--cond); font-weight: 700; font-size: 20px; color: var(--ink); }
.rd-ann { font-size: 14px; color: var(--ink-2); padding-top: 8px; border-top: 1px dashed var(--rule); }
.stamp { display: inline-block; margin: 0 4px 2px 0; padding: 1px 6px 0; border: 1.5px solid var(--red); font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.rd-poa { font-size: 13px; color: var(--ink-3); padding-top: 8px; border-top: 1px solid var(--rule-2); }

/* the calendar file */
.orr-ics { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 14px 20px; border-top: 1px solid var(--rule); background: var(--wash-2); }
.orr-ics-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 46px; padding: 10px 16px 10px 14px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-weight: 600; font-size: 15px; cursor: pointer; transition: background 160ms var(--ease); }
.orr-ics-btn::before { content: ""; width: 16px; height: 17px; flex: none; border: 1.5px solid currentColor; border-top-width: 4px; background: linear-gradient(currentColor, currentColor) 50% 62% / 7px 1.5px no-repeat, linear-gradient(currentColor, currentColor) 50% 62% / 1.5px 7px no-repeat; }
.orr-ics-btn:hover:not(:disabled) { background: var(--slate); }
.orr-ics-btn:disabled { opacity: .45; cursor: default; }
.orr-ics-note { flex: 1 1 260px; margin: 0; font-size: 14px; color: var(--ink-2); }

/* the facts the dial shows, printed for everyone */
.orr-facts { margin: 0 !important; padding: 18px 20px 18px; border-top: 1px solid var(--rule); }
.orrery:not(.on) .orr-facts { border-top: 0; }
.orr-facts th[scope="row"] { font-weight: 600; }
.orr-facts small { font-size: 13px; }
.orr-facts-note { margin: 10px 0 0; font-size: 14px; color: var(--ink-3); }

@media (max-width: 900px) {
	.rd-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
	.rd-next { grid-column: 1 / -1; border-bottom: 1px solid var(--rule); }
	.rd-grid > .rd-late { border-left: 0; }
}
@media (max-width: 700px) {
	.orrery { margin-left: -4px; margin-right: -4px; }
	.orr-tabs { padding-left: 6px; gap: 2px; }
	.orr-tab { flex: 1 1 0; padding: 8px 10px 8px; }
	.orr-tab::before { inset: 0 -2px; }
	.orr-tab b { font-size: 14px; }
	.orr-tab span { font-size: 12px; }
	.orr-head { padding: 12px 14px; }
	.orr-kinds { width: 100%; }
	.orr-kind { flex: 1 1 0; min-width: 0; }
	.orr-kind > span { padding: 6px 8px 6px 30px; }
	.orr-kind > span::before { left: 9px; }
	.orr-kind b { font-size: 14px; }
	.orr-kind small { font-family: var(--sans); font-size: 12px; }
	.orr-dial { padding: 10px 0 0; }
	.orr-hint { position: static; max-width: none; padding: 0 14px 8px; text-align: center; font-size: 15px; }
	.entry-body .orr-key { gap: 4px 12px; padding: 0 12px; font-size: 13px; }
	.rd-now, .rd-ty, .rd-pre, .rd-grid > section, .rd-send, .rd-wk, .rd-ann, .rd-poa, .orr-ics-note, .orr-facts-note, .orr-facts small { font-size: 15px; }
	.rd-days { font-size: 14px; }
	.orr-knob { left: 0; }
	.orr-turn { padding: 8px 12px 14px; gap: 8px; }
	.orr-step { flex: 1 1 0; padding: 8px 8px; font-size: 13px; }
	.orr-date { order: -1; flex: 1 1 100%; }
	.orr-date input { width: 100%; }
	.orr-now { flex: 1 1 100%; }
	.rd-now, .rd-pre { padding-left: 14px; padding-right: 14px; }
	.rd-grid { grid-template-columns: minmax(0, 1fr); }
	.rd-grid > section { padding: 14px 14px 16px; }
	.rd-grid > section + section { border-left: 0; border-top: 1px solid var(--rule); }
	.rd-next { border-bottom: 0; }
	.orr-ics { padding: 14px; }
	.orr-ics-btn { width: 100%; justify-content: center; }
	.orr-facts { padding: 14px 14px 16px; }
	.orr-facts .facts-table thead { display: none; }
	.orr-facts .facts-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
	.orr-facts .facts-table th, .orr-facts .facts-table td { padding: 0; border: 0; }
	.orr-facts .facts-table th[scope="row"] { grid-column: 1 / -1; }
	.orr-facts .facts-table td::before { content: attr(data-label); display: block; margin-bottom: 2px; font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
}
@media (max-width: 360px) {
	.orr-tab { padding: 8px 6px; }
	.orr-tab b { font-size: 13px; white-space: nowrap; letter-spacing: -.03em; }
	.orr-tab span { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
	.orr-tab::before, .orr-kind > span, .orr-step, .orr-now, .orr-ics-btn { transition: none; }
}
