/* =========================================================
   AntiCapt — visual identity
  ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Red+Hat+Text:wght@400;500;600;700&family=Red+Hat+Display:wght@600;700;800&display=swap');

:root {
	--bg: #F6F8FB;
	--panel: #FFFFFF;
	--ink: #101B33;
	--muted: #5B6478;
	--line: #E1E6F0;

	--navy: #0B1730;
	--blue: #2F86D6;
	--blue-deep: #1F5FA8;
	--purple: #6A2FB0;
	--purple-deep: #4E2085;

	--accent: #2F86D6;
	--mint: #6A2FB0;
	--mint-text: #4E2085;
	--accent-2: #4E2085;
	--danger: #B23A3A;
	--success: #1F5FA8;

	--font-display: 'Red Hat Display', 'Red Hat Text', -apple-system, BlinkMacSystemFont, sans-serif;
	--font-body: 'Red Hat Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

	--radius: 6px;
	--maxw: 1160px;
}

[data-theme="dark"] {
	--bg: #0F1620;
	--panel: #17202C;
	--ink: #E8ECF3;
	--muted: #93A1B8;
	--line: #2B3646;

	--accent: #4A9AE8;
	--blue-deep: #2F86D6;
	--mint: #8A5CD6;
	--mint-text: #B79CE8;
	--accent-2: #B79CE8;
	--danger: #E07A7A;
	--success: #4A9AE8;
}

[data-theme="dark"] .hero-visual img,
[data-theme="dark"] .applications-figure,
[data-theme="dark"] .workflow-figure {
	filter: brightness(0.92);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

html, body { height: 100%; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

main { flex: 1 0 auto; width: 100%; }

a { color: var(--accent); }
a:hover { color: var(--accent-2); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

code, .mono { font-family: var(--font-mono); }

/* ---------- Header / footer ---------- */

.site-header {
	border-bottom: 1px solid var(--blue-deep);
	background: var(--accent);
}
.site-header .wrap {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 68px;
}

.logo {
	font-family: var(--font-display);
	font-weight: 900;
	font-size: 1.6em;
	color: #ffffff;
	text-decoration: none;
}
.logo-apt { color: #A9D6FF; }
.logo-apt-hero { color: var(--accent); }

nav.main-nav { display: flex; gap: 4px; }
nav.main-nav a {
	font-family: var(--font-body);
	font-weight: 700;
	font-size: 1.08em;
	color: rgba(255,255,255,0.88);
	text-decoration: none;
	padding: 8px 4px;
	margin: 0 8px;
	position: relative;
}
nav.main-nav a::after {
	content: "";
	position: absolute;
	left: 0;
	right: 100%;
	bottom: -2px;
	height: 2px;
	background: #ffffff;
	transition: right 0.2s ease;
}
nav.main-nav a:hover, nav.main-nav a.current {
	color: #ffffff;
}
nav.main-nav a:hover::after, nav.main-nav a.current::after {
	right: 0;
}

/* ---------- Nav dropdown (Predict/Design/Scan -> Main/Alternate) ---------- */

.nav-dropdown {
	position: relative;
	margin: 0 8px;
}
.nav-dropdown summary {
	list-style: none;
	cursor: pointer;
	font-family: var(--font-body);
	font-weight: 700;
	font-size: 1.08em;
	color: rgba(255,255,255,0.88);
	padding: 8px 18px 8px 4px;
	position: relative;
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary::before {
	content: "";
	position: absolute;
	left: 0; right: 100%; bottom: -2px;
	height: 2px;
	background: #ffffff;
	transition: right 0.2s ease;
}
.nav-dropdown summary:hover,
.nav-dropdown[open] summary { color: #ffffff; }
.nav-dropdown summary:hover::before,
.nav-dropdown[open] summary::before { right: 0; }
.nav-dropdown summary::after {
	content: "";
	position: absolute;
	right: 4px;
	top: 50%;
	width: 7px;
	height: 7px;
	border-right: 2px solid rgba(255,255,255,0.88);
	border-bottom: 2px solid rgba(255,255,255,0.88);
	transform: translateY(-70%) rotate(45deg);
	transition: transform 0.15s ease;
}
.nav-dropdown[open] summary::after {
	transform: translateY(-30%) rotate(225deg);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;

    /* Make dropdown wide enough for one-line text */
    width: max-content;
    min-width: 380px;
    white-space: nowrap;

    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    padding: 6px;
    z-index: 60;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown[open] .nav-dropdown-menu {
	display: block;
}

/* Higher specificity than "nav.main-nav a" so these override it for submenu links */
nav.main-nav .nav-dropdown-menu a {
	display: block;
	position: static;
	color: var(--ink);
	font-weight: 600;
	font-size: 0.95em;
	padding: 8px 10px;
	margin: 0;
	border-radius: 4px;
	white-space: nowrap;
}
nav.main-nav .nav-dropdown-menu a::after { display: none; content: none; }
nav.main-nav .nav-dropdown-menu a:hover {
	background: var(--bg);
	color: var(--accent);
}

.nav-toggle { display: none; }
.nav-toggle-label { display: none; color: #ffffff; cursor: pointer; font-size: 1.4em; }

@media (max-width: 800px) {
	nav.main-nav {
		display: none;
		position: absolute; left: 0; right: 0; top: 68px;
		background: var(--accent);
		flex-direction: column;
		border-bottom: 1px solid var(--blue-deep);
		padding: 6px;
		z-index: 50;
	}
	nav.main-nav a { margin: 2px 0; padding: 10px 12px; }
	nav.main-nav a::after { display: none; }
	.nav-toggle:checked ~ nav.main-nav { display: flex; }
	.nav-toggle-label { display: block; }

	.nav-dropdown { margin: 2px 0; width: 100%; }
	.nav-dropdown summary { padding: 10px 12px; }
	.nav-dropdown:hover .nav-dropdown-menu { display: none; }
	.nav-dropdown[open] .nav-dropdown-menu { display: block; }
	.nav-dropdown-menu {
		position: static;
		box-shadow: none;
		border: none;
		background: transparent;
		padding: 0 0 0 16px;
	}
	.nav-dropdown-menu a { white-space: normal; }
}

.site-footer {
	border-top: 1px solid var(--blue-deep);
	background: var(--accent);
	color: rgba(255,255,255,0.85);
	margin-top: auto;
	padding: 26px 0;
	font-size: 1.15em;
	font-weight: 700;
}
.site-footer a { color: rgba(255,255,255,0.85); text-decoration: none; margin-right: 22px; }
.site-footer a:hover { color: #ffffff; text-decoration: underline; }

.footer-flex {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px 20px;
}
.footer-col { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-center { flex: 1; justify-content: center; }
.footer-left a, .footer-right a { margin-right: 0; }
.footer-right { justify-content: flex-end; }

@media (max-width: 700px) {
	.footer-flex { justify-content: center; }
	.footer-col { justify-content: center; }
	.footer-center { flex: 0 1 auto; }
}

/* ---------- Hero: text + clear side illustration (not a background) ---------- */

.hero {
	border-bottom: 1px solid var(--line);
	background: var(--bg);
	padding: 72px 0;
}

.hero .wrap {
	display: flex;
	gap: 56px;
	align-items: center;
}
.hero-text { flex: 1 1 480px; min-width: 0; }
.hero-visual { flex: 0 0 520px; text-align: center; }
.hero-visual img {
	max-width: 100%;
	height: auto;
	border-radius: 14px;
	box-shadow: 0 10px 35px rgba(16,27,51,0.18);
	border: 1px solid var(--line);
}
.hero-visual .caption {
	font-family: var(--font-mono);
	font-size: 0.78em;
	color: var(--muted);
	margin-top: 10px;
}

@media (max-width: 860px) {
	.hero .wrap { flex-direction: column; }
	.hero-visual { order: -1; max-width: 260px; flex-basis: auto; }
}

.hero .kicker {
	font-family: var(--font-mono);
	color: var(--muted);
	font-size: 1.0em;
	font-weight: 700;
	margin: 0 0 16px;
}
.hero .kicker b { color: var(--accent); font-weight: 700; }

.hero h1 {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: clamp(2.4em, 4.6vw, 3.4em);
	margin: 0 0 16px;
	letter-spacing: -0.01em;
	line-height: 1.08;
}

.hero p.lede {
	color: var(--muted);
	font-size: 1.08em;
	margin: 0 0 28px;
	max-width: 480px;
	text-align: justify;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
	display: inline-block;
	font-family: var(--font-body);
	font-weight: 600;
	font-size: 0.95em;
	text-decoration: none;
	padding: 12px 22px;
	border-radius: var(--radius);
	border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1F5FA8; color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Section scaffolding ---------- */

section.block { padding: 56px 0; border-bottom: 1px solid var(--line); }
section.block:last-of-type { border-bottom: none; }

.section-label {
	font-family: var(--font-mono);
	color: var(--muted);
	font-size: 0.86em;
	margin: 0 0 10px;
}
.section-label b { color: var(--accent); }

h2.section-title {
	font-family: var(--font-body);
	font-weight: 700;
	font-size: 1.85em;
	margin: 0 0 26px;
	letter-spacing: -0.01em;
}

.prose,
.prose p {
    text-align: justify;
    text-align-last: left;
}

.prose { max-width: 820px; margin: 0 auto; }
.prose p { color: var(--ink); }
.prose ul { padding-left: 1.15em; }

.cite-box {
	border-left: 2px solid var(--accent);
	background: var(--panel);
	padding: 14px 18px;
	margin-top: 28px;
	font-size: 0.92em;
	color: var(--muted);
}

/* ---------- Module list ---------- */

.mod-list { border-top: 1px solid var(--line); }
.mod-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 20px;
	padding: 22px 0;
	border-bottom: 1px solid var(--line);
	text-decoration: none;
	color: var(--ink);
	align-items: baseline;
}
.mod-row:hover .mod-name { color: var(--accent); }
.mod-row .mod-name {
	font-family: var(--font-body);
	font-weight: 700;
	font-size: 1.15em;
	flex: 0 0 150px;
}
.mod-row .mod-desc { color: var(--muted); font-size: 0.98em; flex: 1 1 320px; }

/* ---------- Module dropdown (Predict/Design/Scan -> Main/Alternate) ---------- */

.mod-dropdown { border-bottom: 1px solid var(--line); }
.mod-dropdown .mod-row { border-bottom: none; }
.mod-dropdown[open] .mod-summary .mod-name { color: var(--accent); }

.mod-summary {
	cursor: pointer;
	list-style: none;
	position: relative;
	padding-right: 30px;
}
.mod-summary::-webkit-details-marker { display: none; }
.mod-summary::after {
	content: "";
	position: absolute;
	right: 4px;
	top: 50%;
	width: 9px;
	height: 9px;
	border-right: 2px solid var(--muted);
	border-bottom: 2px solid var(--muted);
	transform: translateY(-70%) rotate(45deg);
	transition: transform 0.15s ease;
}
.mod-dropdown[open] .mod-summary::after {
	transform: translateY(-30%) rotate(225deg);
}

.mod-suboptions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 0 0 20px 0;
}
.mod-suboption {
	flex: 1 1 220px;
	display: block;
	text-decoration: none;
	color: var(--ink);
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 12px 16px;
	transition: border-color 0.15s ease;
}
.mod-suboption:hover { border-color: var(--accent); }
.mod-suboption:hover .mod-sub-name { color: var(--accent); }
.mod-sub-name { display: block; font-weight: 700; font-family: var(--font-body); }
.mod-sub-note { display: block; color: var(--muted); font-size: 0.9em; margin-top: 2px; }

/* ---------- Forms ---------- */

.form-panel {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 32px;
	width: 100%;
}
.form-grid {
	display: flex;
	gap: 32px;
	flex-wrap: wrap;
}
.form-grid > .form-col { flex: 1 1 340px; min-width: 0; }

.field { margin-bottom: 22px; }
.field .field-label {
	display: block;
	font-weight: 600;
	font-size: 0.92em;
	color: var(--ink);
	margin-bottom: 8px;
}
.field .hint { color: var(--muted); font-size: 0.86em; margin-top: 6px; }

textarea, input[type=text], input[type=file], select {
	font-family: var(--font-mono);
	font-size: 0.94em;
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--bg);
	color: var(--ink);
}
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 140px; resize: vertical; }

input[type=submit] {
	font-family: var(--font-body);
	background: var(--accent);
	color: #fff;
	border: none;
	padding: 12px 26px;
	border-radius: var(--radius);
	font-weight: 600;
	font-size: 0.95em;
	cursor: pointer;
}
input[type=submit]:hover { background: #1F5FA8; }

input[type=reset] {
	font-family: var(--font-body);
	background: transparent;
	border: 1px solid var(--line);
	padding: 12px 20px;
	border-radius: var(--radius);
	cursor: pointer;
	color: var(--muted);
}

hr.rule { border: none; border-top: 1px solid var(--line); margin: 24px 0; }

/* ---------- Results table ---------- */

.results-header h2 { font-family: var(--font-body); font-weight: 700; }

.anticapt-table {
	width: 100%;
	border-collapse: collapse;
	margin: 24px 0;
	font-size: 0.92em;
	background: var(--panel);
	border: 1px solid var(--line);
}
.anticapt-table th {
	background: var(--bg);
	color: var(--muted);
	font-weight: 600;
	padding: 12px;
	text-align: left;
	font-size: 0.86em;
	border-bottom: 1px solid var(--line);
}
.anticapt-table td {
	padding: 12px;
	border-bottom: 1px solid var(--line);
	font-family: var(--font-mono);
	font-size: 0.95em;
}
.anticapt-table tr:hover td { background: #FCFBF7; }

.anticapt-confidence-bar-outer {
	width: 100%;
	max-width: 180px;
	height: 6px;
	background: var(--line);
	border-radius: 3px;
	overflow: hidden;
	display: inline-block;
	vertical-align: middle;
	margin-left: 8px;
}
.anticapt-confidence-bar-inner { height: 100%; background: linear-gradient(90deg, var(--accent), var(--mint)); }

.anticapt-badge {
	display: inline-block;
	padding: 3px 11px;
	border-radius: 3px;
	font-family: var(--font-body);
	font-size: 0.82em;
	font-weight: 600;
}
.anticapt-badge.positive { background: rgba(31,95,168,0.12); color: var(--success); }
.anticapt-badge.negative { background: rgba(178,58,58,0.12); color: var(--danger); }
.anticapt-badge.na { background: rgba(98,107,100,0.12); color: var(--muted); }

.anticapt-download-btn {
	display: inline-block;
	margin-top: 10px;
	padding: 12px 24px;
	background: var(--accent);
	color: #fff !important;
	border-radius: var(--radius);
	text-decoration: none;
	font-weight: 600;
}
.anticapt-download-btn:hover { background: #1F5FA8; }

/* ---------- Applications figure section ---------- */

.applications-figure {
	width: 100%;
	max-width: 900px;
	display: block;
	margin: 0 auto;
	border-radius: 12px;
	border: 1px solid var(--line);
	box-shadow: 0 6px 24px rgba(16,27,51,0.08);
}

/* Workflow diagram (algorithm.php) is a tall portrait figure - a 900px cap
   left it dominating most of the viewport height. Capped separately and
   more narrowly here since this is a different image than the shared
   applications-figure used on the homepage. */
.workflow-figure {
	width: 100%;
	max-width: 460px;
	display: block;
	margin: 0 auto;
	border-radius: 12px;
	border: 1px solid var(--line);
	box-shadow: 0 6px 24px rgba(16,27,51,0.08);
}

/* ---------- DataTables controls (results page) - restyled to match site ---------- */

.dataTables_wrapper {
	font-family: var(--font-body);
	color: var(--ink);
	margin-top: 4px;
}

.dataTables_length, .dataTables_filter, .dataTables_info, .dataTables_paginate {
	font-size: 0.92em;
	color: var(--muted);
	margin-bottom: 12px;
}

.dataTables_filter input, .dataTables_length select {
	font-family: var(--font-body);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 6px 10px;
	background: var(--panel);
	color: var(--ink);
	margin-left: 6px;
}
.dataTables_filter input:focus, .dataTables_length select:focus {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
}

.anticapt-table.dataTable thead th {
	cursor: pointer;
	position: relative;
	padding-right: 22px !important;
}
.anticapt-table.dataTable thead th.sorting::after,
.anticapt-table.dataTable thead th.sorting_asc::after,
.anticapt-table.dataTable thead th.sorting_desc::after {
	content: "\2195";
	position: absolute;
	right: 8px;
	color: var(--muted);
	font-size: 0.85em;
}
.anticapt-table.dataTable thead th.sorting_asc::after { content: "\2191"; color: var(--accent); }
.anticapt-table.dataTable thead th.sorting_desc::after { content: "\2193"; color: var(--accent); }

.dataTables_paginate .paginate_button {
	font-family: var(--font-body);
	padding: 5px 11px;
	margin-left: 4px;
	border-radius: var(--radius);
	border: 1px solid var(--line);
	color: var(--ink) !important;
	background: var(--panel) !important;
	cursor: pointer;
}
.dataTables_paginate .paginate_button:hover {
	border-color: var(--accent) !important;
	color: var(--accent) !important;
	background: var(--panel) !important;
}
.dataTables_paginate .paginate_button.current {
	background: var(--accent) !important;
	color: #fff !important;
	border-color: var(--accent) !important;
}
.dataTables_paginate .paginate_button.disabled {
	color: var(--muted) !important;
	cursor: default;
	opacity: 0.5;
}

/* ---------- Responsive table wrapper ---------- */

.table-scroll { width: 100%; overflow-x: auto; }

/* ---------- Model selection radio cards (predict form) ---------- */

.model-select { display: flex; gap: 12px; flex-wrap: wrap; }
.model-option {
	flex: 1 1 200px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 12px 14px;
	cursor: pointer;
	background: var(--bg);
}
.model-option input[type=radio] { margin-right: 8px; }
.model-option .model-name { font-weight: 600; }
.model-option .model-note { display: block; color: var(--muted); font-size: 0.82em; margin-top: 2px; }
.model-option.disabled { opacity: 0.55; cursor: not-allowed; }
.model-option.locked { cursor: default; border-color: var(--accent); background: var(--panel); }

/* ---------- Algorithm page workflow placeholder ---------- */

.workflow-placeholder {
	border: 1px dashed var(--line);
	border-radius: var(--radius);
	padding: 60px 20px;
	text-align: center;
	color: var(--muted);
	background: var(--panel);
	font-size: 0.95em;
}

/* ---------- Standalone / download section cards ---------- */

.card-row {
	display: flex;
	gap: 20px;
	flex-wrap: wrap;
}
.card-row .info-card { flex: 1 1 300px; margin-bottom: 0; }

.info-card {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 22px 24px;
	background: var(--panel);
	margin-bottom: 20px;
}
.info-card h3 { margin: 0 0 10px; font-size: 1.1em; }
.info-card p { margin: 0 0 8px; color: var(--muted); }

/* ---------- Team page ---------- */

.team-grid {
	display: flex;
	gap: 24px;
	flex-wrap: wrap;
	align-items: stretch;
}
.team-card {
	flex: 1 1 340px;
	text-align: center;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 24px 18px;
}

.team-card img {
    display: block;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    margin: 0 auto 18px;
    border: 2px solid var(--line);
}
.team-card .team-name{
    display:block;
    width:100%;
    text-align:center;
    font-weight:700;
    font-size:1rem;
    margin:12px auto 6px;
}
.team-card .team-role{
    color:var(--muted);
    font-size:1rem;
    line-height:1.5;
    text-align:center;
    width:100%;
    margin:0 auto 18px;
}
/* ---------- Responsive tightening for small phones ---------- */

@media (max-width: 480px) {
	.wrap { padding: 0 16px; }
	.hero { padding: 40px 0; }
	.form-panel { padding: 20px; }
	h2.section-title { font-size: 1.5em; }
}

/* ---------- Team member social links ---------- */

.social-links {
	display: flex;
	gap: 10px;
	justify-content: center;
	margin-top: 14px;
}
.social-links a {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--bg);
	border: 1px solid var(--line);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ink);
	font-size: 0.78em;
	font-weight: 700;
	text-decoration: none;
}
.social-links a:hover {
	background: var(--accent);
	color: #fff;
	border-color: var(--accent);
}

/* ---------- Day/night theme toggle button ---------- */

.theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: 1px solid rgba(255,255,255,0.4);
	background: transparent;
	color: #fff;
	cursor: pointer;
	margin-left: 10px;
	padding: 0;
}

.theme-toggle:hover { background: rgba(255,255,255,0.15); }

.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: inline-block; }

@media (max-width: 800px) {
	.theme-toggle { margin: 10px 0 0 12px; }
}

/* ---------- "Please wait" processing notice (predict/design/scan action pages) ---------- */

.anticapt-wait {
	display: flex;
	align-items: center;
	gap: 16px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 20px 24px;
	margin: 20px 0;
}
.anticapt-spinner {
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	border: 3px solid var(--line);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: anticapt-spin 0.8s linear infinite;
}
@keyframes anticapt-spin {
	to { transform: rotate(360deg); }
}
.anticapt-wait p {
	margin: 0;
	color: var(--muted);
}
