/* ==========================================================================
   Unlearn: "Write with us" page (accounts, dashboard, editor)
   ========================================================================== */

.ul-content > .ul-writer { width: min(var(--wide), calc(100% - 2 * var(--gutter))); }
.ul-writer { display: grid; gap: 28px; }
.ul-writer h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0; }
.ul-w-notice { max-width: 760px; }
.ul-hint { display: block; font-size: .88rem; font-weight: 500; color: var(--ink-soft); line-height: 1.5; }
.ul-linkbtn {
	background: none; border: 0; padding: 4px 2px; font: inherit; font-weight: 800; font-size: .95rem;
	color: var(--pink-text); text-decoration: underline; text-underline-offset: .2em; cursor: pointer;
}
.ul-linkbtn:hover { color: var(--ink); }
.ul-check { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 600 !important; font-size: .98rem; line-height: 1.5; cursor: pointer; }
.ul-check input { width: 22px !important; height: 22px; flex: 0 0 22px; margin-top: 3px; accent-color: var(--pink-btn); padding: 0 !important; }
.ul-check.is-shake { animation: ul-shake .5s; color: var(--pink-text); }
@keyframes ul-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------------------------------------------------------------- Sign in */
.ul-auth { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(20px, 4vw, 48px); align-items: start; }
@media (max-width: 860px) { .ul-auth { grid-template-columns: 1fr; } }

.ul-auth__intro {
	position: relative; overflow: hidden; background: var(--ink); color: var(--cream);
	border-radius: var(--radius); padding: clamp(26px, 4vw, 44px); padding-bottom: clamp(110px, 14vw, 150px);
	box-shadow: 8px 8px 0 var(--pink);
}
.ul-auth__intro h2 { color: var(--sun); font-size: clamp(2rem, 4vw, 2.9rem); margin-bottom: .35em; }
.ul-auth__intro > p { font-size: 1.12rem; color: var(--cream); }
.ul-auth__sun { position: absolute; inset-inline-end: -40px; bottom: -14px; width: 260px; color: var(--pink-bg); opacity: .95; }
.ul-steps { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 14px; counter-reset: step; position: relative; z-index: 1; }
.ul-steps li { counter-increment: step; display: grid; grid-template-columns: 44px 1fr; gap: 2px 14px; align-items: start; }
.ul-steps li::before {
	content: counter(step); grid-row: span 2; width: 44px; height: 44px; border-radius: 50%;
	background: var(--sun); color: var(--ink); font-weight: 900; font-size: 1.3rem; display: grid; place-items: center;
}
.ul-steps strong { color: var(--white); font-size: 1.12rem; line-height: 1.3; padding-top: 4px; }
.ul-steps span { color: var(--butter); font-size: .98rem; line-height: 1.5; }

.ul-auth__card {
	background: var(--white); border: 3px solid var(--ink); border-radius: var(--radius);
	padding: clamp(20px, 3.5vw, 34px); box-shadow: 8px 8px 0 var(--sun);
}
.ul-tabs { display: flex; gap: 6px; background: var(--cream); border: 2px solid var(--ink); border-radius: 999px; padding: 5px; margin-bottom: 24px; }
.ul-tabs__tab {
	flex: 1; text-align: center; text-decoration: none; padding: 10px 14px; border-radius: 999px;
	color: var(--ink); font-weight: 800; font-size: 1.05rem; line-height: 1.2; transition: background .2s, color .2s;
}
.ul-tabs__tab:hover { background: rgba(42, 10, 32, .07); color: var(--ink); }
.ul-tabs__tab.is-active { background: var(--ink); color: var(--sun); }
.ul-auth__form button[type="submit"] { justify-self: stretch; }
.ul-pass { position: relative; display: block; }
.ul-pass input { padding-inline-end: 84px !important; }
.ul-pass__show {
	position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%);
	background: var(--cream); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 12px;
	font: inherit; font-size: .85rem; font-weight: 800; color: var(--ink); cursor: pointer;
}
html[dir="rtl"] .ul-pass input { text-align: right; }

/* ------------------------------------------------------------- Guidelines */
.ul-guides { margin-top: 12px; }
.ul-guides h2 { margin-bottom: 18px; }
.ul-guides__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.ul-guides__item { background: var(--butter); border: 2px solid var(--ink); border-radius: 18px; padding: 18px 20px; }
.ul-guides__item:nth-child(2) { background: var(--white); }
.ul-guides__item:nth-child(3) { background: #FFD6E8; }
.ul-guides__item:nth-child(4) { background: var(--white); }
.ul-guides__item h3 { font-size: 1.15rem; margin: 6px 0 4px; }
.ul-guides__item p { margin: 0; font-size: .98rem; line-height: 1.6; }
.ul-guides__n { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--sun); font-weight: 900; }

/* ------------------------------------------------------------- Writer bar */
.ul-wbar {
	display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px;
	background: var(--white); border: 2px solid var(--ink); border-radius: 999px; padding: 8px 10px 8px 8px;
}
html[dir="rtl"] .ul-wbar { padding: 8px 8px 8px 10px; }
.ul-wbar__who { display: flex; align-items: center; gap: 10px; }
.ul-wbar__who .ul-author__img { width: 44px; height: 44px; font-size: 1.2rem; flex: 0 0 44px; }
.ul-wbar__who small { display: block; font-size: .8rem; color: var(--ink-soft); line-height: 1.1; }
.ul-wbar__who strong { display: block; line-height: 1.2; }
.ul-wbar__nav { display: flex; flex-wrap: wrap; gap: 4px; }
.ul-wbar__nav a { text-decoration: none; color: var(--ink); font-weight: 800; font-size: .98rem; padding: 7px 14px; border-radius: 999px; }
.ul-wbar__nav a:hover { background: rgba(42, 10, 32, .07); color: var(--ink); }
.ul-wbar__nav a.is-active { background: var(--ink); color: var(--sun); }
@media (max-width: 640px) {
	.ul-wbar { border-radius: 22px; padding: 10px; }
	.ul-wbar__nav { width: 100%; }
	.ul-wbar__nav a { padding: 6px 10px; font-size: .92rem; }
}

/* -------------------------------------------------------------- Dashboard */
.ul-dash__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.ul-empty {
	text-align: center; background: var(--white); border: 3px dashed var(--ink); border-radius: var(--radius);
	padding: clamp(28px, 5vw, 56px) 20px; display: grid; justify-items: center; gap: 6px;
}
.ul-empty__sun { width: 140px; color: var(--sun); }
.ul-empty h3 { font-size: 1.5rem; margin: 6px 0 0; }
.ul-empty p { max-width: 460px; color: var(--ink-soft); }

.ul-mylist { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.ul-mylist__item {
	display: flex; gap: 16px 24px; justify-content: space-between; align-items: center; flex-wrap: wrap;
	background: var(--white); border: 2px solid var(--ink); border-radius: 20px; padding: 18px 22px;
	box-shadow: 5px 5px 0 var(--butter); transition: transform .15s, box-shadow .15s;
}
.ul-mylist__item:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--butter); }
.ul-mylist__item--review { box-shadow: 5px 5px 0 var(--sun); }
.ul-mylist__item--published { box-shadow: 5px 5px 0 var(--pink); }
.ul-mylist__item--changes { box-shadow: 5px 5px 0 var(--magenta); }
.ul-mylist__main { flex: 1 1 320px; min-width: 0; }
.ul-mylist__main h3 { font-size: 1.3rem; margin: 8px 0 2px; overflow-wrap: anywhere; }
.ul-mylist__meta { margin: 0; color: var(--ink-soft); font-size: .92rem; }
.ul-mylist__actions { display: flex; align-items: center; gap: 12px; }
.ul-mylist__actions form { margin: 0; }
.ul-mylist__note { margin-top: 12px; background: #FFF1F7; border-inline-start: 5px solid var(--pink); border-radius: 10px; padding: 10px 14px; font-size: .98rem; }
.ul-mylist__note strong { display: block; font-size: .88rem; color: var(--pink-text); }
.ul-mylist__note p { margin: 2px 0 0; }

.ul-status {
	display: inline-flex; align-items: center; gap: 6px; padding: 2px 12px; border-radius: 999px;
	font-weight: 800; font-size: .85rem; line-height: 1.6; border: 2px solid var(--ink); white-space: nowrap;
}
.ul-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ul-status--draft { background: var(--cream); color: var(--ink); }
.ul-status--review { background: var(--sun); color: var(--ink); }
.ul-status--changes { background: #FFD6E8; color: var(--pink-text); }
.ul-status--declined { background: #EDE6EA; color: var(--ink-soft); }
.ul-status--published { background: var(--pink-bg); color: var(--white); }

/* ---------------------------------------------------------------- Profile */
.ul-profile { background: var(--white); border: 3px solid var(--ink); border-radius: var(--radius); padding: clamp(20px, 3.5vw, 34px); box-shadow: 8px 8px 0 var(--sun); max-width: 900px; }

/* ----------------------------------------------------------------- Editor */
.ul-editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; position: relative; }
@media (max-width: 960px) { .ul-editor { grid-template-columns: 1fr; } }
.ul-editor__main { min-width: 0; display: grid; gap: 14px; }
.ul-editor__status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; min-height: 30px; }
.ul-editor__saved { font-size: .88rem; color: var(--ink-soft); transition: color .3s; }
.ul-editor__saved.is-flash { color: var(--pink-text); }

.ul-editor__title {
	width: 100%; border: 0; background: transparent; resize: none; overflow: hidden; padding: 0;
	font-family: var(--font); font-weight: 900; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.2; color: var(--ink);
}
html[dir="rtl"] .ul-editor__title, .ul-editor__title[dir="rtl"] { line-height: 1.4; }
.ul-editor__title::placeholder { color: rgba(42, 10, 32, .3); }
.ul-editor__title:focus { outline: none; }

/* Toolbar: sticks under the top of the screen while writing */
.ul-tb {
	position: sticky; top: calc(var(--ul-head, 0px) + 10px); z-index: 20; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
	background: var(--ink); border-radius: 18px; padding: 6px; box-shadow: 5px 5px 0 var(--pink);
}
.ul-tb__group { display: flex; gap: 2px; padding-inline-end: 6px; border-inline-end: 1px solid rgba(255, 249, 227, .2); }
.ul-tb__group:last-child, .ul-tb__end { border: 0; padding: 0; }
.ul-tb__end { margin-inline-start: auto; }
.ul-tb button {
	min-width: 38px; height: 40px; padding: 0 6px; border: 0; border-radius: 12px; background: transparent;
	color: var(--cream); fill: currentColor; cursor: pointer; display: inline-grid; place-items: center;
	font-family: var(--font); font-weight: 800; font-size: 1rem; transition: background .15s, color .15s;
}
.ul-tb button svg { fill: currentColor; }
.ul-tb button:hover { background: rgba(255, 249, 227, .14); }
.ul-tb button.is-on, .ul-tb button[aria-pressed="true"] { background: var(--sun); color: var(--ink); }
.ul-tb__txt { font-size: 1.05rem; line-height: 1; font-family: Georgia, "Times New Roman", serif; font-weight: 700; }
.ul-tb__txt:not(b):not(i) { font-family: var(--font); font-weight: 900; }
.ul-tb__q { font-family: Georgia, serif !important; font-size: 1.9rem !important; line-height: .6 !important; transform: translateY(6px); }
.ul-tb__clear { text-decoration: line-through; text-decoration-thickness: 2px; }
.ul-tb__wide { padding: 0 14px !important; background: var(--pink-bg) !important; color: var(--white) !important; }
.ul-tb__wide[aria-pressed="true"] { background: var(--sun) !important; color: var(--ink) !important; }
html[dir="rtl"] .ul-mirror { transform: scaleX(-1); }
.ul-tb.is-preview .ul-tb__group:not(.ul-tb__end) { opacity: .35; pointer-events: none; }
@media (max-width: 640px) {
	.ul-tb { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; border-radius: 14px; top: calc(var(--ul-head, 0px) + 6px); margin-inline: -4px; }
	.ul-tb::-webkit-scrollbar { display: none; }
	.ul-tb__end { margin-inline-start: 0; }
	.ul-tb button { min-width: 42px; height: 42px; flex: 0 0 auto; }
}

.ul-editor__paper {
	background: var(--white); border: 3px solid var(--ink); border-radius: var(--radius);
	box-shadow: 8px 8px 0 var(--sun); min-height: 60vh; position: relative;
}
.ul-editor__body, .ul-editor__preview { padding: clamp(20px, 4vw, 48px); min-height: 60vh; }
.ul-editor__body:focus { outline: none; }
.ul-editor__paper:focus-within { box-shadow: 8px 8px 0 var(--pink); }
.ul-editor__body > * { margin: 0 0 1em; }
.ul-editor__body > :last-child { margin-bottom: 0; }
.ul-editor__body h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-top: 1.2em; }
.ul-editor__body h3 { font-size: 1.4rem; margin-top: 1em; }
.ul-editor__body blockquote {
	margin-inline: 0; padding: .5em 1.1em; border-inline-start: 6px solid var(--pink);
	background: #FFF1F7; border-radius: 0 14px 14px 0; font-weight: 700; font-size: 1.15em;
}
html[dir="rtl"] .ul-editor__body blockquote, .ul-editor__body[dir="rtl"] blockquote { border-radius: 14px 0 0 14px; }
.ul-editor__body blockquote p { margin: 0; }
.ul-editor__body ul, .ul-editor__body ol { padding-inline-start: 1.4em; }
.ul-editor__body li::marker { color: var(--pink); font-weight: 900; }
.ul-editor__body hr { border: 0; height: 4px; width: 120px; margin: 2em auto; background: radial-gradient(circle, var(--pink) 3px, transparent 4px) 0 0 / 20px 4px repeat-x; }
.ul-editor__body figure { margin-inline: 0; }
.ul-editor__body img { display: block; border-radius: 16px; border: 2px solid var(--ink); }
.ul-editor__body figcaption { font-size: .9rem; color: var(--ink-soft); margin-top: 6px; text-align: center; }
.ul-editor__body a { color: var(--pink-text); }
.ul-editor__body:has(> p:only-child > br:only-child)::before,
.ul-editor__body:empty::before {
	content: attr(data-placeholder); position: absolute; color: rgba(42, 10, 32, .35); pointer-events: none;
	inset-inline: clamp(20px, 4vw, 48px); font-size: 1.05rem;
}
.ul-img-loading {
	display: grid; place-items: center; min-height: 160px; border: 3px dashed var(--ink); border-radius: 16px;
	background: repeating-linear-gradient(45deg, var(--butter), var(--butter) 14px, var(--cream) 14px, var(--cream) 28px);
	font-weight: 800; animation: ul-pulse 1.2s infinite alternate;
}
@keyframes ul-pulse { to { opacity: .6; } }
.ul-editor__preview .ul-editor__ptitle { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: .6em; }
.ul-editor__preview > * { width: auto !important; }

.ul-editor__count { display: flex; gap: 16px; justify-content: flex-end; font-size: .9rem; color: var(--ink-soft); font-weight: 600; }
.ul-editor__count span + span::before { content: "·"; margin-inline-end: 16px; }

/* Restore bar */
.ul-restore {
	display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; background: var(--butter);
	border: 2px solid var(--ink); border-radius: 16px; padding: 10px 14px; font-weight: 700;
}
.ul-restore span { flex: 1 1 240px; }

/* Popover (links, alt text, captions) */
.ul-pop {
	position: fixed; z-index: 1000; inset-inline: 50% auto; top: 18%; transform: translateX(-50%);
	width: min(460px, calc(100% - 32px)); background: var(--white); border: 3px solid var(--ink);
	border-radius: 20px; padding: 18px; box-shadow: 8px 8px 0 var(--pink); display: grid; gap: 12px;
}
html[dir="rtl"] .ul-pop { transform: translateX(50%); inset-inline: auto 50%; }
.ul-pop[hidden] { display: none; }
.ul-pop label { display: grid; gap: 6px; font-weight: 800; }
.ul-pop input { font: inherit; padding: 10px 14px; border: 2px solid var(--ink); border-radius: 12px; width: 100%; }
.ul-pop input:focus { outline: none; box-shadow: 0 0 0 3px var(--magenta); }
.ul-pop__row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

/* Sidebar */
.ul-editor__side { display: grid; gap: 18px; position: sticky; top: calc(var(--ul-head, 0px) + 20px); }
@media (max-width: 960px) { .ul-editor__side { position: static; } }
.ul-panel { background: var(--white); border: 2px solid var(--ink); border-radius: 20px; padding: 18px; display: grid; gap: 16px; }
.ul-panel h3 { font-size: 1.15rem; margin: 0; }
.ul-panel > label, .ul-panel .ul-cover { display: grid; gap: 6px; font-weight: 800; font-size: .98rem; }
.ul-panel select, .ul-panel textarea {
	width: 100%; font: inherit; font-weight: 500; font-size: 1rem; padding: 10px 14px;
	border-radius: 12px; border: 2px solid var(--ink); background: var(--white); color: var(--ink);
}
.ul-panel select:focus, .ul-panel textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--magenta); }
.ul-panel--send { background: var(--ink); color: var(--cream); box-shadow: 6px 6px 0 var(--pink); }
.ul-panel--send .ul-check { color: var(--cream); }
.ul-panel--send .ul-hint { color: var(--butter); }
.ul-panel--send .ul-btn { width: 100%; }
.ul-panel--send .ul-btn--pink { box-shadow: 4px 4px 0 var(--sun); border-color: var(--sun); }
.ul-panel--send .ul-btn--butter:hover { box-shadow: 4px 4px 0 var(--pink); }

.ul-seg { display: flex; background: var(--cream); border: 2px solid var(--ink); border-radius: 999px; padding: 4px; gap: 4px; }
.ul-seg__opt { flex: 1; position: relative; cursor: pointer; }
.ul-seg__opt input { position: absolute; opacity: 0; inset: 0; }
.ul-seg__opt span { display: block; text-align: center; padding: 6px 10px; border-radius: 999px; font-weight: 800; }
.ul-seg__opt input:checked + span { background: var(--ink); color: var(--sun); }
.ul-seg__opt input:focus-visible + span { outline: 3px solid var(--magenta); }

.ul-cover__drop {
	position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9; overflow: hidden;
	border: 2px dashed var(--ink); border-radius: 16px; background: var(--cream); cursor: pointer; padding: 0; font: inherit; color: var(--ink);
}
.ul-cover__drop:hover { background: var(--butter); }
.ul-cover__drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ul-cover__drop img + .ul-cover__hint { position: absolute; bottom: 8px; inset-inline-start: 8px; background: var(--ink); color: var(--sun); border-radius: 999px; padding: 2px 12px; font-size: .85rem; }
.ul-cover__drop img + .ul-cover__hint small { display: none; }
.ul-cover__hint { font-weight: 800; display: grid; gap: 2px; text-align: center; }
.ul-cover__hint small { font-weight: 500; font-size: .8rem; color: var(--ink-soft); }
.ul-cover__drop.is-loading { animation: ul-pulse .8s infinite alternate; }
.ul-cover [hidden] { display: none; }

/* Focus mode: just the page and the words */
.ul-focus-mode, .ul-focus-mode body { overflow: hidden; }
.ul-editor.is-focus { position: fixed; inset: 0; z-index: 999; background: var(--cream); overflow-y: auto; display: block; padding: 18px; }
.ul-editor.is-focus .ul-editor__main { max-width: 820px; margin: 0 auto; }
.ul-editor.is-focus .ul-editor__side, .ul-editor.is-focus .ul-editor__status, .ul-editor.is-focus .ul-editor__review { display: none; }
.ul-editor.is-focus .ul-tb { top: 0; }
.ul-focus-mode { --ul-head: 0px !important; }
.ul-editor.is-focus .ul-editor__paper { box-shadow: none; border-color: transparent; background: transparent; }

/* Hidden panels stay hidden even when a class sets display */
.ul-writer [hidden] { display: none !important; }
/* The forms here should be visible at once (no scroll fade-in) */
.js-anim .ul-writer .ul-form, .js-anim .ul-writer .ul-author { opacity: 1 !important; transform: none !important; }

/* Slim banner once signed in */
.ul-is-writing .ul-pagehead { padding: clamp(22px, 3vw, 34px) 0; }
.ul-is-writing .ul-pagehead__title { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0; }
.ul-is-writing .ul-pagehead__intro, .ul-is-writing .ul-pagehead__sun { display: none; }
.ul-is-writing .ul-content { padding-top: clamp(20px, 3vw, 36px); }
