/*
 * Par timer widget (homepage "New in 4.1" section and /par-timer).
 * Markup is rendered by par-timer.js into any [data-par-timer] element.
 * The dial mirrors the app's par run screen: black STANDBY, orange GO flash,
 * then a light face with an orange comet sweeping the par window.
 */
.pt {
    --pt-ink: #0A0A0A;
    --pt-face: #F4F4F2;
    --pt-accent: #F03A00;
    --pt-muted: #8A8A8A;
    --pt-line: rgba(255, 255, 255, 0.1);
    --pt-ring: clamp(9px, 2.6vw, 13px);
    --p: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    color: #E0E0E0;
    font-family: 'Inter', sans-serif;
}

.pt-rep {
    margin: 0;
    min-height: 1.5em;
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--pt-muted);
}

/* Dial: one big button. Tap to start, tap again to stop. */
.pt-dial {
    position: relative;
    display: block;
    width: min(100%, 400px);
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--pt-face);
    color: var(--pt-ink);
    cursor: pointer;
    font: inherit;
    box-shadow: 0 30px 80px -30px rgba(240, 58, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.pt-dial:focus-visible {
    outline: 3px solid var(--pt-accent);
    outline-offset: 6px;
}

.pt-rail,
.pt-comet {
    position: absolute;
    inset: 6%;
    border-radius: 50%;
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--pt-ring)), #000 calc(100% - var(--pt-ring) + 1px));
    mask: radial-gradient(farthest-side, transparent calc(100% - var(--pt-ring)), #000 calc(100% - var(--pt-ring) + 1px));
}
.pt-rail {
    background: currentColor;
    opacity: 0.12;
}
.pt-comet {
    opacity: 0;
    background: conic-gradient(
        rgba(240, 58, 0, 0) 0turn,
        rgba(240, 58, 0, 0.85) calc(var(--p) * 0.7turn),
        #F03A00 calc(var(--p) * 1turn),
        rgba(240, 58, 0, 0) calc(var(--p) * 1turn + 0.02turn)
    );
}

/* The dart that rides the comet head. */
.pt-hand {
    position: absolute;
    inset: 6%;
    opacity: 0;
    transform: rotate(calc(var(--p) * 360deg));
    pointer-events: none;
}
.pt-hand::before {
    content: '';
    position: absolute;
    top: -1%;
    left: 50%;
    width: 5%;
    height: 11%;
    transform: translateX(-50%);
    background: currentColor;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.pt-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}
.pt-readout {
    font-size: clamp(40px, 11vw, 60px);
    font-weight: 300;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.pt-word {
    display: none;
    font-size: clamp(36px, 10vw, 56px);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}
.pt-sub {
    font-size: 15px;
    font-weight: 500;
    color: inherit;
    opacity: 0.55;
}

/* Phases */
.pt[data-phase="par"] .pt-comet,
.pt[data-phase="par"] .pt-hand,
.pt[data-phase="end"] .pt-comet,
.pt[data-phase="end"] .pt-hand {
    opacity: 1;
}
.pt[data-phase="standby"] .pt-dial {
    background: #000;
    color: #fff;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.pt[data-phase="standby"] .pt-word {
    color: var(--pt-accent);
}
.pt[data-phase="go"] .pt-dial {
    background: var(--pt-accent);
    color: #fff;
    box-shadow: 0 30px 90px -20px rgba(240, 58, 0, 0.7);
}
.pt[data-phase="standby"] .pt-word,
.pt[data-phase="go"] .pt-word,
.pt[data-phase="done"] .pt-word {
    display: block;
}
.pt[data-phase="standby"] .pt-readout,
.pt[data-phase="go"] .pt-readout,
.pt[data-phase="done"] .pt-readout,
.pt[data-phase="go"] .pt-sub,
.pt[data-phase="go"] .pt-rail {
    display: none;
}
.pt[data-phase="done"] .pt-word {
    font-size: clamp(30px, 8vw, 44px);
}

/* Controls */
.pt-controls {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 12px 16px;
    width: min(100%, 400px);
    margin: 0;
}
.pt-controls dt {
    font-size: 14px;
    font-weight: 500;
    color: var(--pt-muted);
}
.pt-controls dd {
    margin: 0;
    justify-self: end;
}
.pt-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--pt-line);
    border-radius: 12px;
    overflow: hidden;
}
.pt-stepper output {
    min-width: 64px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.pt-step,
.pt-seg button {
    min-width: 44px;
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}
.pt-step {
    font-size: 20px;
    font-weight: 400;
}
.pt-step:hover,
.pt-seg button:hover {
    background: rgba(255, 255, 255, 0.06);
}
.pt-seg {
    display: inline-flex;
    border: 1px solid var(--pt-line);
    border-radius: 12px;
    overflow: hidden;
}
.pt-seg button + button {
    border-left: 1px solid var(--pt-line);
}
.pt-seg button[aria-checked="true"] {
    background: #fff;
    color: var(--pt-ink);
    font-weight: 600;
}
.pt-step:focus-visible,
.pt-seg button:focus-visible {
    outline: 2px solid var(--pt-accent);
    outline-offset: -2px;
}
.pt button:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}
.pt-seg button[aria-checked="true"]:disabled {
    opacity: 0.6;
}

.pt-status {
    margin: 0;
    max-width: 400px;
    min-height: 3em;
    font-size: 15px;
    line-height: 1.5;
    text-align: center;
    color: #C8C8C8;
}
.pt-status strong {
    color: #fff;
    font-weight: 600;
}

@media (max-width: 380px) {
    .pt-seg button {
        padding: 0 9px;
        font-size: 14px;
    }
}
