/* Premier Jet — Notebook UI
   Visual language for the Premier Jet experience inside the Maktub theme.
   This file defines the paper/notebook aesthetic that Plugin 2+ will rely on. */

/* -------------------------------------------------------------------------
   Paper texture — used only inside the actual notebook wrapper, not the page
------------------------------------------------------------------------- */
/* Nothing applied at body/portal level — texture lives on .pj-notebook--ruled only */

/* -------------------------------------------------------------------------
   Notebook page wrapper
------------------------------------------------------------------------- */
.pj-notebook {
	background: var(--mk-white);
	border: 1px solid var(--mk-border);
	border-radius: 2px var(--mk-radius-lg) var(--mk-radius-lg) 2px;
	box-shadow: var(--mk-shadow-lg), -4px 0 0 var(--mk-gold), -8px 0 0 var(--mk-cream-dark);
	position: relative;
	overflow: hidden;
}

/* Ruled lines — very subtle ink rules, no heavy texture */
.pj-notebook--ruled {
	background-image: repeating-linear-gradient(
		transparent,
		transparent 31px,
		rgba(180,165,140,0.22) 31px,
		rgba(180,165,140,0.22) 32px
	);
	background-position: 0 64px;
	background-color: #fffffe;
}

/* Margin line */
.pj-notebook--margin::before {
	content: '';
	position: absolute;
	left: 72px;
	top: 0;
	bottom: 0;
	width: 1px;
	background: rgba(240,125,232,0.3);
	pointer-events: none;
}

.pj-notebook__body {
	padding: var(--mk-space-xl) var(--mk-space-xl) var(--mk-space-xl) 80px;
}

/* -------------------------------------------------------------------------
   Page header (week title)
------------------------------------------------------------------------- */
.pj-page-header {
	margin-bottom: var(--mk-space-xl);
	padding-bottom: var(--mk-space-lg);
	border-bottom: 1px dashed var(--mk-cream-border);
}

.pj-page-header__week {
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 2px;
	color: var(--mk-gold);
	margin-bottom: var(--mk-space-sm);
}

.pj-page-header__title {
	font-family: var(--mk-font-serif);
	font-size: clamp(1.4rem, 3vw, 2rem);
	color: var(--mk-dark);
	margin: 0 0 var(--mk-space-sm);
}

.pj-page-header__subtitle {
	font-size: 0.95rem;
	color: var(--mk-mid);
	font-style: italic;
	margin: 0;
}

/* -------------------------------------------------------------------------
   Question card
------------------------------------------------------------------------- */
.pj-question {
	position: relative;
	background: var(--mk-cream);
	border: 1px solid var(--mk-border);
	border-radius: var(--mk-radius-lg);
	padding: var(--mk-space-lg) var(--mk-space-xl);
	margin-bottom: var(--mk-space-lg);
	transition: box-shadow var(--mk-transition);
}
.pj-question:hover { box-shadow: var(--mk-shadow-md); }

.pj-question__prompt {
	font-family: var(--mk-font-serif);
	font-size: 1.1rem;
	color: var(--mk-dark);
	line-height: 1.5;
	margin-bottom: var(--mk-space-lg);
}

.pj-question__answer-area {
	background: var(--mk-white);
	border: 1.5px solid var(--mk-border);
	border-radius: var(--mk-radius-md);
	padding: var(--mk-space-md);
	min-height: 100px;
	font-family: var(--mk-font-sans);
	font-size: 0.95rem;
	color: var(--mk-dark);
	line-height: 1.7;
	width: 100%;
	box-sizing: border-box;
	resize: vertical;
	transition: border-color var(--mk-transition), box-shadow var(--mk-transition);
}
.pj-question__answer-area:focus {
	outline: none;
	border-color: var(--mk-pink);
	box-shadow: 0 0 0 3px rgba(240,125,232,0.12);
}

/* Saved answer display */
.pj-answer {
	background: var(--mk-white);
	border: 1px solid var(--mk-border);
	border-radius: var(--mk-radius-md);
	padding: var(--mk-space-md);
	font-size: 0.95rem;
	color: var(--mk-dark);
	line-height: 1.7;
	position: relative;
	font-family: var(--mk-font-sans);
}

/* No colored box borders on answers — annotation states handle their own visuals */
.pj-answer--mine   { }
.pj-answer--theirs { }
.pj-answer--unrevealed {
	filter: blur(4px);
	user-select: none;
	pointer-events: none;
	opacity: 0.5;
}

.pj-answer__label {
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 1px;
	margin-bottom: var(--mk-space-sm);
}
.pj-answer__label--mine { color: var(--mk-pink-dark); }
.pj-answer__label--theirs { color: var(--mk-green-dark); }

/* -------------------------------------------------------------------------
   Annotation toolbar
------------------------------------------------------------------------- */
.pj-toolbar {
	display: flex;
	align-items: center;
	gap: var(--mk-space-sm);
	padding: var(--mk-space-sm) var(--mk-space-md);
	background: var(--mk-cream);
	border: 1px solid var(--mk-border);
	border-radius: var(--mk-radius-md);
	box-shadow: var(--mk-shadow-sm);
	flex-wrap: wrap;
}

.pj-toolbar__btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 10px;
	border-radius: var(--mk-radius-sm);
	font-size: 0.78rem;
	font-weight: 700;
	cursor: pointer;
	border: 1.5px solid transparent;
	background: transparent;
	color: var(--mk-mid);
	transition: background var(--mk-transition), color var(--mk-transition);
}
.pj-toolbar__btn:hover { background: var(--mk-white); color: var(--mk-dark); }
.pj-toolbar__btn--active { background: var(--mk-white); border-color: var(--mk-border); color: var(--mk-dark); }
.pj-toolbar__sep { width: 1px; height: 20px; background: var(--mk-border); flex-shrink: 0; }

/* -------------------------------------------------------------------------
   Highlights — strong, clearly visible marker colors
------------------------------------------------------------------------- */
.pj-highlight {
	border-radius: 2px;
	padding: 0 3px;
	cursor: pointer;
	transition: background 0.15s ease;
}
.pj-highlight--yellow { background: rgba(255,225,30,0.65); }
.pj-highlight--blue   { background: rgba(66,165,245,0.45); }
.pj-highlight--pink   { background: rgba(240,100,220,0.45); }
.pj-highlight--red    { background: rgba(229,57,53,0.4); }

/* Hover makes them a touch more opaque */
.pj-highlight--yellow:hover { background: rgba(255,225,30,0.82); }
.pj-highlight--blue:hover   { background: rgba(66,165,245,0.62); }
.pj-highlight--pink:hover   { background: rgba(240,100,220,0.62); }
.pj-highlight--red:hover    { background: rgba(229,57,53,0.58); }

/* "Just applied" flash — JS adds .pj-mark-flash then removes it */
@keyframes mkMarkFlash {
	0%   { outline: 3px solid var(--mk-gold); outline-offset: 2px; }
	60%  { outline: 3px solid var(--mk-gold); outline-offset: 2px; }
	100% { outline: none; }
}
.pj-mark-flash { animation: mkMarkFlash 0.7s ease forwards; }

/* -------------------------------------------------------------------------
   Underlines — visually unmistakable
------------------------------------------------------------------------- */
.pj-underline {
	text-decoration: underline;
	text-decoration-style: solid;
	text-decoration-thickness: 2px;
	text-underline-offset: 5px;
	text-decoration-color: var(--mk-gold);
	cursor: pointer;
}
.pj-underline--non-negotiable {
	text-decoration-color: var(--mk-danger);
	text-decoration-thickness: 2.5px;
}

/* -------------------------------------------------------------------------
   Response-level annotation state — immediate visual feedback
   Applied by plugin JS via .has-notebook-* classes on .maktub-response
------------------------------------------------------------------------- */
@keyframes mkAnnotationPop {
	0%   { transform: scale(1); }
	30%  { transform: scale(1.008); }
	100% { transform: scale(1); }
}

.maktub-response.has-notebook-highlight {
	background: rgba(255,225,30,0.18) !important;
	border-left: 4px solid #e6b800 !important;
	animation: mkAnnotationPop 0.35s ease;
}

.maktub-response.has-notebook-underline {
	animation: mkAnnotationPop 0.35s ease;
}
/* Underline the actual response text, not the container border */
.maktub-response.has-notebook-underline .maktub-response-text,
.maktub-response.has-notebook-underline .pj-answer,
.maktub-response.has-notebook-underline > p,
.maktub-response.has-notebook-underline > div:not([class]) {
	text-decoration: underline;
	text-decoration-color: var(--mk-gold);
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

.maktub-response.has-notebook-dogear {
	animation: mkAnnotationPop 0.35s ease;
}
.maktub-response.has-notebook-dogear::after {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 0 28px 28px 0;
	border-color: transparent var(--mk-gold) transparent transparent;
	pointer-events: none;
}

.maktub-response.has-notebook-sticky {
	animation: mkAnnotationPop 0.35s ease;
}
.maktub-response.has-notebook-sticky::before {
	content: '';
	position: absolute;
	top: -8px;
	right: 12px;
	width: 32px;
	height: 32px;
	background: var(--mk-sticky-img) center/contain no-repeat;
	pointer-events: none;
	filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

/* Ensure positioned context for pseudo-elements */
.maktub-response { position: relative; }

/* -------------------------------------------------------------------------
   Sticky notes — uses real Blank-Tilted-Sticky-Note.png as background texture
------------------------------------------------------------------------- */
.pj-sticky {
	background:
		var(--mk-sticky-img) center/contain no-repeat,
		#fffde7;
	border: none;
	border-radius: var(--mk-radius-sm);
	padding: 28px var(--mk-space-md) var(--mk-space-md);
	font-family: var(--mk-font-hand);
	font-size: 1rem;
	color: var(--mk-dark);
	box-shadow: 3px 5px 14px rgba(0,0,0,0.14), 0 1px 0 rgba(255,255,255,0.8) inset;
	position: relative;
	min-width: 140px;
	max-width: 250px;
	transform: rotate(-1.5deg);
	line-height: 1.55;
}

/* Color variants */
.pj-sticky--blue    { background-color: #e3f2fd; }
.pj-sticky--pink    { background-color: var(--mk-pink-xlight); }
.pj-sticky--green   { background-color: var(--mk-green-light); }
.pj-sticky--concern { background-color: var(--mk-danger-light); }

.pj-sticky__type {
	font-size: 0.68rem;
	font-family: var(--mk-font-sans);
	text-transform: uppercase;
	letter-spacing: 1px;
	color: var(--mk-muted);
	display: block;
	margin-bottom: 4px;
}

/* -------------------------------------------------------------------------
   Dog-ear — clearly visible fold at card corner
------------------------------------------------------------------------- */
.pj-dogear {
	position: relative;
}
.pj-dogear::after {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 0 28px 28px 0;
	border-color: transparent var(--mk-cream-dark) transparent transparent;
	transition: border-color 0.2s ease, filter 0.2s ease;
}
.pj-dogear--active::after {
	border-color: transparent var(--mk-gold) transparent transparent;
	filter: drop-shadow(-2px 2px 3px rgba(201,168,76,0.4));
}

/* -------------------------------------------------------------------------
   Paperclip attachment — uses real paperclip.png graphic
------------------------------------------------------------------------- */
.pj-attachment {
	display: flex;
	align-items: center;
	gap: var(--mk-space-md);
	padding: var(--mk-space-sm) var(--mk-space-md);
	background: var(--mk-cream);
	border: 1px solid var(--mk-border);
	border-radius: var(--mk-radius-md);
	font-size: 0.85rem;
	color: var(--mk-mid);
	text-decoration: none;
	transition: background var(--mk-transition), box-shadow var(--mk-transition);
	margin: 4px 0;
	cursor: pointer;
}
.pj-attachment:hover {
	background: var(--mk-gold-light);
	color: var(--mk-dark);
	box-shadow: var(--mk-shadow-sm);
}
.pj-attachment__icon {
	display: block;
	width: 20px;
	height: 20px;
	background: var(--mk-paperclip-img) center/contain no-repeat;
	flex-shrink: 0;
}
.pj-attachment__label { font-weight: 600; }
.pj-attachment__type {
	margin-left: auto;
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: var(--mk-muted);
}

/* "Add attachment" trigger button used by plugins */
.pj-attachment-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 14px;
	background: var(--mk-cream);
	border: 1.5px dashed var(--mk-border);
	border-radius: var(--mk-radius-md);
	cursor: pointer;
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--mk-mid);
	transition: border-color var(--mk-transition), background var(--mk-transition);
}
.pj-attachment-trigger:hover {
	border-color: var(--mk-gold);
	background: var(--mk-gold-light);
	color: var(--mk-brown);
}
.pj-attachment-trigger__clip {
	display: inline-block;
	width: 16px;
	height: 16px;
	background: var(--mk-paperclip-img) center/contain no-repeat;
}

/* -------------------------------------------------------------------------
   Second Draft
------------------------------------------------------------------------- */
.pj-second-draft {
	border: 1px dashed var(--mk-gold);
	border-radius: var(--mk-radius-lg);
	padding: var(--mk-space-lg);
	background: var(--mk-gold-light);
	margin-top: var(--mk-space-lg);
}
.pj-second-draft__label {
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	color: var(--mk-gold-dark);
	margin-bottom: var(--mk-space-sm);
}

/* -------------------------------------------------------------------------
   Highlight guide — kept for plugin backward-compat; hidden by default
   The Paper Trail drawer replaces it as the primary annotations view.
------------------------------------------------------------------------- */
.pj-highlight-guide {
	position: fixed;
	bottom: 110px; /* floats above the sticky note trigger */
	right: 28px;
	z-index: 500;
}

.pj-highlight-guide__toggle {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--mk-dark);
	color: #fff;
	border: none;
	cursor: pointer;
	font-size: 0.9rem;
	box-shadow: var(--mk-shadow-md);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background var(--mk-transition);
}
.pj-highlight-guide__toggle:hover { background: var(--mk-brown); }

.pj-highlight-guide__panel {
	position: absolute;
	bottom: 52px;
	right: 0;
	width: 260px;
	background: var(--mk-white);
	border: 1px solid var(--mk-border);
	border-radius: var(--mk-radius-lg);
	padding: var(--mk-space-md);
	box-shadow: var(--mk-shadow-lg);
	font-size: 0.85rem;
	display: none;
}
.pj-highlight-guide__panel--open { display: block; }

.pj-highlight-guide__title {
	font-family: var(--mk-font-serif);
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--mk-dark);
	margin-bottom: var(--mk-space-md);
}

.pj-guide-key {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: var(--mk-space-sm);
}
.pj-guide-key__swatch {
	width: 20px;
	height: 16px;
	border-radius: 2px;
	flex-shrink: 0;
	margin-top: 2px;
}
.pj-guide-key__swatch--yellow { background: rgba(255,225,30,0.65);   border: 1px solid #c9a800; }
.pj-guide-key__swatch--blue   { background: rgba(66,165,245,0.45);   border: 1px solid #42a5f5; }
.pj-guide-key__swatch--pink   { background: rgba(240,100,220,0.45);  border: 1px solid var(--mk-pink); }
.pj-guide-key__swatch--red    { background: rgba(229,57,53,0.4);     border: 1px solid #e53935; }
.pj-guide-key__label { color: var(--mk-mid); line-height: 1.4; }
.pj-guide-key__label strong { color: var(--mk-dark); display: block; }

.pj-highlight-guide__note {
	margin-top: var(--mk-space-md);
	font-size: 0.78rem;
	color: var(--mk-muted);
	font-style: italic;
	border-top: 1px solid var(--mk-border);
	padding-top: var(--mk-space-sm);
}

/* -------------------------------------------------------------------------
   Clarity checkpoint
------------------------------------------------------------------------- */
.pj-checkpoint {
	background: linear-gradient(135deg, var(--mk-cream) 0%, var(--mk-gold-light) 100%);
	border: 1px solid var(--mk-gold);
	border-radius: var(--mk-radius-lg);
	padding: var(--mk-space-xl);
}
.pj-checkpoint__badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--mk-gold);
	color: #fff;
	padding: 4px 12px;
	border-radius: var(--mk-radius-pill);
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 1px;
	margin-bottom: var(--mk-space-md);
}
.pj-checkpoint__title {
	font-family: var(--mk-font-serif);
	font-size: 1.4rem;
	margin-bottom: var(--mk-space-lg);
}

/* -------------------------------------------------------------------------
   Final Copy
------------------------------------------------------------------------- */
.pj-final-copy {
	border: 2px solid var(--mk-gold);
	border-radius: var(--mk-radius-lg);
	overflow: hidden;
}
.pj-final-copy__header {
	background: linear-gradient(135deg, var(--mk-dark) 0%, var(--mk-brown) 100%);
	padding: var(--mk-space-xl) var(--mk-space-xl) var(--mk-space-lg);
	text-align: center;
	color: #fff;
}
.pj-final-copy__wordmark {
	font-family: var(--mk-font-serif);
	font-size: 2rem;
	font-weight: 700;
	color: var(--mk-pink);
	letter-spacing: 2px;
	margin-bottom: var(--mk-space-sm);
}
.pj-final-copy__subtitle {
	font-size: 0.85rem;
	color: rgba(255,255,255,0.7);
	font-style: italic;
}
.pj-final-copy__body {
	padding: var(--mk-space-xl);
	background: var(--mk-white);
}
.pj-final-copy__section {
	margin-bottom: var(--mk-space-xl);
	padding-bottom: var(--mk-space-xl);
	border-bottom: 1px solid var(--mk-border);
}
.pj-final-copy__section:last-child { border-bottom: none; margin-bottom: 0; }
.pj-final-copy__section-title {
	font-family: var(--mk-font-serif);
	font-size: 1.1rem;
	color: var(--mk-gold-dark);
	text-transform: uppercase;
	letter-spacing: 1px;
	font-size: 0.8rem;
	margin-bottom: var(--mk-space-md);
}

/* -------------------------------------------------------------------------
   Open When letter
------------------------------------------------------------------------- */
.pj-open-when {
	background: var(--mk-cream);
	border: 1px solid var(--mk-gold);
	border-radius: var(--mk-radius-lg);
	padding: var(--mk-space-xl);
	font-family: var(--mk-font-hand);
	font-size: 1.1rem;
	color: var(--mk-dark);
	line-height: 1.8;
	box-shadow: var(--mk-shadow-md);
	position: relative;
}
.pj-open-when::before {
	content: '✉';
	position: absolute;
	top: -14px;
	left: 50%;
	transform: translateX(-50%);
	font-size: 1.4rem;
	background: var(--mk-cream);
	padding: 0 8px;
}
.pj-open-when__condition {
	font-family: var(--mk-font-sans);
	font-size: 0.72rem;
	text-transform: uppercase;
	letter-spacing: 1.5px;
	color: var(--mk-gold-dark);
	margin-bottom: var(--mk-space-lg);
	font-weight: 700;
}

/* -------------------------------------------------------------------------
   Shared shelf media card
------------------------------------------------------------------------- */
.pj-media-card {
	background: var(--mk-white);
	border: 1px solid var(--mk-border);
	border-radius: var(--mk-radius-lg);
	overflow: hidden;
	box-shadow: var(--mk-shadow-sm);
	transition: transform var(--mk-transition), box-shadow var(--mk-transition);
}
.pj-media-card:hover { transform: translateY(-2px); box-shadow: var(--mk-shadow-md); }
.pj-media-card__image { width: 100%; height: 160px; object-fit: cover; }
.pj-media-card__body { padding: var(--mk-space-md); }
.pj-media-card__type {
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 1px;
	color: var(--mk-gold-dark);
	font-weight: 700;
	margin-bottom: 4px;
}
.pj-media-card__title { font-family: var(--mk-font-serif); font-size: 1rem; margin: 0 0 4px; }
.pj-media-card__creator { font-size: 0.8rem; color: var(--mk-muted); margin-bottom: var(--mk-space-sm); }

/* -------------------------------------------------------------------------
   Notebook note
------------------------------------------------------------------------- */
.pj-note {
	background: var(--mk-cream);
	border: 1px solid var(--mk-border);
	border-radius: var(--mk-radius-lg);
	padding: var(--mk-space-lg) var(--mk-space-lg) var(--mk-space-lg) 52px;
	position: relative;
	font-family: var(--mk-font-hand);
	font-size: 1.05rem;
	line-height: 1.7;
	color: var(--mk-dark);
	/* Ruled lines */
	background-image: repeating-linear-gradient(
		transparent, transparent 27px,
		rgba(200,180,160,0.3) 27px, rgba(200,180,160,0.3) 28px
	);
	background-position: 0 20px;
}
.pj-note__margin-line {
	position: absolute;
	left: 42px;
	top: 0;
	bottom: 0;
	width: 1px;
	background: rgba(240,125,232,0.25);
}
.pj-note__type {
	font-family: var(--mk-font-sans);
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 1px;
	color: var(--mk-pink-dark);
	font-weight: 700;
	margin-bottom: var(--mk-space-sm);
}
.pj-note__from {
	font-family: var(--mk-font-sans);
	font-size: 0.78rem;
	color: var(--mk-muted);
	margin-top: var(--mk-space-md);
	font-style: italic;
}

/* -------------------------------------------------------------------------
   Responsive
------------------------------------------------------------------------- */
@media (max-width: 640px) {
	.pj-notebook__body { padding: var(--mk-space-lg) var(--mk-space-md) var(--mk-space-lg) var(--mk-space-lg); }
	.pj-notebook--margin::before { display: none; }
	.pj-highlight-guide { bottom: 16px; right: 16px; }
	.pj-sticky { max-width: 90vw; }
}
