/*
 * Services – additions for the 2026 service pages
 * (Einkabankaþjónusta, Verðbréfaþjónusta, Auðlind, Fjárfestingaráðgjöf, Eignastýring).
 *
 * Loaded after avista-styles.css on Elements pages only (functions.php →
 * avista_services_styles). Everything here is opt-in through new ACF options,
 * so existing Elements pages render exactly as before.
 */

/* ------------------------------------------------------------------
 * Colour tokens (Figma: "Auðlind á heimasíðu")
 * Default = Fossar blue. Page options → Colour theme switches them.
 * ------------------------------------------------------------------ */
:root {
	--fs-panel: #395470;      /* Fossar Blár 1 */
	--fs-divider: #A2B6C3;    /* Fossar Blár 2 */
	--fs-text: #395470;       /* headings + body on service pages */
	--fs-tile: #55799E;       /* tiles (sampled from design) */
	--fs-risk: #A2B6C3;
	--fs-grey-bg: #F7F7F7;    /* Fossar Hvítur */
	--fs-grey-1: #E3E5E8;
	--fs-grey-2: #CFCFCF;
	--fs-grey-3: #8B8B8B;
	--fs-gold: #C9AE71;       /* ÍV Gyltur */
	--fs-orange: #F57859;     /* Fossar Appelsínugulur */
	--fs-rule-head: #A2B6C3;  /* table header rule */
}

body.theme-audlind {
	--fs-panel: #7A847D;      /* Auðlind Grænn 3 */
	--fs-text: #364A42;       /* Auðlind Grænn 1 */
	--fs-tile: #7A847D;
	--fs-risk: #93C1B9;       /* Auðlind Grænn 4 */
	--fs-rule-head: #93C1B9;
}

/* ------------------------------------------------------------------
 * Intro banner – flat panel (split layout, image on the right)
 * ------------------------------------------------------------------ */
.hero-banner.flatpanel {
	background-color: var(--fs-panel);
	background-image: none;
}
.hero-banner.flatpanel .image {
	margin-left: 0;
	border-left: 5px solid var(--fs-divider);
}

@media (max-width: 991.98px) {
	.hero-banner.flatpanel .image {
		border-left: 0;
		border-bottom: 5px solid var(--fs-divider);
	}
}

/* ------------------------------------------------------------------
 * Text elements → Full width: background + title alignment options
 * ------------------------------------------------------------------ */
.single-article.bg-grey {
	background-color: var(--fs-grey-bg);
}
.single-article.bg-white {
	background-color: #fff;
}
.single-article.title-left h2,
.single-article.title-left .h2 {
	text-align: left;
}

/* Colour theme applies to the text sections on the page */
body.theme-audlind .single-article {
	color: var(--fs-text);
}
body.theme-audlind .single-article h2,
body.theme-audlind .single-article .h2,
body.theme-audlind .single-article h3,
body.theme-audlind .single-article .h3 {
	color: var(--fs-text);
}

/* ------------------------------------------------------------------
 * Wide block: starts on the text column's left edge, runs to the
 * container's right edge (fund tables, tiles). Below the text-column
 * width it is a normal container.
 * ------------------------------------------------------------------ */
:root {
	--fs-cpad: 50px;
	--fs-text-col: 90.2rem;   /* = .single-article .container max-width */
}
@media (max-width: 1439.98px) { :root { --fs-cpad: 30px; } }
@media (max-width: 767.98px)  { :root { --fs-cpad: 20px; } }
@media (max-width: 374.98px)  { :root { --fs-cpad: 15px; } }

.container.wide-right {
	max-width: none;
	padding-left: max(var(--fs-cpad), calc((100% - var(--fs-text-col)) / 2 + var(--fs-cpad)));
	padding-right: var(--fs-cpad);
}

/* Shared section backgrounds/spacing for the new elements */
.fund-section,
.holdings-section,
.tiles-section,
.overview-section {
	position: relative;
	color: var(--fs-text);
}
.fund-section .container,
.holdings-section .container,
.tiles-section .container,
.overview-section .container {
	padding-top: 3rem;
	padding-bottom: 3rem;
}
.holdings-section .container {
	max-width: var(--fs-text-col);
}
.fund-section.bg-grey,
.holdings-section.bg-grey,
.tiles-section.bg-grey,
.overview-section.bg-grey { background-color: var(--fs-grey-bg); }
.fund-section.bg-white,
.holdings-section.bg-white,
.tiles-section.bg-white,
.overview-section.bg-white { background-color: #fff; }
.fund-section.bg-pattern,
.holdings-section.bg-pattern,
.tiles-section.bg-pattern,
.overview-section.bg-pattern {
	background-image: url('../images/bg-pattern-1.png');
	background-repeat: repeat;
}
.fund-section.compt .container,
.holdings-section.compt .container,
.tiles-section.compt .container,
.overview-section.compt .container { padding-top: 1rem; }
.fund-section.compb .container,
.holdings-section.compb .container,
.tiles-section.compb .container,
.overview-section.compb .container { padding-bottom: 1rem; }

/* ------------------------------------------------------------------
 * Fund table (ÍV)
 * ------------------------------------------------------------------ */
.fund-title {
	font-size: 2.6rem;
	line-height: 1.25;
	text-align: left;
	color: var(--fs-text);
	margin: 0 0 1.6rem;
}
.fund-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
.fund-table {
	width: 100%;
	min-width: 72rem;
	border-collapse: collapse;
	table-layout: fixed;
	font-size: 2rem;
	line-height: 1.25;
	color: var(--fs-text);
}
.fund-table th,
.fund-table td {
	padding: 1.4rem 1rem 1.4rem 0;
	text-align: left;
	vertical-align: middle;
	font-weight: 400;
	white-space: nowrap;
}
.fund-table thead th {
	border-bottom: 1px solid var(--fs-rule-head);
}
.fund-table tbody tr + tr th,
.fund-table tbody tr + tr td {
	border-top: 1px solid var(--fs-text);
}
.fund-table .col-name     { width: 31%; white-space: normal; }
.fund-table .col-currency { width: 9%; }
.fund-table .col-risk     { width: 12%; }
.fund-table .col-num      { width: 12%; }
.fund-table thead .col-num { padding-left: 2.1rem; } /* header lines up with the figure, arrow hangs left */
.fund-table tbody th {
	font-weight: 700;
}
.fund-table tbody th a {
	color: inherit;
	text-decoration: none;
}
.fund-table tbody th a:hover,
.fund-table tbody th a:focus {
	text-decoration: underline;
}

/* Return cell: arrow + value; down = orange, arrow rotated */
.fund-return {
	display: inline-flex;
	align-items: center;
	gap: 0.7rem;
}
.fund-arrow {
	display: inline-block;
	width: 1.4rem;
	height: 1.7rem;
	background-color: currentColor;
	-webkit-mask: url('../images/icons/fund-arrow.svg') no-repeat center / contain;
	        mask: url('../images/icons/fund-arrow.svg') no-repeat center / contain;
}
.fund-return.is-down {
	color: var(--fs-orange);
}
.fund-return.is-down .fund-arrow {
	transform: rotate(180deg);
}

/* Risk meter: 7 bars */
.risk-meter {
	display: inline-flex;
	gap: 0.3rem;
	vertical-align: middle;
}
.risk-meter span {
	display: block;
	width: 0.5rem;
	height: 1.9rem;
	background-color: var(--fs-grey-1);
}
.risk-meter span.on {
	background-color: var(--fs-risk);
}

.fund-note {
	font-size: 1.4rem;
	line-height: 1.4;
	color: var(--fs-grey-3);
	margin: 1.2rem 0 0;
}
.fund-button-row {
	margin-top: 4rem;
}
.btn-pill {
	display: inline-flex;
	align-items: center;
	height: 4.7rem;
	padding: 0 2.2rem;
	border-radius: 3.75rem;
	background-color: var(--fs-grey-2);
	color: #333;
	font-size: 1.8rem;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color .2s ease;
}
.btn-pill:hover,
.btn-pill:focus {
	background-color: var(--fs-grey-1);
	color: #333;
	text-decoration: none;
}

/* Phones: sticky fund name while the table scrolls sideways; drop 6 mán. */
@media (max-width: 767.98px) {
	.fund-table {
		font-size: 1.6rem;
		min-width: 52rem;
	}
	.fund-table .col-m6 { display: none; }
	.fund-table .col-name {
		width: 16rem;
		position: sticky;
		left: 0;
		z-index: 1;
		background-color: inherit;
	}
	.fund-section.bg-grey .fund-table .col-name { background-color: var(--fs-grey-bg); }
	.fund-section.bg-white .fund-table .col-name { background-color: #fff; }
}

/* ------------------------------------------------------------------
 * Holdings list (manual name / value rows)
 * ------------------------------------------------------------------ */
.holdings-title {
	font-family: "GT-America-Standard", Arial, Helvetica, sans-serif;
	font-size: inherit;
	line-height: inherit;
	font-weight: 700;
	color: var(--fs-text);
	margin: 0;
}
.holdings-text p:last-child {
	margin-bottom: 0;
}
.holdings-table {
	width: 100%;
	margin-top: 4rem;
	border-collapse: collapse;
	font-size: 2rem;
	line-height: 1.25;
}
.holdings-table th,
.holdings-table td {
	padding: 1.4rem 0;
	vertical-align: middle;
}
.holdings-table th {
	text-align: left;
	font-weight: 700;
	padding-right: 2rem;
}
.holdings-table td {
	text-align: right;
	white-space: nowrap;
}
.holdings-table tr + tr th,
.holdings-table tr + tr td {
	border-top: 1px solid var(--fs-rule-head);
}
@media (max-width: 767.98px) {
	.holdings-table { font-size: 1.6rem; }
}

/* ------------------------------------------------------------------
 * Feature tiles ("Við bjóðum upp á") – 386×303 tiles, ~27px gaps
 * ------------------------------------------------------------------ */
.feature-tiles {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 2.8rem 2.7rem;
}
.feature-tile {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 386 / 303;
	padding: 3rem 2.8rem;
	background-color: var(--fs-tile);
	color: #F7F7F7;
	text-decoration: none;
}
a.feature-tile:hover,
a.feature-tile:focus {
	color: #F7F7F7;
	text-decoration: none;
	filter: brightness(1.08);
}
.feature-tile-title {
	font-size: 2.6rem;
	line-height: 1.2;
	text-align: center;
	color: inherit;
	margin: 0;
}
.feature-tile-caption {
	position: absolute;
	left: 2.8rem;
	right: 2.8rem;
	bottom: 3rem;
	margin: 0;
	font-size: 2rem;
	line-height: 1.2;
	max-width: 27rem;
}
@media (max-width: 991.98px) {
	.feature-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
}
@media (max-width: 575.98px) {
	.feature-tiles { grid-template-columns: minmax(0, 1fr); }
	.feature-tile { aspect-ratio: auto; min-height: 20rem; }
}

/* ------------------------------------------------------------------
 * Service overview (Auðlind | Einkabanki columns)
 * ------------------------------------------------------------------ */
.service-overview {
	--ov-group-gap: 2.1rem;   /* + 1rem column gap = 31px between groups */
	display: grid;
	grid-template-columns: var(--ov-tracks);
	column-gap: 1rem;
	row-gap: 0;
	color: #333;
}
.service-overview > * {
	grid-column: var(--c) / span var(--s, 1);
	grid-row: var(--r);
	margin: 0;
}
.ov-group {
	display: flex;
	align-items: center;
	min-height: 15.6rem;
	padding: 0 1rem;
	font-size: 2.4rem;
	line-height: 1.2;
	text-transform: uppercase;
	color: #F7F7F7;
}
.ov-blue  { --ov-color: #395470; }
.ov-green { --ov-color: #7A847D; }
.ov-group { background-color: var(--ov-color); }
.ov-cell {
	background-color: var(--fs-grey-1);
	box-shadow: 0 -1px 0 var(--fs-grey-1); /* hide subpixel seams between grid rows */
	padding: 0 1rem;
}
.ov-head {
	padding-top: 1.3rem;
	padding-bottom: 3.9rem;
}
.ov-eyebrow {
	font-size: 1.8rem;
	line-height: 1.2;
	font-weight: 500;
	color: var(--fs-grey-3);
	margin: 0 0 0.8rem;
}
.ov-text {
	font-size: 2rem;
	line-height: 1.2;
	margin: 0;
	max-width: 36rem;
}
.ov-items {
	list-style: none;
	margin: 0;
	padding-bottom: 8rem;
	display: flex;
	flex-direction: column;
	gap: 1.1rem;
}
.ov-item {
	margin: 0 -1rem;   /* rows run edge to edge of the column */
	padding: 0.95rem 1rem;
	font-size: 1.8rem;
	line-height: 1.2;
	font-weight: 500;
}
.ov-item-primary { background-color: var(--ov-color); color: #F7F7F7; }
.ov-item-gold    { background-color: var(--fs-gold);  color: #F7F7F7; }
.ov-item-neutral { background-color: var(--fs-grey-2); color: #333; }
.ov-foot {
	padding-top: 1.3rem;
	padding-bottom: 1.6rem;
	align-self: stretch;
}
.ov-link {
	font-size: 1.8rem;
	line-height: 1.2;
	font-weight: 500;
	color: #333;
	text-decoration: none;
}
.ov-link span { color: var(--fs-orange); }
.ov-link:hover,
.ov-link:focus { color: #333; text-decoration: underline; }

/* Below 992px: stack in DOM order (group header, then each column) */
@media (max-width: 991.98px) {
	.service-overview { display: block; }
	.ov-group { min-height: 0; padding: 2.4rem 1.6rem; }
	.ov-cell { padding-left: 1.6rem; padding-right: 1.6rem; }
	.ov-item { margin: 0 -1.6rem; padding-left: 1.6rem; padding-right: 1.6rem; }
	.ov-items { padding-bottom: 2.4rem; }
	.ov-foot + .ov-head { margin-top: 1rem; }
	.ov-foot + .ov-group { margin-top: 3rem; }
}
