/*
Theme Name: Iskren Portfolio
Theme URI: https://iskrenivanov.com/
Author: Iskren Ivanov
Description: Custom portfolio theme. Sticky sidebar, case-study cards, and a Notion-style modal that opens each case study page in place.
Version: 2.0.3
Requires at least: 6.6
Requires PHP: 7.4
License: GPLv2 or later
Text Domain: iskren-portfolio
*/

/* ================================================================
   1. Tokens (from Figma)
   Fluid values scale between a 375px (mobile) and 1920px (desktop)
   screen: clamp(mobile size, fluid formula, desktop size).
   ================================================================ */
:root {
	/* Colors */
	--iv-void:   #16151A; /* Dark Void   – page background */
	--iv-cloud:  #1C1B20; /* Cloud Grey  – panels, sidebar */
	--iv-slate:  #262626; /* Slate Grey  – cards, modal */
	--iv-dusty:  #878787; /* Dusty Grey  – borders, copyright */
	--iv-snow:   #FBFBFB; /* Snow        – text */
	--iv-lava:   #FF3C00; /* Liquid Lava – accent, hover */
	--iv-dlava:  #4B2418; /* Dark Lava   – callouts */
	--iv-thumb:  #444444; /* scrollbar thumb */

	/* Fonts */
	--iv-head: 'Work Sans', system-ui, sans-serif;
	--iv-body: 'Manrope', system-ui, sans-serif;

	/* Type scale (Figma: mobile → desktop) */
	--iv-h1:    clamp(2rem, 1.8786rem + 0.5178vw, 2.5rem);   /* 32 → 40 */
	--iv-h2:    clamp(1.5rem, 1.3786rem + 0.5178vw, 2rem);   /* 24 → 32 */
	--iv-h3:    1.5rem;                                      /* 24 */
	--iv-h4:    1rem;                                        /* 16, uppercase */
	--iv-text:  1rem;                                        /* 16 */
	--iv-small: 0.75rem;                                     /* 12 */
	--iv-track: 0.02em;                                      /* letter-spacing */

	/* Spacing & radii */
	--iv-pad:     clamp(1rem, 0.8786rem + 0.5178vw, 1.5rem);  /* 16 → 24 */
	--iv-r-panel: clamp(1rem, 0.6359rem + 1.5534vw, 2.5rem);  /* 16 → 40 */
	--iv-r-card:  clamp(1rem, 0.7573rem + 1.0356vw, 2rem);    /* 16 → 32 */
	--iv-r-media: clamp(1rem, 0.8786rem + 0.5178vw, 1.5rem);  /* 16 → 24 */
	--iv-sidebar: clamp(360px, 40vw, 474px);

	--iv-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	--iv-admin: var(--wp-admin--admin-bar--height, 0px);
}

/* ================================================================
   2. Base
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; }

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

body {
	margin: 0;
	background: var(--iv-void);
	color: var(--iv-snow);
	font-family: var(--iv-body);
	font-size: var(--iv-text);
	line-height: 1.2;
	letter-spacing: var(--iv-track);
	-webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4, h5, h6 {
	margin: 0;
	font-family: var(--iv-head);
	font-weight: 700;
	line-height: 1;
	letter-spacing: var(--iv-track);
}

p { margin: 0; }

a {
	color: var(--iv-snow);
	text-decoration: none;
	text-underline-position: from-font;
	transition: color 0.2s;
}
a:hover { color: var(--iv-lava); text-decoration: underline; }

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

.iv-icon { flex: none; width: 24px; height: 24px; }

.iv-skip {
	position: absolute; left: 12px; top: -60px; z-index: 1000;
	padding: 8px 14px; border-radius: 8px;
	background: var(--iv-snow); color: var(--iv-void);
}
.iv-skip:focus { top: 12px; }

/* Buttons: ghost → Liquid Lava on hover */
.iv-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 48px;
	padding: 12px 16px;
	border: 0;
	border-radius: 32px;
	background: transparent;
	color: var(--iv-snow);
	font: 500 var(--iv-text)/1 var(--iv-body);
	letter-spacing: var(--iv-track);
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
}
.iv-btn:hover,
.iv-btn:focus-visible { background: var(--iv-lava); color: var(--iv-snow); text-decoration: none; }
.iv-btn--icon { width: 48px; padding: 12px; }

/* Card button: icon appears only while the button is hovered */
.iv-btn--reveal { align-self: flex-start; }
.iv-btn--reveal .iv-icon { display: none; }
.iv-btn--reveal:hover .iv-icon,
.iv-card__link:focus-visible .iv-btn--reveal .iv-icon { display: block; }
.iv-card__link:focus-visible .iv-btn--reveal { background: var(--iv-lava); }

/* Scrollbars: visible only on hover */
.iv-sidebar__inner,
.iv-modal__scroll {
	scrollbar-width: thin;
	scrollbar-color: transparent transparent;
}
.iv-sidebar__inner:hover,
.iv-sidebar__inner:focus-within,
.iv-modal__scroll:hover,
.iv-modal__scroll:focus-within {
	scrollbar-color: var(--iv-thumb) transparent;
}
.iv-sidebar__inner::-webkit-scrollbar,
.iv-modal__scroll::-webkit-scrollbar { width: 6px; }
.iv-sidebar__inner::-webkit-scrollbar-track,
.iv-modal__scroll::-webkit-scrollbar-track { background: transparent; }
.iv-sidebar__inner::-webkit-scrollbar-thumb,
.iv-modal__scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 8px; }
.iv-sidebar__inner:hover::-webkit-scrollbar-thumb,
.iv-modal__scroll:hover::-webkit-scrollbar-thumb { background: var(--iv-thumb); }

/* ================================================================
   3. Layout: sidebar + main panel
   ================================================================ */
.iv-layout {
	display: grid;
	grid-template-columns: var(--iv-sidebar) minmax(0, 1fr);
	min-height: 100vh;
}

.iv-sidebar {
	background: var(--iv-cloud);
	border-right: 1px solid var(--iv-dusty);
}

.iv-sidebar__inner {
	position: sticky;
	top: var(--iv-admin);
	height: calc(100vh - var(--iv-admin));
	overflow-y: auto;
	padding: var(--iv-pad);
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 48px;
}

.iv-sidebar__header,
.iv-sidebar__footer { display: flex; flex-direction: column; gap: 24px; }

.iv-brand { font-size: var(--iv-text); line-height: 1; }

/* Intro = home page content. Tamed so any block layout fits the sidebar. */
.iv-intro, .iv-intro * { max-width: 100%; }
.iv-intro > * + * { margin-top: 24px; }
.iv-intro .wp-block-columns,
.iv-intro .is-layout-flex,
.iv-intro .is-layout-grid { display: block !important; margin: 0 !important; padding: 0 !important; }
.iv-intro .wp-block-column,
.iv-intro .is-layout-flex > *,
.iv-intro .is-layout-grid > * { width: 100% !important; flex-basis: auto !important; margin: 0 0 24px !important; padding: 0 !important; }
.iv-intro .wp-block-group,
.iv-intro .wp-block-cover { padding: 0 !important; margin-top: 0 !important; min-height: 0 !important; background: none !important; }
.iv-intro .wp-block-spacer,
.iv-intro .wp-block-separator { display: none !important; }
.iv-intro h1, .iv-intro h2 {
	font-size: var(--iv-h1) !important;
	line-height: 1 !important;
	margin: 0 0 24px !important;
	color: var(--iv-snow) !important;
}
.iv-intro h1 em, .iv-intro h2 em,
.iv-amp { font-style: italic; color: var(--iv-lava) !important; }
.iv-intro p {
	font-size: var(--iv-text) !important;
	line-height: 1.2 !important;
	margin: 0 0 1.2em !important;
	color: var(--iv-snow) !important;
}
.iv-intro p:last-child { margin-bottom: 0 !important; }
.iv-intro strong { font-weight: 700; }

/* Link columns: top-level menu items are headings, sub-items are links */
.iv-links > ul {
	list-style: none; margin: 0; padding: 0;
	display: flex; gap: 24px;
}
.iv-links > ul > li { flex: 1 1 0; min-width: 0; }
.iv-links > ul > li > a {
	font: 700 var(--iv-h4)/1 var(--iv-head);
	letter-spacing: var(--iv-track);
	text-transform: uppercase;
}
.iv-links > ul > li > a[href="#"],
.iv-links > ul > li > a:not([href]) { pointer-events: none; }
.iv-links > ul > li:not(:has(.sub-menu)) > a { font: 400 var(--iv-text)/1.2 var(--iv-body); text-transform: none; pointer-events: auto; }
.iv-links .sub-menu {
	list-style: none; margin: 24px 0 0; padding: 0;
	display: flex; flex-direction: column; gap: 8px;
}
.iv-links .sub-menu a { line-height: 1.2; overflow-wrap: anywhere; }

.iv-contact p { margin-bottom: 1.2em; }
.iv-contact__email { text-decoration: underline; }

.iv-copyright { font-size: var(--iv-small); color: var(--iv-dusty); }

/* Main panel */
.iv-main { padding: var(--iv-pad); min-width: 0; }

.iv-panel {
	background: var(--iv-cloud);
	border-radius: var(--iv-r-panel);
	padding: var(--iv-pad);
	display: flex;
	flex-direction: column;
	gap: 32px;
}
.iv-panel__title { font-size: var(--iv-h2); }

/* ================================================================
   4. Cards
   ================================================================ */
/* 2 columns (Figma desktop); 1 column when the panel is narrow (tablet, mobile) */
.iv-panel { container-type: inline-size; }
.iv-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 24px;
}
@container (max-width: 760px) {
	.iv-grid { grid-template-columns: 1fr; }
}

.iv-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: var(--iv-slate);
	border-radius: var(--iv-r-card);
	overflow: hidden;
	color: var(--iv-snow);
	text-decoration: none;
}
.iv-card__link:hover { color: var(--iv-snow); text-decoration: none; }
.iv-card__link:focus-visible { outline-offset: 4px; }

.iv-card__media { aspect-ratio: 16 / 9; overflow: hidden; background: var(--iv-cloud); }
.iv-card__img, .iv-card__placeholder { display: block; width: 100%; height: 100%; object-fit: cover; }

.iv-card__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 24px;
	padding: var(--iv-pad);
}
.iv-card__text { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.iv-card__title { font-size: var(--iv-h3); }
.iv-card__summary { font-size: var(--iv-text); line-height: 1.2; }

.iv-notice {
	padding: 24px; border: 1px dashed var(--iv-dusty); border-radius: var(--iv-r-card); color: var(--iv-dusty);
}

/* ================================================================
   5. Case study (modal and full page share these styles)
   ================================================================ */
.iv-case__inner,
.iv-modal__content { display: flex; flex-direction: column; gap: 24px; }

.iv-case__title { font-size: var(--iv-h1); }

.iv-case__hero { margin: 0; }
.iv-case__hero img {
	display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
	border-radius: var(--iv-r-media);
}

.iv-case__details {
	margin: 0;
	padding-bottom: 24px;
	border-bottom: 1px solid var(--iv-dusty);
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 24px;
}
.iv-case__details dt { font: 700 var(--iv-h3)/1 var(--iv-head); letter-spacing: var(--iv-track); }
.iv-case__details dd { margin: 12px 0 0; }

.iv-case__content { padding-bottom: 48px; border-bottom: 1px solid var(--iv-dusty); }

.iv-case__nav { display: flex; gap: 8px; }
.iv-case__nav-link {
	flex: 1 1 0; min-width: 0;
	display: flex; flex-direction: column; gap: 8px;
}
.iv-case__nav-link span {            /* overline: Body Base */
	font: 400 var(--iv-text)/1.2 var(--iv-body);
	letter-spacing: var(--iv-track);
}
.iv-case__nav-link strong {          /* project name: H3 */
	font: 700 var(--iv-h3)/1 var(--iv-head);
	letter-spacing: var(--iv-track);
}
.iv-case__nav-link--next { text-align: right; align-items: flex-end; }
.iv-case__nav-link:hover { text-decoration: none; }
.iv-case__nav-link:hover strong,
.iv-case__nav-link:focus-visible strong { color: var(--iv-lava); text-decoration: underline; text-underline-offset: 4px; }

/* Page content (Gutenberg) */
.iv-prose > * { margin-top: 0; margin-bottom: 24px; max-width: 100%; }
.iv-prose > *:last-child { margin-bottom: 0; }
.iv-prose p, .iv-prose li { line-height: 1.5; }
.iv-prose h2, .iv-prose h3 {             /* section titles = H3 style */
	font-size: var(--iv-h3) !important;
	line-height: 1;
	margin: 48px 0 12px;
}
.iv-prose h4 { font-size: var(--iv-h4); text-transform: uppercase; margin: 32px 0 12px; }
.iv-prose > h2:first-child, .iv-prose > h3:first-child { margin-top: 0; }
.iv-prose a { text-decoration: underline; }
.iv-prose img { border-radius: var(--iv-r-media); }
.iv-prose figure { margin-left: 0; margin-right: 0; }
.iv-prose figcaption { color: var(--iv-dusty); font-size: var(--iv-small); text-align: center; margin-top: 8px; }
.iv-prose blockquote { margin-left: 0; padding-left: 24px; border-left: 2px solid var(--iv-lava); }
.iv-prose hr, .iv-prose .wp-block-separator { border: 0; border-top: 1px solid var(--iv-dusty); opacity: 1; }

/* Callout: Group or Paragraph → Styles → "Callout" */
.is-style-callout {
	background: var(--iv-dlava) !important;
	color: var(--iv-snow);
	padding: var(--iv-pad) !important;
	border-radius: var(--iv-r-media);
}

/* Old content: map the previous theme's fonts to the new ones */
.has-fraunces-font-family { font-family: var(--iv-head) !important; }
.has-jost-font-family { font-family: var(--iv-body) !important; }

/* Pages & blog */
.iv-entry__title { font-size: var(--iv-h1); margin-bottom: 24px; }
.iv-meta { color: var(--iv-dusty); font-size: var(--iv-small); margin: -12px 0 24px; }
.iv-posts { display: flex; flex-direction: column; }
.iv-post__link { display: block; padding: 24px 0; border-bottom: 1px solid var(--iv-dusty); }
.iv-post__link:hover { text-decoration: none; }
.iv-post__link .iv-meta { margin: 0 0 8px; }
.iv-post__title { font-size: var(--iv-h3); }
.iv-post__link:hover .iv-post__title { color: var(--iv-lava); }
.iv-post__excerpt { margin-top: 12px; color: var(--iv-snow); }

/* ================================================================
   6. Modal
   ================================================================ */
.iv-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
}
.iv-modal.is-visible { display: flex; }

.iv-modal__backdrop {
	position: absolute; inset: 0;
	background: rgba(22, 21, 26, 0.72);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	opacity: 0;
	transition: opacity 0.3s var(--iv-ease);
}

.iv-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(1040px, 100%);
	height: 100%;
	background: var(--iv-slate);
	border: 1px solid var(--iv-dusty);
	border-radius: var(--iv-r-panel);
	overflow: hidden;
	outline: none;
	opacity: 0;
	transform: translateY(16px) scale(0.985);
	transition: opacity 0.3s var(--iv-ease), transform 0.35s var(--iv-ease);
}
.iv-modal.is-open .iv-modal__backdrop { opacity: 1; }
.iv-modal.is-open .iv-modal__dialog { opacity: 1; transform: none; }

.iv-modal__bar {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px var(--iv-pad);
	border-bottom: 1px solid var(--iv-dusty);
}

.iv-modal__scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.iv-modal__content { padding: var(--iv-pad) var(--iv-pad) 48px; }

/* Scroll-reveal / lazy-load effects can't run inside the modal: show everything. */
.iv-modal__content [data-aos],
.iv-modal__content .wow,
.iv-modal__content .animate__animated,
.iv-modal__content [class*="animate"],
.iv-modal__content [class*="reveal"],
.iv-modal__content [class*="fade"],
.iv-modal__content [style*="opacity:0"],
.iv-modal__content [style*="opacity: 0"] {
	opacity: 1 !important;
	visibility: visible !important;
	transform: none !important;
	animation: none !important;
}

/* Loading skeleton */
.iv-skeleton span {
	display: block; height: 16px; margin-bottom: 16px; border-radius: 8px;
	background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.05) 75%);
	background-size: 200% 100%;
	animation: iv-shimmer 1.2s linear infinite;
}
.iv-skeleton span:first-child { height: 40px; width: 60%; margin-bottom: 24px; }
.iv-skeleton .iv-skeleton__img { height: auto; aspect-ratio: 16 / 9; border-radius: var(--iv-r-media); }
@keyframes iv-shimmer { to { background-position: -200% 0; } }

.iv-modal__error { color: var(--iv-snow); }
.iv-modal__error a { text-decoration: underline; }

html.iv-locked { overflow: hidden; }

/* ================================================================
   7. Responsive
   ================================================================ */
@media (max-width: 900px) {
	.iv-layout { display: flex; flex-direction: column; gap: 24px; }
	.iv-sidebar { border-right: 0; }
	.iv-sidebar__inner { position: static; height: auto; overflow: visible; gap: 64px; }
	.iv-main { padding: 0; }
}

@media (max-width: 640px) {
	.iv-modal { padding: 0; }
	.iv-modal__dialog { border: 0; border-radius: 0; }
	.iv-links > ul { gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.iv-modal__backdrop, .iv-modal__dialog, .iv-btn, a { transition: none; }
	.iv-skeleton span { animation: none; }
}
