/* AnjonIT Tools: global styles shared by every page. */

:root {
	--bg: #f6f7fb;
	--surface: #ffffff;
	--surface-2: #f1f3f8;
	--text: #1c2333;
	--muted: #5b6477;
	--border: #dfe3ec;
	--primary: #2563eb;
	--primary-ink: #ffffff;
	--primary-soft: #e6eeff;
	--success: #15803d;
	--danger: #c0262d;
	--warning: #b45309;
	--radius: 12px;
	--radius-sm: 8px;
	--shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 4px 16px rgba(20, 30, 60, .06);
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0f131c;
		--surface: #171c28;
		--surface-2: #1f2534;
		--text: #e7eaf2;
		--muted: #9aa3b5;
		--border: #2c3345;
		--primary: #5b8cff;
		--primary-ink: #0b1020;
		--primary-soft: #1e2a4a;
		--success: #4ade80;
		--danger: #f87171;
		--warning: #fbbf24;
		--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
		color-scheme: dark;
	}
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.65 var(--font);
}

a { color: var(--primary); }
a:hover { text-decoration-thickness: 2px; }

img { max-width: 100%; height: auto; }

[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.sr-only {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
	position: absolute; left: 16px; top: -60px; z-index: 100;
	background: var(--primary); color: var(--primary-ink);
	padding: 8px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 16px; }

.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; }
.logo-mark { display: block; width: 36px; height: 36px; border-radius: 9px; flex: 0 0 auto; }

.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
	display: block; padding: 8px 12px; border-radius: var(--radius-sm);
	color: var(--muted); text-decoration: none; font-size: .94rem; font-weight: 500;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }

.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); width: 42px; height: 42px; cursor: pointer; }
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
	display: block; width: 18px; height: 2px; background: var(--text); margin: 0 auto; position: relative; content: "";
}
.nav-toggle-bar::before { position: absolute; top: -6px; }
.nav-toggle-bar::after { position: absolute; top: 6px; }

@media (max-width: 900px) {
	.nav-toggle { display: block; }
	.site-nav { display: none; position: absolute; left: 0; right: 0; top: 60px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
	.site-nav.is-open { display: block; }
	.site-nav ul { flex-direction: column; padding: 8px 16px 16px; }
	.site-nav a { padding: 12px; }
}

/* Page */
.main { padding-top: 20px; padding-bottom: 48px; max-width: 920px; }

.breadcrumbs ol { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: .88rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; opacity: .6; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); }

.page-intro { margin-bottom: 20px; }
.page-intro h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.2; margin: 0 0 8px; letter-spacing: -.01em; }
.lead { color: var(--muted); font-size: 1.08rem; margin: 0; max-width: 720px; }

/* Tool card */
.tool {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 20px;
	margin-bottom: 28px;
}
@media (max-width: 600px) { .tool { padding: 14px; } }

.tool-section + .tool-section { margin-top: 18px; }

label, .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: .86rem; font-weight: 400; }

textarea, input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="search"], select {
	width: 100%;
	font: inherit;
	color: var(--text);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 10px 12px;
	transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 200px; resize: vertical; line-height: 1.55; }
textarea.mono, .mono { font-family: var(--mono); font-size: .92rem; }
textarea[readonly] { background: var(--surface-2); }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type="number"] { -moz-appearance: textfield; }

input[type="range"] { width: 100%; accent-color: var(--primary); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 18px; height: 18px; margin: 0; }

.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; cursor: pointer; }

.options { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; margin: 14px 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 8px; }
.field-row > * { flex: 1; }

/* Buttons */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	font: inherit; font-weight: 600; font-size: .92rem;
	padding: 9px 16px; border-radius: var(--radius-sm);
	border: 1px solid var(--border); background: var(--surface); color: var(--text);
	cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { filter: brightness(1.08); color: var(--primary-ink); }
.btn-small { padding: 6px 12px; font-size: .85rem; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Mode chips (case buttons and similar toggles) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip {
	font: inherit; font-size: .9rem; font-weight: 500;
	padding: 7px 13px; border-radius: 999px;
	border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer;
}
.chip:hover { border-color: var(--primary); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 14px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.stat-value { display: block; font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.stat-label { display: block; font-size: .82rem; color: var(--muted); }

.status-line { font-size: .88rem; color: var(--muted); margin-top: 8px; min-height: 1.4em; }
.status-line.is-error { color: var(--danger); }
.status-line.is-ok { color: var(--success); }

/* Result panels */
.result {
	background: var(--primary-soft);
	border-radius: var(--radius);
	padding: 18px;
	margin-top: 16px;
}
.result-main { font-size: clamp(1.6rem, 5vw, 2.2rem); font-weight: 700; line-height: 1.2; word-break: break-word; }
.result-sub { color: var(--muted); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { font-weight: 600; background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

/* Ads */
.ad-slot { margin: 28px 0; text-align: center; min-height: 90px; }
.ad-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.ad-placeholder { display: grid; place-items: center; border: 2px dashed var(--border); border-radius: var(--radius); color: var(--muted); font-size: .85rem; }

/* Article content */
.content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 28px; margin-bottom: 28px; }
@media (max-width: 600px) { .content { padding: 18px 16px; } }
.content h2 { font-size: 1.4rem; line-height: 1.3; margin: 1.6em 0 .5em; }
.content h2:first-child { margin-top: 0; }
.content h3 { font-size: 1.12rem; margin: 1.4em 0 .4em; }
.content p, .content ul, .content ol { margin: 0 0 1em; }
.content li { margin-bottom: .35em; }
.content code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }
.content pre { background: var(--surface-2); padding: 12px 14px; border-radius: var(--radius-sm); overflow-x: auto; font-family: var(--mono); font-size: .9rem; }
.content .table-wrap { margin: 0 0 1.2em; }
.note { background: var(--surface-2); border-left: 4px solid var(--primary); padding: 12px 14px; border-radius: var(--radius-sm); }

/* FAQ */
.faq { margin-bottom: 28px; }
.faq h2, .related h2 { font-size: 1.4rem; margin: 0 0 12px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; }
.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 600; list-style: none; position: relative; padding-right: 40px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.3rem; color: var(--muted); }
.faq details[open] summary::after { content: "\2212"; }
.faq-answer { padding: 0 16px 6px; color: var(--muted); }

/* Tool grids */
.tool-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.tool-card-link {
	display: block; height: 100%; padding: 14px 16px;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
	color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s;
}
.tool-card-link:hover { border-color: var(--primary); transform: translateY(-2px); }
.tool-card-link strong { display: block; margin-bottom: 2px; }
.tool-card-link span { display: block; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.related { margin-bottom: 28px; }

/* Home */
.home-search { max-width: 520px; margin: 18px 0 8px; }
.home-group { margin: 36px 0; }
.home-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.home-group-head h2 { margin: 0; font-size: 1.35rem; }
.home-group-head p { margin: 0; color: var(--muted); flex-basis: 100%; }
.no-results { color: var(--muted); display: none; }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding-top: 36px; font-size: .92rem; }
.footer-inner { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; }
@media (max-width: 900px) { .footer-inner { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-inner { grid-template-columns: 1fr; } }
.footer-about p { color: var(--muted); }
.footer-col h2 { font-size: .95rem; margin: 0 0 8px; }
.footer-col h2 a { color: var(--text); text-decoration: none; }
.footer-col ul, .footer-bottom ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 6px; }
.footer-col a, .footer-bottom a { color: var(--muted); text-decoration: none; }
.footer-col a:hover, .footer-bottom a:hover { color: var(--primary); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--border); margin-top: 28px; padding-top: 16px; padding-bottom: 24px; color: var(--muted); }
.footer-bottom p { margin: 0; }
.footer-bottom ul { display: flex; flex-wrap: wrap; gap: 16px; }

/* Toast */
.toast {
	position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
	background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
	font-size: .92rem; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; }
}
