/*
 * SemesterMath — homepage hero, calculator cards and per-tool colours.
 * Loaded on the homepage and on tool pages (icons + tints). Tokens from site.css.
 */

/* ======================================================== Tints: one colour per calculator */

.sm-tint--cobalt { --t: #2448C8; --t-wash: #ECEFFB; --t-line: #C3CDF3; }
.sm-tint--teal   { --t: #0B7A78; --t-wash: #E2F3F1; --t-line: #A9DAD4; }
.sm-tint--violet { --t: #6A4BC4; --t-wash: #EFEAFB; --t-line: #CFC2F1; }
.sm-tint--coral  { --t: #BF4129; --t-wash: #FCEAE5; --t-line: #F0BFB3; }
.sm-tint--amber  { --t: #966000; --t-wash: #FBF0D8; --t-line: #EBCF95; }
.sm-tint--green  { --t: #1D7347; --t-wash: #E4F2E9; --t-line: #AFD8BE; }
.sm-tint--sky    { --t: #0A6A9C; --t-wash: #E1F0F8; --t-line: #A8D2E8; }
.sm-tint--rose   { --t: #B0285B; --t-wash: #FBE8EF; --t-line: #EDB5C9; }
.sm-tint--slate  { --t: #46566B; --t-wash: #EAEEF2; --t-line: #C3CCD6; }
.sm-tint--olive  { --t: #5B7110; --t-wash: #EEF3DD; --t-line: #CAD89A; }

@media (prefers-color-scheme: dark) {
	.sm-tint--cobalt { --t: #9DB0F5; --t-wash: #1E2640; --t-line: #34437A; }
	.sm-tint--teal   { --t: #6FD3CC; --t-wash: #12302E; --t-line: #1F5551; }
	.sm-tint--violet { --t: #BBA6F5; --t-wash: #261F3D; --t-line: #44386E; }
	.sm-tint--coral  { --t: #F49A86; --t-wash: #36201B; --t-line: #66382D; }
	.sm-tint--amber  { --t: #F0C064; --t-wash: #33280F; --t-line: #5E4A1C; }
	.sm-tint--green  { --t: #7CD3A0; --t-wash: #14291D; --t-line: #255238; }
	.sm-tint--sky    { --t: #7CC4EA; --t-wash: #10273A; --t-line: #1F4A66; }
	.sm-tint--rose   { --t: #F29BBB; --t-wash: #33182A; --t-line: #63304A; }
	.sm-tint--slate  { --t: #B2BECC; --t-wash: #1E242C; --t-line: #3A4552; }
	.sm-tint--olive  { --t: #C2D57A; --t-wash: #222A12; --t-line: #44521F; }
}

.sm-tile {
	display: inline-grid; place-items: center; flex: none;
	width: 44px; height: 44px; border-radius: 12px;
	background: var(--t-wash); color: var(--t); box-shadow: inset 0 0 0 1px var(--t-line);
}
.sm-tile .sm-ico { display: block; }

/* ======================================================== Hero: the full GPA calculator in the first screen */

.sm-hero2 {
	position: relative; padding: 18px 0 28px; border-bottom: 1px solid var(--rule);
	/* Faint graph paper: the page is about maths, and it gives the hero some texture without an illustration. */
	background-image:
		linear-gradient(to right, color-mix(in srgb, var(--rule) 70%, transparent) 1px, transparent 1px),
		linear-gradient(to bottom, color-mix(in srgb, var(--rule) 70%, transparent) 1px, transparent 1px);
	background-size: 28px 28px;
	background-position: -1px -1px;
}
.sm-hero2::after {
	content: ""; position: absolute; inset: 0; pointer-events: none;
	background: radial-gradient(120% 90% at 50% 0%, transparent 35%, var(--paper) 85%);
}
.sm-hero2 > .sm-wrap { position: relative; z-index: 1; }

.sm-hero2__top { display: grid; gap: 6px; margin-bottom: 16px; }
.sm-hero2 h1 { font-size: clamp(1.9rem, 7.4vw, 3rem); line-height: 1.04; letter-spacing: -0.04em; }
.sm-hero2 h1 em { font-style: normal; color: var(--accent-ink); }
.sm-hero2__lede { margin: 4px 0 0; font-size: 1rem; line-height: 1.5; color: var(--ink-2); max-width: 34em; }
.sm-hero2__lede b { color: var(--ink); font-weight: 600; }

@media (min-width: 960px) {
	.sm-hero2 { padding: 28px 0 40px; }
	.sm-hero2__top { grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: 12px 40px; margin-bottom: 20px; }
	.sm-hero2__lede { justify-self: end; text-align: right; max-width: 30em; }
}

/* Calculator tabs above the workspace: GPA is open, the other five are one tap away. */
.sm-tabs { margin: 0 calc(-1 * var(--gutter)) 12px; padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sm-tabs::-webkit-scrollbar { display: none; }
.sm-tabs ul { list-style: none; margin: 0; padding: 2px 0; display: flex; gap: 6px; width: max-content; }
.sm-tabs a {
	display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 10px; border-radius: 999px;
	background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 550; white-space: nowrap;
	box-shadow: inset 0 0 0 1px var(--rule-2); transition: background-color .12s, color .12s, box-shadow .12s;
}
.sm-tabs a .sm-ico { color: var(--t); }
.sm-tabs a:hover { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--t-line); }
.sm-tabs a[aria-current="page"] { background: var(--t); color: #fff; box-shadow: none; }
.sm-tabs a[aria-current="page"] .sm-ico { color: #fff; }
@media (prefers-color-scheme: dark) { .sm-tabs a[aria-current="page"], .sm-tabs a[aria-current="page"] .sm-ico { color: #0D1020; } }
@media (min-width: 720px) { .sm-tabs { margin: 0 0 14px; padding: 0; } }

/* The homepage workspace: full calculator, compact rhythm so it fits a laptop screen. */
.sm-hero2 .sm-ws { margin: 0; }
.sm-hero2 .sm-ws__grid { background: var(--surface); box-shadow: 0 1px 0 var(--rule), 0 30px 60px -40px rgba(22, 24, 29, .35); }
@media (min-width: 960px) {
	.sm-hero2 .sm-ws__in { padding: 20px 26px 16px; }
	.sm-hero2 .sm-ws__out { padding: 22px 26px; position: static; max-height: none; }
	.sm-hero2 .sm-kv__title { margin-top: 16px !important; }
	.sm-hero2 .sm-actions { margin-top: 14px; }
}

/* ======================================================== Calculator cards */

.sm-cards2 { padding: 44px 0 8px; }
.sm-cards2__head { display: grid; gap: 8px; margin-bottom: 22px; }
.sm-cards2__head p { margin: 0; color: var(--ink-2); max-width: 40em; }
@media (min-width: 960px) {
	.sm-cards2 { padding: 64px 0 16px; }
	.sm-cards2__head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; gap: 12px 40px; }
	.sm-cards2__head p { justify-self: end; text-align: right; }
}

.sm-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .sm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 1000px) { .sm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }

.sm-tcard {
	position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 14px; align-content: start;
	padding: 16px; border-radius: 14px; background: var(--surface); color: var(--ink) !important; text-decoration: none;
	box-shadow: inset 0 0 0 1px var(--rule); transition: box-shadow .15s, transform .15s;
}
.sm-tcard .sm-tile { grid-row: 1 / span 3; }
.sm-tcard__group { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--t); }
.sm-tcard__title { margin: 0 !important; font-size: 1.08rem !important; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; }
.sm-tcard__q { margin: 2px 0 0; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.sm-tcard__go { grid-column: 2; margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--t); display: inline-flex; align-items: center; gap: 6px; }
.sm-tcard__go svg { transition: transform .15s; }
.sm-tcard:hover { box-shadow: inset 0 0 0 1.5px var(--t-line), 0 14px 30px -22px rgba(22, 24, 29, .45); transform: translateY(-2px); }
.sm-tcard:hover .sm-tcard__go svg { transform: translateX(3px); }
.sm-tcard:focus-visible { box-shadow: var(--ring) !important; border-radius: 14px !important; }
.sm-tcard__draft { position: absolute; right: 14px; top: 14px; font-size: 11px; font-weight: 650; text-transform: uppercase; color: #7A1F1F; }

@media (min-width: 640px) {
	/* Column layout: the link sits at the bottom so links line up across a row. */
	.sm-tcard { display: flex; flex-direction: column; align-items: flex-start; padding: 20px; gap: 6px; }
	.sm-tcard .sm-tile { margin-bottom: 10px; width: 54px; height: 54px; border-radius: 14px; }
	.sm-tcard .sm-tile .sm-ico { width: 28px; height: 28px; }
	.sm-tcard__go { margin-top: auto; padding-top: 14px; }
}

/* ======================================================== Tool pages: icon beside the title */

.sm-toolhead__t { display: flex; align-items: center; gap: 14px; }
.sm-toolhead__t .sm-tile { width: 48px; height: 48px; }
@media (max-width: 599px) { .sm-toolhead__t .sm-tile { width: 40px; height: 40px; border-radius: 10px; } }

@media (prefers-reduced-motion: reduce) {
	.sm-tcard, .sm-tcard__go svg, .sm-tabs a { transition: none !important; }
	.sm-tcard:hover { transform: none; }
}

/* Phones: the hero gives the calculator the room, so the answer shows without scrolling. */
@media (max-width: 599px) {
	.sm-hero2 { padding-top: 14px; }
	.sm-hero2__top { margin-bottom: 12px; }
	.sm-hero2__lede { display: none; }
	.sm-hero2 .sm-tabs { margin-bottom: 10px; }
	.sm-hero2 .sm-ws__in { padding-top: 14px; padding-bottom: 8px; }
	.sm-hero2 .sm-list__tools { display: flex; flex-wrap: wrap; gap: 0 18px; }
	.sm-hero2 .sm-list__tools .sm-add { margin-top: 4px; }
	.sm-hero2 .sm-scaleline { margin-top: 6px; }
	.sm-hero2 .sm-ws__foot { display: none; }
	.sm-hero2 .sm-ws__out { padding-top: 16px; }
}
