/* =========================================================
   风格三（战术终端）· 登录界面
   仅作用于 Typecho 原生登录页，不影响其它后台页面。
   ========================================================= */

/* ---------- 作用域包裹：只覆盖登录页 ---------- */
body.s3-login {
    background: #eef4fb;
    min-height: 100%;
    overflow-x: hidden;
}

/* ---------- 背景：浅蓝几何多边形（复刻设计稿） ---------- */
body.s3-login::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        linear-gradient(122deg, transparent 0 22%, rgba(190, 214, 240, .38) 22% 40%, transparent 40% 100%),
        linear-gradient(122deg, transparent 0 58%, rgba(203, 223, 245, .40) 58% 74%, transparent 74% 100%),
        linear-gradient(58deg, transparent 0 30%, rgba(214, 230, 248, .30) 30% 46%, transparent 46% 100%);
}
body.s3-login::after {
    /* 细微网格，呼应战术终端的「数据面板」质感 */
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: .5;
    background-image:
        linear-gradient(rgba(140, 175, 215, .10) 1px, transparent 1px),
        linear-gradient(90deg, rgba(140, 175, 215, .10) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 45%, #000 30%, transparent 100%);
    mask-image: radial-gradient(ellipse 80% 70% at 50% 45%, #000 30%, transparent 100%);
}

/* ---------- 布局：左标志 / 右终端 ---------- */
.typecho-login-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 56px;
    height: 100vh;
    max-height: 100vh;
    box-sizing: border-box;
}

/* 右侧终端。
   ⚠️ 这里曾用 `align-self: stretch` 让终端占满全高、标题 sticky 在顶。
   副作用是：容器撑到 100vh，而内容只有 ~500px，
   于是全部内容堆在上方、底部空出 400px，看起来就是「没垂直居中」。
   改为 align-self: center + max-height:100%：
     - 内容少 → 整块在视口垂直居中（align-self 由父级的 align-items:center 接管）
     - 内容多（用户自定义了很多行文案）→ max-height 封顶 + overflow-y:auto 内部滚动
   两种情况都成立，才是对的。 */
.s3l-term {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 520px;
    align-self: center;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: #b9d3f0 transparent;
    animation: s3l-fade-up .6s .25s both;
}
.s3l-term::-webkit-scrollbar { width: 6px; }
.s3l-term::-webkit-scrollbar-track { background: transparent; }
.s3l-term::-webkit-scrollbar-thumb { background: #b9d3f0; border-radius: 3px; }

.typecho-login {
    /* 原生是带边框白卡，这里彻底去卡片化，融入整屏 */
    width: auto;
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    animation: s3l-fade-up .55s .05s both;
}
.typecho-login > h1 { display: none; }   /* 隐藏原生 Typecho logo */

.typecho-login form { width: 100%; }
/* 终端壳内的表单显式占满终端宽度，不受 meta 行内容宽度牵制 */
.s3l-form { width: 100%; box-sizing: border-box; }

/* ---------- 左侧品牌 ---------- */
.s3l-brand {
    flex: 0 0 auto;
    width: 300px;              /* 固定宽度：避免被右侧挤压导致图文重叠 */
    max-width: 34vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;   /* 自身高度内垂直居中 */
    gap: 22px;
    align-self: center;
    animation: s3l-fade-up .6s .15s both;
}
.s3l-brand__mark { width: 100%; max-width: 260px; }
.s3l-brand__mark svg { width: 100%; height: auto; display: block; }
.s3l-brand__logo img {
    max-width: 100%;
    max-height: 66px;
    display: block;
    object-fit: contain;
}
.s3l-brand__logo-text {
    font-size: 56px;
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1;
    color: #1a5fc4;
    white-space: nowrap;      /* 永不换行，避免叠成两行 */
    font-family: "Arial Black", "Helvetica Neue", Impact, sans-serif;
}
/* 图形标下方跟文字时（品牌标志形态 = 矢量标 + 文字）字号收小，
   否则 56px 的字会把 260px 宽的图形标压得失衡。 */
.s3l-brand__mark + .s3l-brand__logo-text {
    font-size: 30px;
    letter-spacing: 6px;
    text-indent: 6px;         /* 抵消尾字多出的字距，视觉居中 */
}

/* ---------- 右侧终端 ---------- */
/* 顶部标题：—— 哈夫克全域互联终端 —— */
.s3l-term__head {
    position: sticky;
    top: -8px;                 /* 负值抵消 body 间距，让标题真正贴住顶部 */
    z-index: 2;
    text-align: center;
    margin-bottom: 22px;
    padding: 8px 0 10px;
    color: #1a5fc4;
    /* 半透明底：内容从下方滚过时不会糊在标题上 */
    background: linear-gradient(#eef4fb 72%, rgba(238, 244, 251, 0));
}
.s3l-term__head::before,
.s3l-term__head::after {
    content: '';
    position: absolute;
    top: 52%;
    width: 54px;
    height: 1px;
    background: #a9c6ea;
}
.s3l-term__head::before { left: 0; }
.s3l-term__head::after  { right: 0; }
.s3l-term__head b {
    position: relative;
    padding: 0 14px;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: 1px;
    background: #eef4fb;
}

/* 终端主体：文案极简（3~4 行），高度按内容走，不留大片空白 */
.s3l-term__body {
    min-height: 0;
    /* 阶段一 / 阶段二播完后由 JS 收合（后台「加载完成后的行为」= 自动进入时）。
       过渡写在这里，高度的起止值由 JS 以像素写入 —— max-height:auto 不可过渡。 */
    transition: max-height .34s cubic-bezier(.4, 0, .2, 1), opacity .22s linear;
}
.s3l-term__body.is-collapsed { margin: 0; }

/* 自检行：转圈 + 文本 */
.s3l-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14.5px;
    line-height: 1.9;
    color: #1660cc;
}
.s3l-line__spin {
    flex: none;
    width: 15px; height: 15px;
    border: 2px solid #cfe0f6;
    border-top-color: #1660cc;
    border-radius: 50%;
    animation: s3l-spin .8s linear infinite;
}
.s3l-line__text { flex: 1 1 auto; min-width: 0; }
.s3l-line__cursor {
    display: inline-block;
    width: 6px; height: 15px;
    margin-left: 3px;
    vertical-align: -2px;
    background: #1660cc;
    animation: s3l-blink .9s steps(1) infinite;
}

/* 完成报告行：▶ + 文本 */
.s3l-line--done { animation: s3l-line-in .28s both; }
.s3l-line--done .s3l-line__mark {
    flex: none;
    color: #1660cc;
    font-size: 12px;
    line-height: 1.9;
}

/* 阶段三：进入提示条 —— 可点击，点击后展开登录框 */
.s3l-tip {
    position: relative;
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 12px 18px;
    background: #fff;
    color: #1660cc;
    font-size: 14.5px;
    font-family: inherit;
    text-align: center;
    border: none;
    cursor: default;
    opacity: 0;
    animation: s3l-line-in .32s both;
}
.s3l-tip::before,
.s3l-tip::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: #1a5fc4;
}
.s3l-tip::before { left: 0; }
.s3l-tip::after  { right: 0; }
.s3l-tip__mark {
    display: inline-block;
    width: 8px; height: 8px;
    margin-right: 9px;
    background: #1a5fc4;
    vertical-align: 1px;
}

/* 可点击态：加手型 + 悬停反色 + 箭头 */
.s3l-tip--enter {
    cursor: pointer;
    transition: background .16s, color .16s;
}
.s3l-tip--enter .s3l-tip__arrow {
    display: inline-block;
    margin-left: 8px;
    font-size: 17px;
    line-height: 1;
    vertical-align: -1px;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .2s, transform .2s;
}
.s3l-tip--enter.is-ready .s3l-tip__arrow { opacity: 1; transform: none; }
.s3l-tip--enter.is-ready:hover { background: #f2f8ff; }
.s3l-tip--enter.is-ready:hover::before,
.s3l-tip--enter.is-ready:hover::after { background: #1660cc; }
.s3l-tip--enter.is-used {
    cursor: default;
    /* 已点击态：显式给 opacity:1，不能只写 animation:none。
       .s3l-tip 初始 opacity:0 是靠入场动画的 fill 模式补成 1 的，
       去掉动画就会退回透明 —— 元素隐形但仍占 42px 高度，表现为一条空白带。 */
    opacity: 1;
    background: #f4f8fd;
    color: #4a6a94;
    font-size: 13.5px;
    padding: 10px 18px;
    animation: none;
}
.s3l-tip--enter.is-used::before,
.s3l-tip--enter.is-used::after { background: #a9c6ea; }
.s3l-tip--enter.is-used .s3l-tip__mark { background: #7ba7dd; }
/* 呼吸提示：告诉用户「这里可以点」 */
.s3l-tip--enter.is-ready { animation: s3l-line-in .32s both, s3l-breathe 1.9s ease-in-out .4s infinite; }
@keyframes s3l-breathe {
    0%, 100% { background: #fff; }
    50%      { background: #e8f1fd; }
}

/* ---------- 阶段三：表单 ---------- */
/* 终端日志与登录表单之间的分隔线：让「机器输出」和「人工输入」两块泾渭分明 */
.s3l-form {
    border-top: 1px dashed #c3daf5;
    padding-top: 22px;
    margin-top: 20px;
}
/* 初始隐藏；淡入只在 .is-on 时播放一次。
   .is-on 由 JS 加在 .s3l-form 自身上（与选择器必须是同一元素）。 */
/* 不写 `.s3l-form{opacity:0}`：那样必须依赖 animation 的 fill 模式把 opacity 补回来，
   一旦动画被跳过/中断就会永久停在透明态（实际踩过：表单整块发灰）。
   改为初始 visibility:hidden + is-on 时可见，动画只负责位移，天然不会卡在透明。 */
.s3l-form { visibility: hidden; }
.s3l-form.is-on {
    visibility: visible;
    animation: s3l-form-in .5s both;
}
@keyframes s3l-form-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}
.s3l-form__field { margin-bottom: 20px; }
.s3l-form__label {
    display: block;
    margin-bottom: 7px;
    font-size: 14.5px;
    font-weight: 600;
    color: #2c3742;
}

/* 输入框：直角 + 蓝色聚焦态，呼应设计稿。
   用元素选择器而非 .text-l class：原生 class 名可能随 Typecho 版本变化。
   ⚠️ email 类型必须一并覆盖：注册页的邮箱框是 type="email"，
   漏掉它就会退回原生外观，在终端壳里显得像「贴上去的」。 */
.s3l-form input[type=text],
.s3l-form input[type=password],
.s3l-form input[type=email],
.s3l-form select{
    display: block;
    width: 100%;
    height: 44px;
    padding: 10px 13px;
    font-size: 15px;
    color: #1f2933;
    background: #fff;
    border: 1px solid #b9d3f0;
    border-radius: 0;
    box-sizing: border-box;
    transition: border-color .16s, box-shadow .16s;
}
.s3l-form input::placeholder { color: #a8b6c6; }
.s3l-form input:focus {
    outline: none;
    border-color: #1a5fc4;
    box-shadow: 0 0 0 2px rgba(26, 95, 196, .13);
}
.s3l-form input:-webkit-autofill,
.s3l-form input:-webkit-autofill:hover,
.s3l-form input:-webkit-autofill:focus {
    -webkit-text-fill-color: #1f2933;
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
}
/* 注册页字段比登录页多一个（代号 + 邮箱），行距略收紧避免终端过高 */
body.s3-login--register .s3l-form__field { margin-bottom: 16px; }

.s3l-form__submit { margin: 26px 0 0; }
/* 用元素选择器而非 .primary class：原生 class 名可能随 Typecho 版本变化 */
.s3l-form__submit button,
.s3l-form button[type="submit"] {
    display: block;
    width: 100%;
    height: 46px;
    padding: 0;
    font-size: 15.5px;
    font-weight: 600;
    letter-spacing: 1px;
    line-height: 46px;
    color: #fff;
    background: #1a5fc4;
    border: none;
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
    transition: background .16s;
}
.s3l-form__submit button:hover,
.s3l-form button[type="submit"]:hover { background: #14509f; }
.s3l-form__submit button:active,
.s3l-form button[type="submit"]:active { background: #114585; }
.s3l-form__submit button:disabled,
.s3l-form button[type="submit"]:disabled { background: #9db8dd; cursor: default; }

.s3l-form__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 16px;
    font-size: 13px;
    color: #6b7783;
    /* 注册页有 3 个子项（邀请码位 / 去登录 / 返回首页），登录页只有 2 个。
       不允许 flex 项把自己的内容宽度当基准（默认 min-width:auto），
       否则整行撑宽 → 反过来把 .s3l-form 顶宽 → 输入框跟着变窄
       （实测平板 820px 下输入框只剩 226px）。
       flex-wrap + min-width:0 让它宁可换行也不撑大父级。 */
    flex-wrap: wrap;
    min-width: 0;
}
.s3l-form__meta > * { min-width: 0; }
/* 窄屏下三个链接并排会挤，允许落到两行 */
.s3l-form__meta a { white-space: nowrap; }
.s3l-form__meta label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.s3l-form__meta a { color: #1a5fc4; }
/* 校验失败时的临时提示条（替代被关掉的浏览器原生气泡） */
.s3l-flash {
    margin: 0 0 12px;
    padding: 7px 11px;
    font-size: 13px;
    color: #8a5a12;
    background: #fdf3d8;
    border-left: 3px solid #d0a83a;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .18s, transform .18s;
    pointer-events: none;
}
.s3l-flash.is-on { opacity: 1; transform: none; }

.s3l-form__err {
    margin: 0 0 14px;
    padding: 8px 12px;
    font-size: 13.5px;
    color: #8a1f11;
    background: #fbe3e4;
    border-left: 3px solid #b94a48;
}
/* 失败态：提示条随表单一起淡入，而不是在启动画面上方凭空出现 */
.s3l-form__err { opacity: 0; }
.s3l-form__err.is-on {
    opacity: 1;
    animation: s3l-form-in .45s .12s both;
}
/* 非错误级提示（success / notice）用中性蓝，避免一进来就是刺眼的红 */
.s3l-form__err--success { color: #1c5c30; background: #e2f3e6; border-left-color: #4a9c63; }
.s3l-form__err--notice { color: #7a5a12; background: #fdf3d8; border-left-color: #d0a83a; }

/* 原生 .more-link 换配色 */
.typecho-login .more-link {
    margin-top: 18px;
    font-size: 13px;
    text-align: center;
    color: #7d8894;
}
.typecho-login .more-link a { color: #1a5fc4; }

/* ---------- 动画 ---------- */
@keyframes s3l-spin { to { transform: rotate(360deg); } }
@keyframes s3l-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes s3l-line-in {
    from { opacity: 0; transform: translateX(-7px); }
    to   { opacity: 1; transform: none; }
}
@keyframes s3l-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* 尊重系统的「减少动态效果」偏好 */
@media (prefers-reduced-motion: reduce) {
    .s3l-brand, .typecho-login, .s3l-term, .s3l-form { animation: none !important; }
    .s3l-line__spin { animation: none; }
    .s3l-line__cursor { animation: none; }
    .s3l-line--done, .s3l-tip { animation: none; }
}

/* ---------- 响应式：窄屏收起左侧标志 ---------- */
@media (max-width: 860px) {
    .typecho-login-wrap {
        flex-direction: column;
        gap: 30px;
        padding: 40px 24px;
    }
    .s3l-brand__mark { width: 180px; max-width: 52vw; }
    .s3l-brand__logo-text { font-size: 42px; }
    /* ⚠️ 这里必须是 width:100%，不能只写 max-width:100%。
       窄屏（≤860px）wrap 变成 column 方向，交叉轴默认 stretch ——
       看起来应该自动满宽，但 .s3l-term 显式写了 `align-self:center`，
       stretch 失效，宽度退回 flex-basis:auto（= 内容宽度）。
       结果：终端块按标题文字长度收缩，注册页「哈夫克入职申请终端」比登录页
       多两个字就把整块撑/缩到另一个尺寸，输入框跟着只剩 226px（登录页 256px）。
       写死 width:100% 让两页在窄屏下拿到同样的可用宽度。
       align-self 保持 center（不改成 stretch），否则整块贴到顶部、
       max-height:100% + overflow-y:auto 的封顶逻辑也会跟着变形。 */
    /* align-self:center 在 column 方向下已作用于交叉轴（水平居中），
       不能再叠 margin:auto —— 两者同时存在时 auto margin 会吃掉
       剩余空间，把块顶到左缘（实测平板下终端块整体偏左 132px，
       与上方居中的品牌标对不齐）。保留 align-self 即可。 */
.s3l-term { width: 100%; max-width: 520px; }
}
/* 窄屏下的底部链接行。
   ⚠️ 不要用 justify-content:center —— 登录页有 3 个元素
   （下次自动登录 / 申请入职 / 返回首页），居中会把三者挤成一坨（实测 390px 下
   相邻文字几乎贴住）。space-between 让它们匀开，两端贴边、中间留白。 */
@media (max-width: 640px) {
    .s3l-form__meta { justify-content: space-between; gap: 10px 14px; }
}
@media (max-width: 480px) {
    .s3l-term__head b { font-size: 17px; }
    .s3l-term__head::before, .s3l-term__head::after { width: 22px; }
    .s3l-line { font-size: 13.5px; }
    .s3l-brand { display: none; }   /* 手机上直接给表单，优先可用性 */
}
