/* Tools: loaded after /styles.css and uses its colour tokens. */

.tool { padding: 28px 0 56px; }
@media (min-width: 900px) { .tool { padding: 56px 0 96px; } }
.tool .wrap { max-width: 980px; display: flex; flex-direction: column; gap: 24px; }
.tool-head { display: flex; flex-direction: column; gap: 14px; }
.tool-head .back { margin-bottom: 0; }
.tool-head h1 { font-size: clamp(32px, 4.4vw, 52px); line-height: 1.1; letter-spacing: -0.02em; }
.tool-head .lede { font-size: 18px; line-height: 1.55; color: var(--muted); max-width: 660px; }
@media (min-width: 900px) { .tool-head .lede { font-size: 20px; } }

.card { background: var(--panel); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 900px) { .card { padding: 28px 32px; gap: 20px; } }
.card h2 { font-size: 18px; font-weight: 600; }

.fields { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) {
  .fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields.three { grid-template-columns: 1.6fr 1.2fr 0.8fr; }
}
.tool label { display: flex; flex-direction: column; gap: 6px; font-family: var(--heading); font-weight: 500; font-size: 14px; color: var(--muted); }
.tool input, .tool select {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font-family: var(--body); font-size: 17px;
}
.tool input:hover, .tool select:hover { border-color: var(--edge); }
.tool input.big { min-height: 56px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 19px; }
.tool ::placeholder { color: var(--faint); opacity: 1; }

.actions-row { display: flex; flex-wrap: wrap; gap: 10px; }
.tool .btn-ghost { background: transparent; }
.btn-sm { min-height: 44px; padding: 0 18px; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips span { font-size: 14px; color: var(--faint); }
.chip {
  min-height: 36px; padding: 0 12px; border: 0; border-radius: 9px; cursor: pointer;
  background: var(--line-2); color: var(--text); font-family: var(--heading); font-weight: 500; font-size: 13px;
}
.chip:hover { background: var(--edge); }

.clock { font-size: 15px; color: var(--muted); }
.clock code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.clock code { color: var(--tile-1); font-size: 17px; }

/* Method switch (two radio buttons drawn as one control) */
fieldset.method { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 8px; }
fieldset.method legend { float: left; padding: 0; font-family: var(--heading); font-weight: 500; font-size: 14px; color: var(--muted); }
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--panel); }
.tool .segmented label { position: relative; display: block; font-size: 15px; color: var(--muted); }
.tool .segmented input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.segmented span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; padding: 8px 12px; border-radius: 10px; line-height: 1.25; text-align: center; }
.segmented small { font-family: var(--body); font-weight: 400; font-size: 13px; color: var(--faint); }
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--line-2); color: var(--text); }
.segmented input:checked + span small { color: var(--text-soft); }
.segmented input:focus-visible + span { outline: 3px solid var(--tile-1); outline-offset: 2px; }
@media (min-width: 700px) {
  fieldset.method { grid-template-columns: auto auto; justify-content: start; align-items: center; gap: 14px; }
  .segmented span { flex-direction: row; gap: 6px; min-height: 44px; padding: 11px 16px; }
}

.note { font-size: 15px; line-height: 1.5; color: var(--muted); border-left: 3px solid var(--tile-3); padding: 2px 0 2px 14px; }
.note.warn { border-color: var(--accent); color: var(--text-soft); }
.error { font-size: 16px; color: #ffb4a8; }

/* Result rows */
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-2); }
.row:first-child { border-top: 0; padding-top: 0; }
.row .k { grid-column: 1 / -1; font-family: var(--heading); font-weight: 600; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.row .v { min-width: 0; font-size: 17px; line-height: 1.45; overflow-wrap: anywhere; color: var(--text); }
.row .v.mono { font-size: 16px; }
.row .copy { height: 40px; padding: 0 12px; font-size: 13px; }
.row .copy:disabled { opacity: 0.5; cursor: default; }
@media (min-width: 700px) {
  .row { grid-template-columns: 190px minmax(0, 1fr) auto; gap: 16px; }
  .row .k { grid-column: auto; font-size: 13px; }
}

/* Big Tamil date */
.big-date { display: flex; flex-direction: column; gap: 6px; }
.big-date .ta { font-family: var(--heading); font-weight: 700; font-size: clamp(34px, 6vw, 56px); line-height: 1.15; letter-spacing: -0.01em; }
.big-date .en { font-family: var(--heading); font-weight: 600; font-size: clamp(18px, 2.4vw, 24px); color: var(--tile-1); }
.big-date .sub { font-size: 18px; color: var(--text-soft); }
.big-date + .rows { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }

/* Month table */
.table-scroll { position: relative; overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.months { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 15px; }
.months th { text-align: left; font-family: var(--heading); font-weight: 600; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); padding: 0 12px 10px 0; white-space: nowrap; }
.months td { padding: 10px 12px 10px 0; border-top: 1px solid var(--line-2); vertical-align: top; color: var(--text-soft); }
.months td:first-child { color: var(--text); white-space: nowrap; }
.months .flag { color: var(--accent); }
.months .same { color: var(--faint); }
.months .differs { color: var(--tile-1); font-weight: 500; }

/* Reading text */
.prose { display: flex; flex-direction: column; gap: 12px; padding: 0; }
.prose h2 { font-size: 22px; font-weight: 600; margin-top: 12px; }
.prose p, .prose li { font-size: 17px; line-height: 1.7; color: var(--text-soft); }
.prose ul, .prose ol { margin: 0; padding-left: 24px; display: flex; flex-direction: column; gap: 6px; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; color: var(--tile-1); }
pre.code {
  margin: 0; padding: 14px 16px; border-radius: 12px; overflow-x: auto;
  background: var(--panel-2); border: 1px solid var(--line-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.6; color: var(--text-soft);
}
.code-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.code-grid > div { min-width: 0; }
@media (min-width: 700px) { .code-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.code-grid h3 { font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }

/* Tools index */
.tool-list { display: grid; gap: 16px; }
@media (min-width: 800px) { .tool-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; } }
a.tool-card {
  display: flex; flex-direction: column; gap: 10px; padding: 24px; border-radius: 18px;
  background: var(--panel); color: var(--text); text-decoration: none;
  transition: background-color 0.15s ease;
}
a.tool-card:hover { background: var(--panel-2); color: var(--text); }
a.tool-card h2 { font-size: 22px; }
a.tool-card p { font-size: 17px; line-height: 1.55; color: var(--muted); }
a.tool-card .go { margin-top: 4px; font-family: var(--heading); font-weight: 600; font-size: 15px; color: var(--tile-1); }
